Problem with IsPlayerConnected - 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: Problem with IsPlayerConnected (
/showthread.php?tid=621870)
Problem with IsPlayerConnected -
TonyII - 16.11.2016
Hey,
I have a weird problem with IsPlayerConnected, everytime a playerid crashes from the server that ID becomes unusable. It keeps saying invalid player ID, I have a solution for it but I don't know if it's the right way or if it has consequences to it.
This is what I have originally
Код:
if(!IsPlayerConnected(playerb)) return SendClientMessage(playerid, COLOR_ORANGE, "** {AFAFAF}Invalid player ID.");
Tried this, doesn't work either.
Код:
if(playerb == INVALID_PLAYER_ID) return SendClientMessage(playerid, COLOR_ORANGE, "** {AFAFAF}Invalid player ID.");
It only worked when I changed the sscanf from this:
Код:
if(sscanf(params, "u", playerb))
//To
if(sscanf(params, "i", playerb))
I know that "u" is for player ID's but it doesn't work properly for me. My question is, is there another solution or can I keep doing that without any problems or consequences?
Re: Problem with IsPlayerConnected -
Vince - 16.11.2016
It can take up to a minute for the server to release the id of a crashed player. There's nothing you can do about that.