local drawDistance = 15
g_StreamedInPlayers = {}
function onClientRender()
local cx, cy, cz, lx, ly, lz = getCameraMatrix()
for k, player in pairs(g_StreamedInPlayers) do
if isElement(player) and isElementStreamedIn(player) then
do
local vx, vy, vz = getPedBonePosition(player, 4)
local dist = getDistanceBetweenPoints3D(cx, cy, cz, vx, vy, vz)
if dist < drawDistance and isLineOfSightClear(cx, cy, cz, vx, vy, vz, true, false, false) then
local x, y = getScreenFromWorldPosition(vx, vy, vz + 0.3)
if x and y then
local ID = getPlayerID(player)
local w = dxGetTextWidth(ID, 0.1, "default-bold")
local h = dxGetFontHeight(1, "default-bold")
dxDrawText("#ffffff"..ID.."", x - 1 - w / 1, y - 1 - h - 12, w, h, tocolor(0, 0, 0), 1.20, "default-bold", "left", "top", false, false, false, true, false)
end
end
end
else
table.remove(g_StreamedInPlayers, k)
end
end
end
addEventHandler("onClientRender", root, onClientRender)
function onClientElementStreamIn()
if getElementType(source) == "player" and source ~= getLocalPlayer() then
setPlayerNametagShowing(source, false)
table.insert(g_StreamedInPlayers, source)
end
end
addEventHandler("onClientElementStreamIn", root, onClientElementStreamIn)
function onClientResourceStart(startedResource)
visibleTick = getTickCount()
counter = 0
local players = getElementsByType("player")
for k, v in pairs(players) do
if isElementStreamedIn(v) and v ~= getLocalPlayer() then
setPlayerNametagShowing(v, false)
table.insert(g_StreamedInPlayers, v)
end
end
end
addEventHandler("onClientResourceStart", resourceRoot, onClientResourceStart)
function getPlayerFromID(ID)
return call(getResourceFromName("ID_System"), "getPlayerFromID", tonumber(ID))
end
function getPlayerID(player)
return getElementData(player,"ID")
end
Preciso muito de ajuda, irei abrir um servidor de Role-Play e fiz esse script de id, mas gostaria de saber se alguem poderia me ajudar, a duvida seria como deixar o id fixo, tipo quando alguem sair do servidor com exemplo ID 1, quando ela voltar esteja com o mesmo id. Alguem me ajuda?