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



Invalid Playerid - willsuckformoney - 30.09.2010

I never thought I ask this or even use this but

pawn Код:
!= INVALID_PLAYER_ID
That mean Player is NOT connected?


Re: Invalid Playerid - Las Venturas CNR - 30.09.2010

Compiles fine

But why simply not use IsPlayerConnected


Re: Invalid Playerid - Simon - 30.09.2010

No it doesn't. It's just checking if a variable is equal to INVALID_PLAYER_ID (a number), which is never connected because a player can never have that ID.

It does not mean a valid player ID is connected if it passes the check.

How it's interpreted or supposed to be interpreted is up to the function that provides it.


Re: Invalid Playerid - willsuckformoney - 30.09.2010

Well yeah, I just seen that piece a lot and I never found out what it meant. Does anyone know what it means?


Re: Invalid Playerid - Simon - 30.09.2010

It depends on the context it's used.

It's a number that is supposed to represent a player ID that players cannot have. This is why it's used in callbacks such as OnPlayerDeath, you know that there is no killer if the killerid is INVALID_PLAYER_ID because the SA:MP server is designed to do that so it's predictable. It's done like that so you know there's no killer associated with the event and it wouldn't get confused with all valid playerid's.

The meaning of a check like that can change from function to function.