Show player ID

When I press certain button I want to display the id above the player heads, I have this piece of code but it is not working (not showing anything when button is pressed)

local showPlayerBlips = false
local ignorePlayerNameDistance = false
local playerNamesDist = 15
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(0, 243) then
            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
        elseif not IsControlPressed(0, 243) then
            DrawText3D(0, 0, 0, "")
        end
    end
end)

I also tried: [No longer Updating] [Re-Release] ID Over-head Version 1.1
But its not working. Am I doing something wrong?

If nobody helps you , i can give you my own working code when i get at home this evening, cheers.

Forogot to ask, do you want it for vrp ? as i got it to work for vrp.

I dont use VRP unforunately.

damn , maybe you can use smth from what i use

Client :

vRPN = {}
Tunnel.bindInterface("vrp_names",vRPN)

local players = {}
local names = {}
local permissions = {}

function vRPN.insertUser(user_id,source,name,permission)
    players[user_id] = GetPlayerFromServerId(source)
    names[user_id] = name
    permissions[user_id] = permission
end

function vRPN.removeUser(user_id)
    players[user_id] = nil
end

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

Citizen.CreateThread(function()
    while true do
	  Citizen.Wait(0)
       if IsControlPressed(1, 214) then
       for i=0,99 do N_0x31698aa80e0223f8(i)
        end

        for k,v in pairs(players) do
            local ped = GetPlayerPed(v)
            local ply = GetPlayerPed(-1)

			if ((ped ~= ply) or config.self) then
				local x1, y1, z1 = table.unpack(GetEntityCoords(ply, true))
				local x2, y2, z2 = table.unpack(GetEntityCoords(ped, true))
				local distance = math.floor(GetDistanceBetweenCoords(x1,  y1,  z1,  x2,  y2,  z2,  true))

				if ((distance < config.range)) and (not config.admin_only or permissions[k]) then
                    local text = ""
                    local r,g,b,a = config.colors.default.r,config.colors.default.g,config.colors.default.b,config.colors.default.a

					if NetworkIsPlayerTalking(v) and config.speaker then
                        z2 = z2+0.25
                        r,g,b,a = config.colors.speaker.r,config.colors.speaker.g,config.colors.speaker.b,config.colors.speaker.a
                        text = text .. config.lang[config.lang.default].speaking .. "\n"
                    end

                    if config.name then text = text .. names[k]
                    end

                    if config.id and not config.name then text = text .. k
                    elseif config.id then text = text .. ' (' .. k .. ')'
                    end

                    DrawText3D(x2, y2, z2+1, text, r,g,b,a)
				end  
			end
        end
		 elseif not IsControlPressed(1, 48) then
            DrawText3D(0, 0, 0, "")
        end
    end
end)

sv:


local Tunnel = module("vrp", "lib/Tunnel")
local Proxy = module("vrp", "lib/Proxy")

RSCclient = Tunnel.getInterface("vrp_names","vrp_names")
vRPclient = Tunnel.getInterface("vRP","vrp_names")
vRP = Proxy.getInterface("vRP")

local function update_name(player, user_id, source)
	vRP.getUserIdentity({user_id, function(identity)
		if identity ~= nil then
			RSCclient.insertUser(player,{user_id,source,identity.firstname .. ' ' .. identity.name,vRP.hasPermission({user_id, "player.group.add"})})
		end
	end})
end

AddEventHandler("vRP:playerSpawn", function(user_id, source, first_spawn) 
	local users = vRP.getUsers({})
	for k,v in pairs(users) do
		update_name(source,k,v)
		update_name(v,user_id,source)
	end
end)

AddEventHandler("vRP:playerLeave",function(user_id, source)
	local users = vRP.getUsers({})
	for k,v in pairs(users) do
		RSCclient.removeUser(v,{user_id})
	end
end)

Can u share the code to me DonDan?

Ever figure this topic out? im in need of a script that when you press a assigned key it shows id #'s of players above heads

DonDan can I have Esx instead of VRP?

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