function onActionServerSide() {
if (params[0] == "sendtext2") {
for (temp.pl: allplayers) {
if (temp.pl.level != NULL) {
temp.pl.triggerclient(this.name, "gettext2", params[1], player.nick);
}
}
}
}
public function sendtochatroom(temp.msg, temp.title, temp.rgba) {
for (temp.pl: allplayers)
pl.triggerclient("gui", this.name, "gettext2", msg, title, rgba);
}
//#CLIENTSIDE
function onCreated() {
sendtochatroom("helloz", "Server", {
1, 2, 1, 1
});
new GuiControl("Msg2_Window1") {
useownprofile = true;
profile.border = 1;
profile.opaque = true;
visible = false;
profile.fillColor = {
0, 55, 150, 225
};
width = 328.5;
destroyonhide = true;
height = 250;
canmove = true;
x = 517;
y = 203;
new GuiScrollCtrl("Msg2_Chatbox_Scroll") {
profile = GuiBlueScrollProfile;
height = 215;
hscrollbar = "dynamic";
vscrollbar = "dynamic";
width = 316;
x = 6.5;
y = 6.5;
new GuiMLTextCtrl("Msg2_Chatbox") {
temp.version = "2.3";
profile = GuiBlueMLTextProfile;
height = 17;
horizsizing = "width";
text = "System: Input /clear to clear the message box.";
width = 312;
profile.fontsize = 14.3;
profile.fonttype = "Arial";
profile.textshadow = false;
}
}
new GuiTextEditCtrl("Msg2_ChatBar") {
profile = GuiBlueTextEditProfile;
height = 20;
width = 316;
x = 6;
y = 225;
}
}
}
function Msg2_ChatBar.onAction() {
temp.msg2 = "";
if (Msg2_ChatBar.text == "/clear") {
Msg2_Chatbox.text = "Cleared!";
} else {
if (Msg2_ChatBar.text != NULL) {
temp.msg2 = Msg2_ChatBar.text;
triggerserver("weapon", this.name, "sendtext2", temp.msg2);
Msg2_ChatBar.text = "";
}
}
if (temp.msg2.starts("/font ")) {
say2("Works");
}
}
function onActionClientSide() {
if (params[0] == "gettext2") {
Msg2_Chatbox.addtext("
" @ params[2] @ ": " @ params[1], false);
Msg2_Chatbox.scrolltobottom();
}
}
function onKeyPressed(num1, code, num2) {
if (code == "1") {
if (Msg2_Window1.visible == true) {
Msg2_Window1.visible = false;
player.chat = "Chat Room: OFF!";
} else {
Msg2_Window1.visible = true;
player.chat = "Chat Room: ON!";
}
}
}