Blockland Forums > Modification Help
serverCmd with spaces?
<< < (2/3) > >>
Ipquarx:

--- Code: ---function serverCmdhelp(%client, %text)
{
if(!%text $= "")
{
if(strLwr(getWord(%text, 0)) $= "help")
{
if(strLwr(getWord(%text, 1)) $= "jobs")
{
messageClient(%client, '', "\c6Jobs List:
for(%a = 0; %a < $JobCount; %a++)
{
messageClient(%client, '', $JobName[%a] SPC $JobPay[%a] SPC $JobRequirement1[%a] SPC $JobRequirement2[%a] @ ".");
}
messageClient(%client, '', "\c6Page Up to see the full list of jobs.");
}
else
messageClient(%client, '', "\c6That sub-section does not exist!");
}
else
messageClient(%client, '', "\c6Please enter a valid section to view!");
}
else
messageClient(%client, '', "\c6Please enter something!");
}
--- End code ---
There you go.

It uses only one argument variable, thanks to the help of getWord. Using this, you can make any number of arguments you want while only using one variable. it saves variables.
Placid:

--- Quote from: Ipquarx on June 12, 2011, 06:07:04 PM ---snip

--- End quote ---
error line 9: you forgot ");
lol

but yeah other than that it should work.
otto-san:
Also, I'd use a switch instead of a huge if statement.
Destiny/Zack0Wack0:

--- Quote from: Ipquarx on June 12, 2011, 06:07:04 PM ---There you go.

It uses only one argument variable, thanks to the help of getWord. Using this, you can make any number of arguments you want while only using one variable. it saves variables.

--- End quote ---
That won't even work, spaces in slash commands are automatically used as new arguments.
otto-san:

--- Quote from: Destiny/Zack0Wack0 on June 13, 2011, 01:00:52 AM ---That won't even work, spaces in slash commands are automatically used as new arguments.

--- End quote ---
That's right, isn't it?
Navigation
Message Index
Next page
Previous page

Go to full version