Blockland Forums > Modification Help

Variables and Sentences

Pages: (1/1)

Custard:

I need help.


--- Quote ---function servercmdmayor(%client, %action, %subject)
{
   if(%action $= "")
   {
      messageClient(%client, '',"\c6Please enter one of the following commands to continue:");
      messageClient(%client, '',"\c3/mayor set \c6- Brings up a list of things the mayor can set.");
      messageClient(%client, '',"\c3/mayor broadcast \c6- Allows the mayor to broadcast a message to the people.");
   }
   else if(%action $= "broadcast" && %subject $= "")
   {
      messageClient(%client, '',"\c6Please enter a message to broadcast.");
   }
   else
   {
      messageAll('',"\c5Broadcast: \c6" @ %subject);
   }
}
--- End quote ---

As you can see from the script, the local variable "subject" accounts for the sentence that I am trying to broadcast. I want it to be a sentence, however, not just one word.

As of right now, when I type "/mayor broadcast text" it cuts off the entire sentence and only keeps the beginning word. How can I fix this?

computermix:

using servercmd is odd in arguments...


--- Code: ---function servercmdmayor(%client, %action, %subject, %subject2, %subject3,%subject4,%subject5,%subject6,%subject7)
{
   if(%action $= "")
   {
      messageClient(%client, '',"\c6Please enter one of the following commands to continue:");
      messageClient(%client, '',"\c3/mayor set \c6- Brings up a list of things the mayor can set.");
      messageClient(%client, '',"\c3/mayor broadcast \c6- Allows the mayor to broadcast a message to the people.");
   }
   else if(%action $= "broadcast" && %subject $= "")
   {
      messageClient(%client, '',"\c6Please enter a message to broadcast.");
   }
   else
   {
      messageAll('',"\c5Broadcast: \c6" @ %subject SPC %subject2 SPC %subject3 SPC %subject4 SPC %subject5 SPC %subject6 SPC %subject7);
   }
}
--- End code ---

I think servercmdwhatever splits up the arguments between every space.

this can only handle 7 words, but you can add more.

if you look at the /me script it uses the same method


Custard:

haha how inefficient.

It works though, so thank you much.

Pages: (1/1)

Go to full version