SA-MP Forums Archive
INVALID_PLAYER_ID and function IsPlayerConnected(playerid) - 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: INVALID_PLAYER_ID and function IsPlayerConnected(playerid) (/showthread.php?tid=422453)



INVALID_PLAYER_ID and function IsPlayerConnected(playerid) - Manowar - 13.03.2013

As the difference between INVALID_PLAYER_ID and function IsPlayerConnected(playerid) ?

How best to record
PHP код:
If(!IsPlayerConnected(killerid)) 
or
PHP код:
If(killerid != INVALID_PLAYER_ID



Re: INVALID_PLAYER_ID and function IsPlayerConnected(playerid) - rangerxxll - 13.03.2013

I usually do something like this.
pawn Код:
if(!IsPlayerConnected(killerid))
! = Not.


Re: INVALID_PLAYER_ID and function IsPlayerConnected(playerid) - Mystique - 13.03.2013

Doesn't really matter which one you use.


Re: INVALID_PLAYER_ID and function IsPlayerConnected(playerid) - MP2 - 13.03.2013

INVALID_KILLER_ID is better. IsPlayerConnected has to call the function, but the variable is already there for you to check.


Re: INVALID_PLAYER_ID and function IsPlayerConnected(playerid) - Manowar - 13.03.2013

Quote:
Originally Posted by rangerxxll
Посмотреть сообщение
I usually do something like this.
pawn Код:
if(!IsPlayerConnected(killerid))
! = Not.
I knew casually written, now corrected


Re: INVALID_PLAYER_ID and function IsPlayerConnected(playerid) - Jefff - 13.03.2013

For some reasons better is IsPlayerConnected (troll program for samp ;d) but you can use this

pawn Код:
if(0 <= killerid < MAX_PLAYERS)



Re: INVALID_PLAYER_ID and function IsPlayerConnected(playerid) - MP2 - 14.03.2013

thats the stopidest think ive ever herd


Re: INVALID_PLAYER_ID and function IsPlayerConnected(playerid) - GeekSiMo - 29.07.2014

OH YEAhh


Re: INVALID_PLAYER_ID and function IsPlayerConnected(playerid) - Beckett - 29.07.2014

Theres pretty much no difference between these two functions both means the same.


Re: INVALID_PLAYER_ID and function IsPlayerConnected(playerid) - Virtual1ty - 29.07.2014

Some people here really have no idea what they're saying...
As already mentioned, one is a function and the other is a constant expression.
Calling functions takes time to retrieve the result, but checking variables
is much much faster because you know in front exactly what to check for.