Hi there, i made a litle modification from this script https://forum.cfx.re/t/release-changed-player-name-tags-distance-names/19204 it is workin but the id blink whet i get the player id from vRP.getUserId(source), so i would like to know if there is a way to create a buffer or somenting like that to avoid the blinking…
Also i believe the command only works with the id 1 of the server, not sure yet 'cause i’ve tested it in my friend server and only the id number 1 was able to toogle it on/off with /idon
Client script:
local Tunnel = module("vrp","lib/Tunnel")
local Proxy = module("vrp","lib/Proxy")
vRP = Proxy.getInterface("vRP")
iDON = Tunnel.getInterface("idonlyforadmin")
local showPlayerBlips = false
local ignorePlayerNameDistance = true
local playerNamesDist = 15
local displayIDHeight = 1.2 --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
local group = 0
RegisterNetEvent('setgroup')
AddEventHandler('setgroup', function()
if group == 0 then
group = true
TriggerEvent("Notify","Sucesso","Você ativou o id dos players.")
elseif group == true then
group = 0
TriggerEvent("Notify","Sucesso","Você desativou o id dos players.")
end
--local _id = iDON.getPlayerID()
--TriggerEvent("Notify", "sucesso", "_id: ".._id)
end)
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())*50
local scale = scale*fov
if onScreen then
SetTextScale(1*scale, 2*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 in ipairs(GetActivePlayers()) do
--for id = 0, 31 do
--if GetPlayerPed( id ) ~= GetPlayerPed( -1 ) then
ped = GetPlayerPed( id )
blip = GetBlipFromEntity( ped )
local _id = iDON.getPlayerID()
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 group == true then
red = 255
green = 255
blue = 255
DrawText3D(x2, y2, z2 + displayIDHeight, GetPlayerServerId(id))
--DrawText3D(x2, y2, z2 + displayIDHeight, tostring(_id))
end
end
if ((distance < playerNamesDist)) then
if not (ignorePlayerNameDistance) then
if group == true then
red = 255
green = 255
blue = 255
DrawText3D(x2, y2, z2 + displayIDHeight, GetPlayerServerId(id))
end
end
end
--end
end
Citizen.Wait(0)
end
end)
Server script:
local Tunnel = module("vrp","lib/Tunnel")
local Proxy = module("vrp","lib/Proxy")
vRP = Proxy.getInterface("vRP")
iDON = {}
Tunnel.bindInterface("idonlyforadmin",iDON)
RegisterCommand('idon', function(source, args)
local id = source
--if isAdmin(id) then
if vRP.hasPermission(id,"kick.permissao") then
TriggerClientEvent("setgroup", id)
end
end, false)
RegisterServerEvent('checkadmin')
AddEventHandler('checkadmin', function()
local id = source
--if isAdmin(id) then
if vRP.hasPermission(id,"kick.permissao") then
TriggerClientEvent("setgroup", source)
end
end)
function iDON.getPlayerID()
local source = source
local user_id = vRP.getUserId(source)
if user_id then
return user_id
else return nil
end
end
__resource:
resource_manifest_version '44febabe-d386-4d18-afbe-5e627f4af937'
dependency "vrp"
client_scripts{
"@vrp/lib/utils.lua",
"client.lua"
}
server_scripts {
"@vrp/lib/utils.lua",
"server.lua"
}
Thanks for any help and if i post i wrong place please forgive me i am new here and not sure if this is the right place for posting help topics, if it is in wrong session please don’t delete it, just move to correct place…
Sorry my bad english i am Brazilian and again thanks for any help…
Regards