Author Topic: Variables and Sentences  (Read 465 times)

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);
   }
}

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?

using servercmd is odd in arguments...

Code: [Select]
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);
   }
}

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

haha how inefficient.

It works though, so thank you much.