12.09.2014, 15:23
Quote:
Use "s[10] " not "s[10]", otherwise sscanf will copy the whole of the input in to your "test" variable. Using only "s" in a specifier is completely wrong, and will be a warning in the future.
|
It work
PHP код:
CMD:test1(playerid,params[])
{
new test[10];
if(sscanf(params,"s[10] ",test)) return SCM(playerid,-1,"USE: /test1");
if(!strcmp(test,"drugs",true))
{
SCM(playerid,-1,"drugs");
return true;
}
else if(!strcmp(test,"mats",true))
{
new slot;
if(sscanf(params,"{s[10]}d",slot)) return SCM(playerid,-1,"USE: /test1 mats [1-5] 1");
if(!(1 <= slot <= 5)) return SCM(playerid,-1,"USE: /test1 mats [1-5] 2");
SCM(playerid,-1,"mats");
return true;
}
return true;
}