SA-MP Forums Archive
Player isn't connected problem - Printable Version

+- SA-MP Forums Archive (https://sampforum.blast.hk)
+-- Forum: SA-MP Scripting and Plugins (https://sampforum.blast.hk/forumdisplay.php?fid=8)
+--- Forum: Scripting Help (https://sampforum.blast.hk/forumdisplay.php?fid=12)
+--- Thread: Player isn't connected problem (/showthread.php?tid=611579)



Player isn't connected problem - Problems - 08.07.2016

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.


Re: Player isn't connected problem - Problems - 08.07.2016

I really need this urgently so sorry for bumping.


Re: Player isn't connected problem - Dusan01 - 08.07.2016

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;
    } 



Re: Player isn't connected problem - Problems - 08.07.2016

I think there is a problem in such a plugin maybe?


Re: Player isn't connected problem - Sjn - 08.07.2016

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?


Re: Player isn't connected problem - Problems - 08.07.2016

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


Re: Player isn't connected problem - ReshiramZekrom - 08.07.2016

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


Re: Player isn't connected problem - Stinged - 08.07.2016

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.


Re: Player isn't connected problem - Problems - 08.07.2016

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


Re: Player isn't connected problem - Stinged - 08.07.2016

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.