01.05.2013, 09:58
Hello!
I know it has been asked before numerous times, spent some time on searching those old threads, but didn't have luck in finding one! Anyways, is there a way to fix so called "sscanf ID bug" where random ID's wouldn't get passed in some command's parameters? Example:
This command can't by executed on some ID's which differs from time to time (e.g. one time it can't be executed on id 0 or 1, the other time can't be executed on ID's 2 to 4)! What is the solution to this problem?
NOTE: All commands that are in my FS are "bugged" like this, but commands that are using sscanf and are in gamemode are working fine - could this be a problem or?
Thanks in advance!
Regards!
I know it has been asked before numerous times, spent some time on searching those old threads, but didn't have luck in finding one! Anyways, is there a way to fix so called "sscanf ID bug" where random ID's wouldn't get passed in some command's parameters? Example:
pawn Код:
COMMAND:setskin(playerid,params[])
{
if(PlayerAcc[playerid][AdminLevel] >= 2)
{
if(PlayerLogged[playerid] == 1)
{
new Target;
new Skinid;
if(!sscanf(params, "ui", Target, Skinid))
{
if(Target == INVALID_PLAYER_ID) return SendClientMessage(playerid,red,"ERROR: Wrong player ID");
if(Skinid > 299) return SendClientMessage(playerid,red,"ERROR: Skin IDґs from 0 to 299!");
new tname[MAX_PLAYER_NAME];
GetPlayerName(Target,tname,sizeof(tname));
new pname[MAX_PLAYER_NAME];
GetPlayerName(playerid,pname,sizeof(pname));
new tstring[256];
new pstring[256];
format(tstring,sizeof(tstring),"Your skin is set to %d by %s",Skinid,pname);
format(pstring,sizeof(pstring),"You have set %s's(%d) skin to %d",tname,Target,Skinid);
SendClientMessage(Target,COLOR_BLUE,tstring);
SendClientMessage(playerid,COLOR_BLUE,pstring);
SetPlayerSkin(Target,Skinid);
}
else SendClientMessage(playerid,COLOR_YELLOW,"USAGE: /setskin <playerid> <skinid>");
}
else SendClientMessage(playerid,red,"ERROR: You must be logged in to use this command!");
}
else SendClientMessage(playerid,red,"ERROR: You must be an Admin level 2 or higher to perform this command!");
return 1;
}
NOTE: All commands that are in my FS are "bugged" like this, but commands that are using sscanf and are in gamemode are working fine - could this be a problem or?
Thanks in advance!
Regards!