Player is not online bug
#1

i got bug sometimes when trying to watch player stats , or edit his xp i get error
"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"targetidgivexp)) 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(stringsizeof(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;

Reply
#2

maybe the player is isn't online
Reply
#3

he is online ..
Reply
#4

i dont know u did if(!IsPlayerConnected it should work
but any wahy try
this:
pawn Код:
if(IsPlayerConnected
Reply
#5

Try to use this
Код:
if(ID == INVALID_PLAYER_ID) return SendClientMessage(playerid, -1, "Player is not online!");
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)