function nametags()
local rootx,rooty,rootz = getCameraMatrix()
for i,v in ipairs(getElementsByType("player"), root, true) do
if v ~= localPlayer and getElementAlpha(v) > 50 then
local x,y,z = getPedBonePosition(v, 8)
local sx,sy = getScreenFromWorldPosition(x, y, z+0.1)
if sx and sy then
local nick = ""..getPlayerName(v)..""
local distance = getDistanceBetweenPoints3D(rootx,rooty,rootz,x,y,z)
if distance <= 17 then
dxDrawText(nick, sx, sy, sx, sy, tocolor(255, 255, 255, 255), 1.7, "default", "center", "center")
end
end
end
end
end
addEventHandler("onClientRender", root, nametags)