SA-MP Forums Archive
Necessary for 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)
+---- Forum: Help Archive (https://sampforum.blast.hk/forumdisplay.php?fid=89)
+---- Thread: Necessary for IsPlayerConnected? (/showthread.php?tid=148417)



Necessary for IsPlayerConnected? - cAMo - 17.05.2010

I've noticed that many people use if(IsPlayerConnected(playerid) under many general callbacks.

Is that even necessary?

ie:
OnPlayerText
OnPlayerCommandText
...and others


Re: Necessary for IsPlayerConnected? - Sergei - 17.05.2010

Nah, that's retarded. GF does that checks and because whoever uses GF also do that. How the fuck can player trigger a callback if he/she isn't connected?


Re: Necessary for IsPlayerConnected? - Backwardsman97 - 17.05.2010

Quote:
Originally Posted by $ЂЯĢ
Nah, that's retarded. GF does that checks and because whoever uses GF also do that. How the fuck can player trigger a callback if he/she isn't connected?
Lol I know. It gets pretty annoying seeing that. There wouldn't be as many problems with people's script if they used some common sense and actually thought for a second.


Re: Necessary for IsPlayerConnected? - cAMo - 17.05.2010

Lol

When would you properly use it?


Re: Necessary for IsPlayerConnected? - Miguel - 17.05.2010

Simple checking:
pawn Code:
new
  id;

if(unformat(params, "r", id)) return ...;
else if(!IsPlayerConnected(id)) return SendClientMessage(playerid, COLOR, "The requested player is not connected..."); // HERE :D



Re: Necessary for IsPlayerConnected? - Sergei - 17.05.2010

@SAVC,
Code:
else if(if == INVLAID_PLAYER_ID)
This would be better way to check that since sscanf returns INVALID_PLAYER_ID if player isn't connected.