an example for zcmd sub cmds. - 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: an example for zcmd sub cmds. (
/showthread.php?tid=600109)
an example for zcmd sub cmds. -
fuckingcruse - 04.02.2016
Ok I have tried alot making a cmd from zcmd that includes sub commands. Can anyone give me a little example?
Like , /heal <health/armour>
If /heal health then he gets 100 hp. If /heal armour he gets 100 armour.
Give me an example of you own I may make the command by myself. Please take time, thank you.
Re: an example for zcmd sub cmds. -
SickAttack - 04.02.2016
pawn Код:
CMD:cmd(playerid, params[])
{
if(isnull(params)) return // message here
if(!strcmp(params, "health", true, 6))
{
new id;
if(sscanf(params, "{s[128]}u", id)) return // message here
// set health here, id
}
return 1;
}
Find the macro "isnull" somewhere.
Re: an example for zcmd sub cmds. -
Gammix - 04.02.2016
Just fix this mistake done in the above code:
Код:
if(! strcmp(params, "health", true, 6))
Re: an example for zcmd sub cmds. -
xTURBOx - 04.02.2016
dont mind the intention
PHP код:
CMD:heal(playerid,params[])
{
if(!strlen(params)) return SendClientMessage(playerid, -1, "usage: /heal [health/armour]"); // or isnull(params)
if(! strcmp(params, "health", true, 6))
{
SetPlayerHealth(playerid,100.0);
}
else if(! strcmp(params, "armour", true, 6)
{
setplayerarmour(playerid,100.0);
}
return 1;
}
Re: an example for zcmd sub cmds. -
fuckingcruse - 04.02.2016
I will try each and every code of yours

thanks.
Re: an example for zcmd sub cmds. -
Rufio - 04.02.2016
Quote:
Originally Posted by Gammix
Just fix this mistake done in the above code:
Код:
if(! strcmp(params, "health", true, 6))
|
Quote:
0 if strings match each other on given length;
1 o r -1 if some character do not match: string1[i] - string2[i] ('i' represents character index starting from 0);
|
No. His code is right.
Edit: Actually nevermind, seems like it was edited. Sorry.