Player isn't connected problem
#1

I use this under the commands
Code:
if(ID == INVALID_PLAYER_ID)
	{
	    format(string,sizeof(string),"{808080}[SERVER]{FFFFFF} The Player ID (%d) is not connected to the server.",ID);
	    SendClientMessage(playerid,COLOR_WHITE,string);
	    return 1;
	}
But with some IDs[Most IDs] it keeps say this while the players are connected.
Reply
#2

I really need this urgently so sorry for bumping.
Reply
#3

try using it like this:
PHP Code:
if(!IsPlayerConnected(ID))
    {
        
format(string,sizeof(string),"{808080}[SERVER]{FFFFFF} The Player ID (%d) is not connected to the server.",ID);
        
SendClientMessage(playerid,COLOR_WHITE,string);
        return 
1;
    } 
Reply
#4

I think there is a problem in such a plugin maybe?
Reply
#5

I experienced this once few years back, found out it was caused by the outdated sscanf include/plugin. If you aren't using the latest version, try updating it, maybe?
Reply
#6

I updated to this but still also sometimes there are problems with IDs that says they aren't connected
Reply
#7

Did you introduce something new into your gamemode recently? Or did you load a new fs?
Reply
#8

Did you try what Dusan01 said?

INVALID_PLAYER_ID = 65535

Even if ID 5 (for example) isn't online, 5 will never be equal to 65535.
Reply
#9

Quote:
Originally Posted by Stinged
View Post
Did you try what Dusan01 said?

INVALID_PLAYER_ID = 65535

Even if ID 5 (for example) isn't online, 5 will never be equal to 65535.
Is that after a new update or something? Cause it used to work before
Reply
#10

Which specifier are you using (u, r, i..)

I just tested the "u" and "r" specifier, and it seems that they set the variable value as INVALID_PLAYER_ID if the ID isn't connected.
But if you're using the "i" specifier, then it won't return the value as 65535.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)