Two similar commands with ZCMD - 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: Two similar commands with ZCMD (
/showthread.php?tid=358774)
Two similar commands with ZCMD -
Urefeu - 11.07.2012
Hello !
I use ZCMD plugin for my commands.
I have for example this command :
PHP код:
CMD:skin(playerid, params[]) {
new skin;
if(sscanf(params, "i", skin) || skin < 0 || skin > 299) exception(playerid, ERROR_USE, "/skin <skinid [0-299]>");
else { SetPlayerSkin(playerid, skin); log(playerid, TYPE_COMMANDE_ADMIN, compressCommand("skin", params)); }
return 1;
}
To shorten, I would like the /s <skinid> commanddo the same thing as /skin <skinid>.
Have I any other solution than put the same code in the two commands or do a function that I call in the two commands ?
Thanks in advance and sorry for my probably bad english
Re: Two similar commands with ZCMD -
RedJohn - 11.07.2012
I'm sure VincentDunn will help!
Re: Two similar commands with ZCMD -
ReneG - 11.07.2012
pawn Код:
CMD:s(playerid, params) return cmd_skin(playerid, params[]);
CMD:skin(playerid, params[])
{
new skin = strval(params);
if(isnull(params) || skin > 299 || skin < 0) {
return exception(playerid, ERROR_USE, "/skin <skinid [0-299]>");
}
SetPlayerSkin(playerid, skin);
log(playerid, TYPE_COMMANDE_ADMIN, compressCommand("skin", params));
return 1;
}
Re: Two similar commands with ZCMD -
RedJohn - 11.07.2012
Quote:
Originally Posted by VincentDunn
pawn Код:
CMD:s(playerid, params) return cmd_skin(playerid, params[]); CMD:skin(playerid, params[]) { new skin = strval(params); if(isnull(params) || skin > 299 || skin < 0) { return exception(playerid, ERROR_USE, "/skin <skinid [0-299]>"); } SetPlayerSkin(playerid, skin); log(playerid, TYPE_COMMANDE_ADMIN, compressCommand("skin", params)); return 1; }
|
Man i didn't know that i can do this!
Re : Two similar commands with ZCMD -
Urefeu - 12.07.2012
Thank you!
You're just wrong, the correct code is this:
PHP код:
CMD:s(playerid, params[]) return cmd_skin(playerid, params); // Inattention ;D
CMD:skin(playerid, params[])
{
new skin = strval(params);
if(isnull(params) || skin > 299 || skin < 0) {
return exception(playerid, ERROR_USE, "/skin <skinid [0-299]>");
}
SetPlayerSkin(playerid, skin);
log(playerid, TYPE_COMMANDE_ADMIN, compressCommand("skin", params));
return 1;
}
it works, thank you