ZCMD & sscanf help
#1

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 ?
Reply
#2

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.
Reply
#3

Too hard for me ...
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)