Alright, so I have made a little mass message GUI and I have a quick question.
Since it is being sent to everyone, does "for (temp.pl: allplayers)" get all of the players on the server or just local players in the same level?
Also, here is the code im using. How can I improve it?
Thanks
PHP Code:
function onActionServerSide() {
switch (params[0]) {
case "send":
for (temp.pl: allplayers) {
findplayer(temp.pl).sendPM(client.massmessage);
player.chat = "Successfully sent a mass message to " @ temp.pl @ "!";
}
break;
}
}
//#CLIENTSIDE
function onPlayerChats() {
if (player.chat.starts("+mass")) {
CreateGUI();
}
}
function CreateGUI() {
new GuiWindowCtrl("mass_window") {
profile = GuiBlueWindowProfile;
x = screenwidth / 2.5;
y = screenheight / 2.5;
width = 200;
height = 200;
text = "Mass Message";
destroyonhide = true;
canminimize = canresize = canmaximize = false;
new GuiScrollCtrl("mass_scroller") {
profile = GuiBlueScrollProfile;
x = 10;
y = 30;
width = 180;
height = 130;
hscrollbar = "alwaysOff";
vscrollbar = "alwaysOff";
new GuiMLTextEditCtrl("mass_text") {
profile = GuiBlueMLTextEditProfile;
x = 0;
y = 0;
width = 180;
height = 130;
}
}
new GuiButtonCtrl("mass_send") {
profile = GuiBlueButtonProfile;
x = 75;
y = 165;
width = 50;
height = 25;
text = "Send";
}
}// main
}
function mass_send.onAction() {
client.massmessage = mass_text.text;
triggerserver("gui", this.name, "send");
mass_text.text = "";
}
Edit:
Also, in this part of the code:
PHP Code:
findplayer(temp.pl).sendPM(client.massmessage);
How can I add a line break between a specific sting of text and then the actual message?
Thank you