22.01.2011, 14:13
Hey guys, can someone tell me why this command doesn't work perfectly
It does work with setting the stats. But it's like when I only type this: /setstat
it says:
You have setted NAME his money to 0
WIthout I even filled in an ID or amount
Please help
It does work with setting the stats. But it's like when I only type this: /setstat
it says:
You have setted NAME his money to 0
WIthout I even filled in an ID or amount
Please help
pawn Код:
COMMAND:setstat(playerid,params[])
{
new stat[20],id,value,string[286];
if(adminlevel[playerid] <1) return SendClientMessage(playerid,COLOR_RED,"You're not allowed to do this");
if(sscanf(params,"usd",id,stat,value)) SendClientMessage(playerid, COLOR_RED, "HINT: /setstat [playerid] [stat] [amount]");
if(!IsPlayerConnected(id)) return SendClientMessage(playerid,COLOR_RED,"Player not connected");
else
if(!strcmp(stat,"money",true))
{
money[id] = value;
format(string,sizeof(string),"Your money has been setted to %d by Admin %s",value,playername[playerid]);
SendClientMessage(id,COLOR_YELLOW,string);
format(string,sizeof(string),"You've setted %s's money to %d",playername[id],value);
SendClientMessage(id,COLOR_YELLOW,string);
}
else
if(!strcmp(stat,"age",true))
{
age[id] = value;
format(string,sizeof(string),"Your age has been setted to %d by Admin %s",value,playername[playerid]);
SendClientMessage(id,COLOR_YELLOW,string);
format(string,sizeof(string),"You've setted %s's age to %d",playername[id],value);
SendClientMessage(id,COLOR_YELLOW,string);
}
else
if(!strcmp(stat,"fishes",true))
{
fishes[id] = value;
format(string,sizeof(string),"Your fishes has been setted to %d by Admin %s",value,playername[playerid]);
SendClientMessage(id,COLOR_YELLOW,string);
format(string,sizeof(string),"You've setted %s's fishes to %d",playername[id],value);
SendClientMessage(id,COLOR_YELLOW,string);
}
else
SendClientMessage(playerid,COLOR_RED,"Invalid choice");
return 1;
}