[Question] Difference between GetPlayerPed(-1) and PlayerPedId()

Hi. As title says I want to know what is the difference between these two, because I see that some people use the first one and the others the seconds one in same natives (for example TaskPlayAnim).

2 Likes

GetPlayerPed(-1) is an old habit from the older games like GTA IV and before, in V there’s PlayerPedId() which should be used and is also much faster.

image

Hence in newer games such as RDR3 (Red Dead Redemption 2) GetPlayerPed(-1) doesn’t even work anymore.

21 Likes

Hi!

Could you tell me the program or how to know the ms from the code?

Thanks

profiler in the console

How did you test this? Could you maybe post your code for both? Or is it just:

Citizen.CreateThread(function()
   local a = GetPlayerPedId(-1)
end)

and

Citizen.CreateThread(function()
   local a = PlayerPedId()
end)