[ Help ] Spaces in Commands - Printable Version
+- SA-MP Forums Archive (
https://sampforum.blast.hk)
+-- Forum: SA-MP Scripting and Plugins (
https://sampforum.blast.hk/forumdisplay.php?fid=8)
+--- Forum: Scripting Help (
https://sampforum.blast.hk/forumdisplay.php?fid=12)
+--- Thread: [ Help ] Spaces in Commands (
/showthread.php?tid=441736)
[ Help ] Spaces in Commands -
xXRealLegitXx - 04.06.2013
Hello! I am making a small, one command, test server and I would like to know how to create a space in a command. I use ZCMD to make my commands. However, I tried to input an option but whenever I do /starttest trucker, it loads the command for first option on the list. I didn't feel like coding the command yet, as it is a really long one. So I just made sure that my options work.
Код:
CMD:starttest(playerid, params[])
{
new option[20];
if(isnull(params))
{
return SendClientMessage(playerid, -1, "USAGE: /starttest [standard/trucker]");
}
if(!strcmp(option, "standard", true))
{
SendClientMessage(playerid, COLOR_WHITE, "Yes, standard works.");
return 1;
}
if(!strcmp(option, "trucker", true))
{
SendClientMessage(playerid, COLOR_WHITE, "Yes, trucker works.");
return 1;
}
return 1;
}
Whenever I type in anything, it will give me the first option's return.
/starttest askghasdofhds = "Yes, standard works."
/starttest trucker = "Yes, standard works."
This shouldn't happen. I would like to know, how to fix this.
Re: [ Help ] Spaces in Commands -
Kirollos - 04.06.2013
no need for "option" just replace em' with params and it should work fine
Re: [ Help ] Spaces in Commands -
xXRealLegitXx - 04.06.2013
Quote:
Originally Posted by kirollos
no need for "option" just replace em' with params and it should work fine
|
Could you give an example? ( I am noob at scripting )
Re: [ Help ] Spaces in Commands -
Kirollos - 04.06.2013
pawn Код:
CMD:starttest(playerid, params[])
{
if(isnull(params))
{
return SendClientMessage(playerid, -1, "USAGE: /starttest [standard/trucker]");
}
if(!strcmp(params, "standard", true))
{
SendClientMessage(playerid, COLOR_WHITE, "Yes, standard works.");
return 1;
}
if(!strcmp(params, "trucker", true))
{
SendClientMessage(playerid, COLOR_WHITE, "Yes, trucker works.");
return 1;
}
return 1;
}
Re: [ Help ] Spaces in Commands -
xXRealLegitXx - 04.06.2013
Quote:
Originally Posted by kirollos
pawn Код:
CMD:starttest(playerid, params[]) { if(isnull(params)) { return SendClientMessage(playerid, -1, "USAGE: /starttest [standard/trucker]"); } if(!strcmp(params, "standard", true)) { SendClientMessage(playerid, COLOR_WHITE, "Yes, standard works."); return 1; } if(!strcmp(params, "trucker", true)) { SendClientMessage(playerid, COLOR_WHITE, "Yes, trucker works."); return 1; } return 1; }
|
It worked! Thank you!