I’m trying to code closest person checking into a few commands such as /cuff but I can’t seem to get it to work, this is what i’ve got so far:
local x, y, z = GetEntityCoords(GetPlayerPed(source))
for i = 1,32 do
if i ~= source then
local otherPlayer = GetPlayerPed(i)
local mX, mY, mZ = GetEntityLocation(GetEntityCoords(otherPlayer))
local distance = GetDistanceBetweenCoords(x, y, z, mX, mY, mZ)
if distance <= 10 then
CODE HERE
end
end
end
Does anybody know what I’m doing wrong? This is made with EssentialsMode in mind.