SA-MP Forums Archive
ZCMD SubCommand - 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: ZCMD SubCommand (/showthread.php?tid=565778)



ZCMD SubCommand - Etolas - 01.03.2015

Hi,

Is it possible to do it but witch ZCMD ?

if(strcmp(cmd, "/give", true) == 0)
{
subcmd = strtok(cmdtext, idx);
if(PlayerInfo[playerid][pAdmin] < ADMIN2){return NotAdmin(playerid,cmd);}

if(!strlen(subcmd))
{
SendCmdModelMessage(playerid, "/give <Name>");
return 1;
}

if(strcmp(subcmd, "money", true) == 0)
{
return 1;
}
return 1;
}

And second question: Is ZCMD faster than dcmd ? Or faster than strcmp ?

Thanks.


Re: ZCMD SubCommand - HY - 01.03.2015

Yes, zcmd it's faster than dcmd and strcmp.
And yes, you can do it with zcmd.
Here's a quick example:

pawn Код:
CMD:test(playerid, params[])
{
    new subcmd[144];
    if(sscanf(params, "s[144], subcmd)) return SendClientMessage(playerid, -1, "USAGE: /test [Name]");
    if(strcmp(subcmd, "
money", true) == 0)
    {
        // Code.
    }
    return 1;
}



Re : ZCMD SubCommand - Etolas - 01.03.2015

Okay thanks !


Re : ZCMD SubCommand - Etolas - 01.03.2015

Sorry, for the double post but ...

For the subcmd sscanf, it's the same, can I put it ?

if(sscanf(params, "rs[32]i", giveplayerid, weapon, ammo))

Or have I to put it ?

if(sscanf(subcmd[lenght of subcmd], "rs[32]i", giveplayerid, weapon, ammo))

Or ?

if(sscanf(params, "s[32]rs[32]i",subcmd, giveplayerid, weapon, ammo))


Re: ZCMD SubCommand - ATGOggy - 01.03.2015

PHP код:
CMD:test(playeridparams[])
{
    new 
subcmd[32];
    if(
sscanf(params"s[32]"subcmd)) return SendClientMessage(playeridRED"Correct usage: /test [subcmd]");
    if(!
strcmp(subcmd"kick"true))
    {
         new 
idlol[5];
         if(
sscand(subcmd"s[5]i"lolid)) return SendClientMessage(playeridRED"Correct usage: /test kick [id]");
         
Kick(id);
    }

You can use it this way.