Quote:
Originally Posted by SilentHuntR
When the command only has 1 parameter, there's absolutely no need to use sscanf. Running sscanf is like running multiple conditionals based on the parameters given and the parameters requested.
For example, if you're looking for an integer, you would use something like this:
pawn Code:
//Command COMMAND:roll(playerid, params[]) { new value=strval(params);
if(value<=0) return SendClientMessage(playerid,0xFF0000FF,"You must put in a value between 1 and 99"); if(value>=100)return SendClientMessage(playerid,0xFF0000FF,"You must put in a value between 1 and 99");
new tmpstr[32];
GetPlayerName(playerid,tmpstr,24); format(tmpstr,32,"%s rolled a dice (1-%02d) - Dice landed on %d",tmpstr,value,random(value));
return SendClientMessageToAll(0xFFFF55FF,tmpstr); }
As you can see, performing only 2 conditionals is a lot faster than running sscanf, which has to do more work for the same affect.
|
Ummm i dont think so, sscanf is faster always, ask Y_Less.