10.10.2010, 14:38
So i made a command with zcmd.
In zcmd i`m using sscanf which checks string.
after that command is checking if there is name/word - for example "putin"
After that - in putin command i need another param, well made that with sscanf again.
everything works perfect till i write in game a command.
/command putin 3 - but it wont work, after that it shows invalid fuction / unknown name which we done at first check with sscanf.
but writing
/command putin - with out param it succesuffly checks if there is parameter and shows message which needed.
so question is that, how to make param working.
full code how it ~ looks.
So what i need to do? with strtok or what?
In zcmd i`m using sscanf which checks string.
pawn Код:
if(sscanf(params, "s[20]", name))
pawn Код:
if(strcmp(name,"putin",true) == 0)
pawn Код:
if(sscanf(params, "d", slot))
/command putin 3 - but it wont work, after that it shows invalid fuction / unknown name which we done at first check with sscanf.
but writing
/command putin - with out param it succesuffly checks if there is parameter and shows message which needed.
so question is that, how to make param working.
full code how it ~ looks.
pawn Код:
COMMAND:command(playerid, params[])
{
if(sscanf(params, "s[20]", name)) return // blablablalalala
if(strcmp(name,"putin",true) == 0)
{
if(sscanf(params, "d", slot)) return // if there is no param written (IG) then it successfully messages it.
// code after this wont work.
}
else // this is showing when player writes param for putin.
}