Get Player's Identifier by ID

Greetings All,

I am recently writing a function which gives other players your money with essential mode, but I have no idea how to get other player’s identifier with ID, could anyone help me or guide me? Thank you!

GetPlayerFromServerId()

This will return a usable Player entity if you pass a server ID to it.

Calling any server function from a client script will pass the “source PID”

TriggerServerEvent('somevent')

The respective server event that will trigger a client function on the client that triggered the server event:

AddEventHandler('somevent', function()
 TriggerClientEvent('anotherevent', source) -- We pass source, which is a PID
end)

Client script using the mentioned native above:

AddEventHandler('anotherevent', function(source)
  local ped = GetPlayerPed(GetPlayerFromServerId(source)) -- The remote player's ped!
end)
5 Likes

Thank you so so much! With your guide, I finally made my function work! Big big thx man!

How can i use this. i am new and want to know how to get identifier for players so i can unban them.

you don’t have to do this " local ped = GetPlayerPed(GetPlayerFromServerId(source)) "
but you can do this " local ped = PlayerPedId(PlayerId())