SA-MP Forums Archive
ZCMD & sscanf help - 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 & sscanf help (/showthread.php?tid=340486)



ZCMD & sscanf help - k3nw00d_kri5ty - 07.05.2012

Hi all, i have a big problem with a command where are random parameters, and i don't know how to convert to sscanf.
I have this: http://pastebin.com/Ft6GWtLz

So, in this command an parameter have another parameter (/mk reward [price]) and the simple parameter (/mk usecp), i don't have a idea how to convert to sscanf, i tryed but doesn't work ...

Please somebody can help me ?


Re: ZCMD & sscanf help - 2KY - 07.05.2012

You need to use strdel on the parameters.

pawn Код:
CMD:test( playerid, params[] )
{
    new
        user,
        action [ 24 ];
       
    if( sscanf( params, "s[24]", action ) )
        return SendClientMessage( playerid, -1, "Usage: /test [action]" );
       
    if( strcmp( action, "slap", true) == 0 )
    {
        strdel( params, 0, 4 );
       
        if( sscanf( params, "u", user ) )
            return SendClientMessage( playerid, -1, "Usage: /test slap [playerid]" );
           
        // They typed the params correct, /test slap 0 (for player ID zero)
    }
    return true;
}
Although I'm half asleep, this SHOULD work if I remember correctly.


Re: ZCMD & sscanf help - k3nw00d_kri5ty - 13.05.2012

Too hard for me ...