Invalid Playerid
#1

I never thought I ask this or even use this but

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

Compiles fine

But why simply not use IsPlayerConnected
Reply
#3

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.
Reply
#4

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

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.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)