Get player near


Hello, I search in forum but I don’t find so I ask you here : I don’t understand how to get the closest player. I want to perform some actions only on a player only if he is near to me but I don’t find how. If you can help me :wink:




Maybe but I try GetNearestPlayerToEntity(GetPlayerPed(-1)) and it doesn’t work :cry:


I have seen scripts who just check the distance between your position and the player next to you.
(But it only works with /dostuff id commands I guess)


Try with GetClosestPed native function


I tried but without any documentation is very difficult :cry:


function GetClosestPed(x, y, z, radius, p4, p5, p7, p8, pedType)

Because I’m not sure you can use GetNearestPlayerToEntity for players