[Release] Optimized player IDs above head

That didn’t seem to work. :confused:

I’m having a problem. the IDS they are showing is not corrects. How i fix it?

Updated, fixed for (128 slot) OneSync. Please update to the latest.

@Robbster would be great to have a hotkey to toggle it on and off :smiley: i know some else also made this comment but i just wanted to put it out there again :stuck_out_tongue:

1 Like

@Dayzer
@poloniumtacos
@SXE_Razgriz

Here you guys go, wrote this up quickly haven’t tested but should work, Left Alt key to toggle showing IDs, is off by default

disPlayerNames = 5 --distance you see IDs at 
keyToToggleIDs = 19 --left alt by default

playerDistances = {}
showIDsAboveHead = false

Citizen.CreateThread(function()
    while true do 
        if IsControlJustPressed(0, keyToToggleIDs) then
            showIDsAboveHead = not showIDsAboveHead
			print("changed")
            Wait(50)
        end
        Wait(0)
    end
end)

Citizen.CreateThread(function()
    while true do
        for id = 0, 255 do
            if GetPlayerPed(id) ~= GetPlayerPed(-1) then
                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))
                playerDistances[id] = distance
            end
        end
        Citizen.Wait(1000)
    end
end)




Citizen.CreateThread(function()
    while true do
        if showIDsAboveHead then
            for id = 0, 255 do 
                if NetworkIsPlayerActive(id) then
                    if GetPlayerPed(id) ~= GetPlayerPed(-1) then
                        if (playerDistances[id] < disPlayerNames) then
                            x2, y2, z2 = table.unpack(GetEntityCoords(GetPlayerPed(id), true))
                            if NetworkIsPlayerTalking(id) then
                                DrawText3D(x2, y2, z2+1, GetPlayerServerId(id), 247,124,24)
                            else
                                DrawText3D(x2, y2, z2+1, GetPlayerServerId(id), 255,255,255)
                            end
                        end  
                    end
                end
            end
        end
        Citizen.Wait(0)
    end
end)


function DrawText3D(x,y,z, text, r,g,b) 
    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(r, g, b, 255)
        SetTextDropshadow(0, 0, 0, 0, 255)
        SetTextEdge(2, 0, 0, 0, 150)
        SetTextDropShadow()
        SetTextOutline()
        SetTextEntry("STRING")
        SetTextCentre(1)
        AddTextComponentString(text)
        DrawText(_x,_y)
    end
end
6 Likes

Does not work for me

Fixed now

Still not working :’(
It doesn’t even mark the “changed” in the console.

1 Like

Working fine for me, try changing the key as a script of yours may be disabling alt

1 Like

Thnx man going to check it out as soon as I get home :grin::grin::grin:

just got home and it works like a charm :smiley: tyvm man

I change for ur script, but appers this point all time, U know where is her in resources?

SOLVED: in es_extended

Hey bro! How did you remove the point of the head? Me have this problem

im getting this error in f8 cl_idsabovehead.lua:11: attempt to compare nil with number stack traceback:
@IDsAboveHead/cl_idsabovehead.lua:11: in function <@IDsAbove
Head/cl_idsabovehead.lua:6>
Any fixes?
It was working perfect like 5 days. I did nothing to the files. It stopped working random. I didn’t do restart.

@Robbster

Very nice release, i am still a noob in development but i was trying to fix that for 2 weeks now!
Do you know, or can you make it so you can use it only for admin? Theres only one resource out there that does this (idonlyforadmin from my friend cheleber), but i have it unoptimized …

how to make this on a command? like /toggleid or /idon /idoff

If you want to it to toggle on command, look up a few posts and see my toggle on key version, replace this bit of code:

Citizen.CreateThread(function()
    while true do 
        if IsControlJustPressed(0, keyToToggleIDs) then
            showIDsAboveHead = not showIDsAboveHead
			print("changed")
            Wait(50)
        end
        Wait(0)
    end
end)

With this

RegisterCommand("toggleid",function()
     showIDsAboveHead = not showIDsAboveHead
end)

(Untested but should work)

2 Likes

@Nojus_Petrauskas
Make sure you are updated to the latest version? I’m not getting this error and running the latest server artifact.

@ryu2kk
I mean it depends if you use a framework, easier if you use a framework. See how the framework you use checks whitelists and just copy that code. Otherwise if you wanted to do it with a standalone version, you’d use a check of GET_PLAYER_IDENTIFIER and set the correct one as yours.

im going to try it

i cant find the code u say, can u paste the url to the post?

@LIL_QK