I just started on this. I'll probobly be done with everything by tommorow
PHP Code:
function onActionServerside(action){
switch (action){
case "SendMessage":
SendMessage(player.account, params[1], params[2]);
break;
case "BlockBuddy":
if (player.clientr.messaging_blocked.index(params[1]) < 0){
player.clientr.messaging_blocked.add(params[1]);
player.addMessage(format(_("%s was added to your block list"), params[1]));
}
break;
}
}
public function SendMessage(from, to, message){
temp.phead = findPlayer(temp.from).headimg;
findPlayer(temp.to).triggerClient("gui", name, "ReceivedMessage", temp.from, temp.message, temp.phead);
}
//#CLIENTSIDE
function onCreated()
CreateVariables();
function CreateVariables(){
join("functions_system");
this.defaultprofile = "GuiBlue";
this.buttons = {"BuddyInfo", "Block", "Warn"};
this.buttonextent = 60;
this.buttondistance = 2;
}
function onActionClientside(action){
switch (action){
case "ReceivedMessage":
drawText(format(/*"<%img src=%s offsetx=3 offsety=69 height=32 width=32 />*/"<b><font color=\"red\">%s:</b></font>", /*params[3],*/ params[1]), params[1]);
drawText(params[2], params[1]);
break;
}
}
function onPlayerChats(){
if (player.chat.starts(":im")){
temp.recipient = player.chat.substring(4);
if (GetStatus(temp.recipient)){
drawWindow(temp.recipient);
}
}
}
function GetStatus(recipient){
temp.notBlocked = ((findPlayer(temp.recipient).clientr.messaging_blocked.index(player.account)) < 0);
temp.isOnline = (findPlayer(temp.recipient).account ? true : false);
temp.canIM = (temp.notBlocked && temp.isOnline);
return temp.canIM;
}
function drawWindow(recipient){
if (temp.recipient.length() < 2) return player.chat = "Error";
if (("IMWindow_" @ temp.recipient).visible) return;
new GuiWindowCtrl("IMWindow_" @ temp.recipient){
profile = format("%sWindowProfile", thiso.defaultprofile);
extent = {350, 300};
canResize = canMaximize = false;
title = true;
text = "Instant Message - " @ temp.recipient;
visible = true;
new GuiScrollCtrl("IMScroll_" @ temp.recipient){
profile = format("%sScrollProfile", thiso.defaultprofile);
position = {6, 24};
hScrollBar = "alwaysOff";
vScrollbar = "dynamic";
extent = {(this.parent.width - 12), (this.parent.height - 57)};
new GuiMLTextCtrl("IMText_" @ temp.recipient){
profile = format("%sTextProfile", thiso.defaultprofile);
extent = {(parent.width + 6), 0};
text = format("<b> Chat with %s, Started %i:%i:%i. All times are GMT</b>", temp.recipient, getRealTime(0, 1, 0)[0], getRealTime()[1], getRealTime()[2]);
}
}
new GuiTextEditCtrl("IMTextEdit_" @ temp.recipient){
profile = format("%sTextEditProfile", thiso.defaultprofile);
position = {6, (this.parent.height - 31.5)};
text = "";
extent = {((this.parent.width) - (20 + thiso.buttons.size() * thiso.buttonextent + thiso.buttondistance)), 25};
thiso.catchevent(this.name, "onAction", "SendMessage");
historySize = 100;
}
for (temp.i = 0; temp.i < thiso.buttons.size(); temp.i++){
new GuiButtonCtrl("IMButton_" @ temp.recipient @ "_" @ thiso.buttons[temp.i]){
profile = format("%sButtonProfile", thiso.defaultprofile);
position = {(((this.parent.width + 60 + thiso.buttonextent)/ thiso.buttons.size()) + (i * (thiso.buttonextent + thiso.buttondistance))), (this.parent.height - 31.5)};
extent = {thiso.buttonextent, 25};
text = thiso.buttons[temp.i];
thiso.catchevent(this.name, "onAction", "ButtonPressed");
}
}
}
}
function ButtonPressed(){
temp.buttonName = params[0].substring(params[0].positions("_")[params[0].positions("_").size()-1] + 1);
temp.buttonParent = params[0].parent;
("Button" @ temp.buttonName)(temp.buttonParent);
}
function SendMessage(control) {
temp.textcontrol = makevar("IMText_" @ temp.recipient);
if (temp.control.text.length() < 1) return;
temp.recipient = temp.control.substring(("IMTextEdit_").length());
drawText(format(/*"<img src=%s offsetx=3 offsety=69 width=26 height=23 />*/"<b><font color=\"blue\">%s:</b></font>", /*player.headimg,*/ player.account), temp.recipient);
drawText(temp.control.text, temp.recipient);
triggerServer("gui", name, "SendMessage", temp.recipient, temp.control.text);
temp.control.text = "";
}
function drawText(text, recipient){
if (temp.text.length() < 1) return;
temp.window = makevar("IMWindow_" @ temp.recipient);
temp.control = makevar("IMText_" @ temp.recipient);
if (!temp.window.visible) drawWindow(temp.recipient);
temp.control.addText("\n" SPC temp.text, true);
temp.control.scrolltoBottom();
}
function ButtonClose(window)
(temp.window).destroy();
function ButtonWarn(window)
return;
function BuddyInfo()
return;
function ButtonBlock(window){
temp.recipientName = temp.window.substring(("IMWindow_").length());
if (temp.recipientName == player.account) return player.addMessage("You cannot block yourself");
triggerServer("gui", name, "BlockBuddy", temp.recipientName);
(temp.window).destroy();
}
Ever since I saw Chandlers I realized how much I wanted to make my own lol,
anyways I removed displaying of heads as it was buggy. Just say :im <acc>
to start a conversation, make sure they have the weapon.