23.11.2014, 14:17
i got bug sometimes when trying to watch player stats , or edit his xp i get error
"player is not online"
my code:
"player is not online"
my code:
PHP код:
CMD:setxp(playerid,params[])
{
if(pInfo[playerid][pLogged] == 1)
{
if(pInfo[playerid][pAdminLevel] >= 10)
{
new targetid,givexp,string[256];
if(sscanf(params, "ui", targetid, givexp)) return SendClientMessage(playerid,-1,""chat" /setxp [playerid] [amount]");
if(!IsPlayerConnected(targetid)) return SendClientMessage(playerid,-1,""chat" Player is not online");
pInfo[targetid][pXP] = givexp;
format(string, sizeof(string), ""chat""COL_LIGHTBLUE" %s %s has set %s xp to %d",GetAdminName(playerid),PlayerName(playerid),PlayerName(targetid),givexp);
SendClientMessageToAll(-1,string);
}
else {
SendClientMessage(playerid,-1,""chat""COL_LIGHTBLUE" You do not have the right admin permissions for this command!");
}
}
else if(pInfo[playerid][pLogged] == 0)
{
SendClientMessage(playerid,-1,""chat""COL_LIGHTBLUE" You Must be Logged in");
printf("%s has been kicked for trying to use a command without being logged in!", PlayerName(playerid));
Kick(playerid);
}
return 1;
}