20.11.2009, 18:18
Quote:
Originally Posted by Y_Leѕѕ
You need to check params is null, nothing else. sscanf will return a non null value if it fails (i.e. if they enter the wrong parameters).
|
pawn Code:
if (sscanf(params, "s", string)) SendClientMessage(playerid, COLOR_SOMETHING, "Usage: /command <string>");
So if the player types only for example "/safe" it will return message like "USAGE: /safe <option>" and if the player types "/safe put" it will return message "USAGE: /safe put <item>".
So this command in first post is written just fine?
And one more question... Can I use sscanf more that one time in one command?
Like if on second parameter there is one more parameter but only when I type "gun".
Example
Code:
/safe put gun gunid amount and /safe put drugs amount
pawn Code:
sscanf(params, "ss", option, item);
pawn Code:
sscanf(params, "is", gunid, amount);
pawn Code:
sscanf(params, "s", amount);
And if I can do that should this part be changed sscanf(params, ...) or it stays that way?