ID over head, help!

Hey! I tried this script and it works great, but if you are like 500 meters from another player you still see the ID, is there anyway I can do to hide it when I am like 10-15 meters away from another player before I see it?

I know it works beacuse I playing on a roleplay server that has it like that.
So please help me with this, or is it another script I need, cant find, have been looking everywhere :frowning:

Thank you for help!

local showPlayerBlips = false
local ignorePlayerNameDistance = true
local playerNamesDist = 10
local displayIDHeight = 1.5 --Height of ID above players head(starts at center body mass)
--Set Default Values for Colors
local red = 255
local green = 255
local blue = 255
 
function DrawText3D(x,y,z, text)
    local onScreen,_x,_y=World3dToScreen2d(x,y,z)
    local px,py,pz=table.unpack(GetGameplayCamCoords())
    local dist = GetDistanceBetweenCoords(px,py,pz, x,y,z, 1)
 
    local scale = (1/dist)*2
    local fov = (1/GetGameplayCamFov())*100
    local scale = scale*fov
   
    if onScreen then
        SetTextScale(0.0*scale, 0.55*scale)
        SetTextFont(0)
        SetTextProportional(1)
        SetTextColour(red, green, blue, 255)
        SetTextDropshadow(0, 0, 0, 0, 255)
        SetTextEdge(2, 0, 0, 0, 150)
        SetTextDropShadow()
        SetTextOutline()
        SetTextEntry("STRING")
        SetTextCentre(1)
        AddTextComponentString(text)
        World3dToScreen2d(x,y,z, 0) --Added Here
        DrawText(_x,_y)
    end
end
 
Citizen.CreateThread(function()
    while true do
        for i=0,99 do
            N_0x31698aa80e0223f8(i)
        end
        for id = 0, 31 do
            if  ((NetworkIsPlayerActive( id )) and GetPlayerPed( id ) ~= GetPlayerPed( -1 )) then
                ped = GetPlayerPed( id )
                blip = GetBlipFromEntity( ped )
 
                x1, y1, z1 = table.unpack( GetEntityCoords( GetPlayerPed( -1 ), true ) )
                x2, y2, z2 = table.unpack( GetEntityCoords( GetPlayerPed( id ), true ) )
                distance = math.floor(GetDistanceBetweenCoords(x1,  y1,  z1,  x2,  y2,  z2,  true))
 
                if(ignorePlayerNameDistance) then
                    if NetworkIsPlayerTalking(id) then
                        red = 0
                        green = 0
                        blue = 255
                        DrawText3D(x2, y2, z2 + displayIDHeight, GetPlayerServerId(id))
                    else
                        red = 255
                        green = 255
                        blue = 255
                        DrawText3D(x2, y2, z2 + displayIDHeight, GetPlayerServerId(id))
                    end
                end
 
                if ((distance < playerNamesDist)) then
                    if not (ignorePlayerNameDistance) then
                        if NetworkIsPlayerTalking(id) then
                            red = 0
                            green = 0
                            blue = 255
                            DrawText3D(x2, y2, z2 + displayIDHeight, GetPlayerServerId(id))
                        else
                            red = 255
                            green = 255
                            blue = 255
                            DrawText3D(x2, y2, z2 + displayIDHeight, GetPlayerServerId(id))
                        end
                    end
                end  
            end
        end
        Citizen.Wait(0)
    end
end)

local ignorePlayerNameDistance = false

tried but didnt work, or well it did but dont want name. but found another script thats working perfect :slight_smile: thx anyway

If anyone does need a script he is talking about, its a great plugin for admin, players and for roleplay :smile:

Thank you, will look it up :slight_smile: