qual que ta certo?
local drawDistance = 7
g_StreamedInPlayers = {}
function toggleInvisibility(thePlayer)
if isObjectInACLGroup ( "user." ..getAccountName(getPlayerAccount(thePlayer)), aclGetGroup ("Staff01")) then
local enabled = getElementData(thePlayer, "invisible")
if (enabled == true) then
setElementAlpha(thePlayer, 0)
setElementData(thePlayer, "reconx", false)
outputChatBox (" -> Você desativou a invisibilidade", thePlayer)
setElementData(thePlayer, "invisible", false)
elseif (enabled == false or enabled == nil) then
setElementAlpha(thePlayer, 0)
setElementData(thePlayer, "reconx", true)
outputChatBox (" -> Você ativou a invisibilidade", thePlayer)
setElementData(thePlayer, "invisible", true)
else
end
outputChatBox ("Acesso negado", thePlayer)
else
end
end
addCommandHandler("invi", toggleInvisibility)
2-
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
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
if getElementAlpha(player) > 0 then
local ID = getElementData(player, "ID") or "N/A"
local w = dxGetTextWidth(ID, 0.1, "default-bold")
local h = dxGetFontHeight(1, "default-bold")
dxDrawText(""..ID.."", x - 1 - w / 1, y - 1 - h - 12, w, h, CorTag, 1.20, "default-bold", "left", "top", false, false, false, false, false)
CorTag = tocolor(255, 255, 255)
if getElementData(player, "Cor", true) then
CorTag = tocolor(0, 255, 0)
end
end
end
end
end
table.remove(g_StreamedInPlayers, k)
end
end
addEventHandler("onClientRender", root, onClientRender)
addCommandHandler("invv", toggleInvisibility)
addCommandHandler("inv", toggleInvisibility)