This question is more intended to the Citizen team.
Hi,
Why the player’s ID is different on the client and on the server?
For example, when I use AddEventHandler on the server side, source is not equivalent to the PlayerId() on the client side.
On the client side:
- PlayerId () = 0
- GetPlayerServerId (PlayerId ()) = 1
Thanks
1 Like
the ID GetPlayerServerId() function returns is a player’s temporary ID as seen on the server.
the ID PlayerId() native returns is a player’s local id as the game sees it.
Why? GetPlayerServerId() is used for things such as kicking players, or sending them messages.
PlayerId() is left-over from Rockstar’s code.
3 Likes
Thank you for the answer.
Can you confirm that as long as the player is connected to the server, his server id does not change?
yes. the player id also won’t change unless the game fucks up heavily.
1 Like