you talking about the name that appears above his head? i believe thats the overhead name setting in your misc settings in your vmenu
Does it show your own ID ? Comes in handy with some things.
My own ID in orange and the players ID in white ?
need this also! cannot show my own id only shows others currently! works beautiful though
It does so my own id and the player next to me, but It shows both IDs above my head instead of my own ID above my head and the other player above his head. Any fixes ?
disPlayerNames = 5
playerDistances = {}
showIDsAboveHead = false
Citizen.CreateThread(function()
while true do
for id = 0, 255 do
if PlayerPedId(id) then
x1, y1, z1 = table.unpack(GetEntityCoords(PlayerPedId(), true))
x2, y2, z2 = table.unpack(GetEntityCoords(PlayerPedId(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 PlayerPedId(id) then
if (playerDistances[id] < disPlayerNames) then
x2, y2, z2 = table.unpack(GetEntityCoords(PlayerPedId(id), true))
if NetworkIsPlayerTalking(id) then
DrawText3D(x2, y2, z2+1, GetPlayerServerId(id), 255,255,255)
else
DrawText3D(x2, y2, z2+1, GetPlayerServerId(id), 247,124,24)
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
RegisterCommand('cityID', function()
showIDsAboveHead = not showIDsAboveHead
end, false)
RegisterKeyMapping('cityID', 'Check City IDs~', 'keyboard', 'Z')
Do you know if we can have the IDs toggleable on or off with a command?
This is confirmed to work with
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), 105,155,102)
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
2 Likes
Anyway to make a player hold down the keybind to see the player id’s and than when they stop holding down said keybind it doesn’t show anymore?