Blockland Forums > Modification Help
Announce problem
jouatt:
What I am trying to say is that I just started trying to learn simple scripting and I am having a problem.
Here is the script I have. It probably has alot of flaws but that is what I came to fix. What I am trying to do Is make it so when I type "/announce" everyone gets a message saying "The server is shutting down."
Simple.
--- Code: ---Function serverCmdAnnounce(%client, %text)
{
if(%client.isSuperAdmin)
{
messageAll(%client,'',"Server is shutting down.");
}
else
{
messageClient(%client,'',"You are not an admin.");
}
}
--- End code ---
Kalphiter:
messageAll(%client,'',"Server is shutting down.");
Tell me what's wrong.
rkynick:
Suggestion: use the announce("text"); function.
jouatt:
--- Quote from: rkynick on June 23, 2010, 11:38:48 PM ---Suggestion: use the announce("text"); function.
--- End quote ---
So that would be..
Function serverCmdAnnounce(%client, %text)
{
if(%client.isSuperAdmin)
{
announce("Server is shutting down");
}
else
{
messageClient("You are not an admin.");
}
}
I'll test it now.
-edit-
No luck.
MegaScientifical:
--- Code: ---function serverCmdAnnounce(%client, %text) {
if(%client.isSuperAdmin) {
if(strLen(%text))
announce(%text);
else
announce("Server is shutting down");
}
else
messageClient(%client, '', "You are not an admin.");
}
--- End code ---
That's probably wrong in the %text check, or can be done more simply.