Push to show id over head

Is there is a script that show id over head when you click a bottom? like when i click a key it will show the players id, i’m using this script. If someone could help to make this script push to show if there is no scripts that have push to show id over head.

1 Like

So what I did for another server was a toggle for showing the id’s
I made an event TriggerEvent('idabovehead:enable') (which was called in the scoreboard resource)

You can either do two things:

  • Just use if IsControlJustReleased(0, {KEY}) then in front of the foreach

  • Create a boolean which can toggle it on and of, example:

local IsEnabled = false

RegisterNetEvent('idabovehead:toggle')
AddEventHandler('idabovehead:toggle', function()
    IsEnabled = not IsEnabled
end)

-- change the foreach
Citizen.CreateThread(function()
    while true do
       if IsEnabled then
        for id = 0, 64 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)

And you can just trigger the event to toggle it.
Hope it was helpfull

3 Likes

I’m at work rn, will try it when i get back home, thanks for help :slight_smile:

hey can you help me how can i use this codes!? can you send me any .zip .rar files!?

Hi!

Where i should put this script?

how to make hold button not toggle

1 Like

Just replace the IsControlJustReleased with IsControlPressed(0,x)

1 Like
local showPlayerBlips = false
local ignorePlayerNameDistance = false
local playerNamesDist = 7
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
        Citizen.Wait(0)
        if IsControlPressed(1, 168) then
            for i=0,99 do
                N_0x31698aa80e0223f8(i)
            end
            for id = 0, 255 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
        elseif not IsControlPressed(1, 168) then
            DrawText3D(0, 0, 0, "")
        end
    end
end)
5 Likes

how can he not show the ids of players nearby who are behind walls and cover?

1 Like

any one have a zip with this? because I dont know were to add that comand lines

Hello. I have a problem. I have a vrp server. I raised the number of players above 128 players and the id disappeared. I want a script to solve this problem.

It most likely doesn’t loop through all the players - send the script into #server-development:resource-support as its own topic and explain the issue so someone can help.

best bet may be to decrease the general range of which they will show