White141516 Posted November 5, 2020 Share Posted November 5, 2020 ID_System: function Start_Id ( _, acc ) if eventName == "onPlayerLogin" then setElementData ( source, "ID", getAccountID(acc) or "N/A" ) outputChatBox ( "#00ff00✘ #ffffffLOGIN #00ff00✘➺ #ffffffNick: #00ff00 ( ".. getPlayerName(source) .." #00ff00) #ffffffID: #00ff00( "..(getAccountID(acc) or "N/A") .." )", root, 255,255,255,true) elseif eventName == "onPlayerLogout" then removeElementData( source, "ID" ) outputChatBox ( "#00ff00✘ #ffffffLOGIN #00ff00✘➺ #ffffffNick: #00ff00 ( ".. getPlayerName(source) .." #00ff00) #ffffffDeslogou.", root, 255,255,255,true) elseif eventName == "onResourceStart" then for _, player in pairs(getElementsByType("player")) do local acc = getPlayerAccount(player) if not isGuestAccount(acc) then setElementData( source, "ID", getAccountID(acc) or "N/A" ) end end end end addEventHandler("onResourceStart", resourceRoot, Start_Id) addEventHandler("onPlayerLogout", root, Start_Id) addEventHandler("onPlayerLogin", root, Start_Id) function getPlayerID(id) v = false for i, player in ipairs (getElementsByType("player")) do if getElementData(player, "ID") == id then v = player break end end return v end --============================================================================================================================-- --=============================-- ----------- ID PLAYER ------------ --=============================-- function getnick(player, command, id, ...) if(id) then local playerID = tonumber(id) if(playerID) then local Player2 = getPlayerID(playerID) if(Player2) then outputChatBox ( "#00ff00✘ #ffffffINFO #00ff00✘➺ #ffffff Nome do Jogador #00ff00" .. getPlayerName(Player2) .."", player, 255,255,255,true) else outputChatBox ( "#00ff00✘ #ffffffERRO #00ff00✘➺ #ffffff O Jogador(a) de ID: #00ff00( " .. id .. " ) #ffffffNão Foi Encontrado!", player, 255,255,255,true) end else outputChatBox ( "#00ff00✘ #ffffffERRO #00ff00✘➺ #ffffff ID: #00ff00( " .. id .. " ) #ffffffInválido!", player, 255,255,255,true) end else outputChatBox ( "#00ff00✘ #ffffffERRO #00ff00✘➺ #ffffffUse /id #00ff00[#ffffffID#00ff00]", player, 255,255,255,true) end end addCommandHandler("id", getnick) Tag_ID: local drawDistance = 7 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 = 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 else table.remove(g_StreamedInPlayers, k) end end end addEventHandler("onClientRender", root, onClientRender) function CorTagid () if getElementData(localPlayer, "Cor", true) then setElementData(localPlayer, "Cor", false) else setElementData(localPlayer, "Cor", true) end end bindKey ( "z", "both", CorTagid ) 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) Join Quit Server: function Start_Id ( _, acc ) if eventName == "onPlayerLogin" then setElementData ( source, "ID", getAccountID(acc) or "N/A" ) outputChatBox ( "#00ff00✘ #ffffffLOGIN #00ff00✘➺ #ffffffNick: #00ff00 ( ".. getPlayerName(source) .." #00ff00) #ffffffID: #00ff00( "..(getAccountID(acc) or "N/A") .." )", root, 255,255,255,true) elseif eventName == "onPlayerLogout" then removeElementData( source, "ID" ) outputChatBox ( "#00ff00✘ #ffffffLOGIN #00ff00✘➺ #ffffffNick: #00ff00 ( ".. getPlayerName(source) .." #00ff00) #ffffffDeslogou.", root, 255,255,255,true) elseif eventName == "onResourceStart" then for _, player in pairs(getElementsByType("player")) do local acc = getPlayerAccount(player) if not isGuestAccount(acc) then setElementData( source, "ID", getAccountID(acc) or "N/A" ) end end end end addEventHandler("onResourceStart", resourceRoot, Start_Id) addEventHandler("onPlayerLogout", root, Start_Id) addEventHandler("onPlayerLogin", root, Start_Id) function getPlayerID(id) v = false for i, player in ipairs (getElementsByType("player")) do if getElementData(player, "ID") == id then v = player break end end return v end local ID = getElementData(player, "ID") or "N/A" function outputJoinquitMessage(player, msg, r, g, b, pos, time) triggerClientEvent(player, "sendServerMessage", player, msg, r, g, b, pos, time) end addEventHandler("onPlayerLogin", root, function() outputJoinquitMessage(root, "#ff0000"..getPlayerName(source).." #FFFFFFAcabou de Logar-se.", 30, 144, 255, false, 5) end) addEventHandler('onPlayerQuit', root, function(quitType) outputJoinquitMessage(root, "#ff0000"..getPlayerName(source).." #FFFFFFSaiu da cidade (#ff0000"..quitType.."#FFFFFF).", 30, 144, 255, false, 5) end ) function onJoinquitWasted(ammo, killer, killerWeapon, bodypart) if (killer) and (getElementType(killer) == "player") then if bodypart == 9 then -- Headshot outputJoinquitMessage(root, "#FF0000"..getPlayerName(killer).." FFFFFFMatou #ff0000"..getPlayerName(source).." #FFFFFF| Arma: (#ff0000"..getWeaponNameFromID(killerWeapon).."#FFFFFF) - (#ff0000Headshot#FFFFFF)", 30, 144, 255, false, 5) else outputJoinquitMessage(root, "#ff0000"..getPlayerName(killer).." #FFFFFFMatou #ff0000"..getPlayerName(source).." #FFFFFF| Arma: (#ff0000"..getWeaponNameFromID(killerWeapon)..")", 30, 144, 255, false, 5) end else outputJoinquitMessage(root, "#ff0000"..getPlayerName(source).. " #FFFFFFCometeu suicídio. #00ff00 #ffffffID: #00ff00 "..(getAccountID(acc) or "N/A") .."", 30, 144, 255, false, 5) end end addEventHandler("onPlayerWasted", root, onJoinquitWasted) Join Quit Client: local maxMessages = 5; -- Maximo de Mensagens local DefaultTime = 15; local sx, sy = guiGetScreenSize ( ) local DefaultPos = true; local timer_top = { } local timer_btm = { } local messages_top = { } local messages_btm = { } function sendClientMessage ( msg, r, g, b, pos, time ) local r, g, b = r, g, b or 255, 255, 255 if ( pos == nil ) then pos = DefaultPos end -- Check for pos if ( time == nil ) then time = DefaultTime end -- Check for time local GsubedMessage = msg:gsub ( "#%x%x%x%x%x%x", "" ) if ( pos == true ) then if ( not isTimer ( timer_top[GsubedMessage] ) ) then local c_messages = messages_top; if ( #messages_top >= maxMessages ) then local c_messages = messages_top; messages_top = { } for i,v in ipairs ( c_messages ) do if ( i ~= 1 ) then table.insert ( messages_top, { v[1], v[2], v[3], v[4] } ) end end end table.insert ( messages_top, { msg, r, g, b } ) timer_top[GsubedMessage] = setTimer ( function ( msg ) for i,v in ipairs ( messages_top ) do if ( v[1] == msg ) then table.remove ( messages_top, i ) break end end end, time*1000, 1, msg ) return_value = true else return_value = false end else if not ( isTimer ( timer_btm[GsubedMessage] ) ) then local c_messages = messages_btm; if ( #messages_btm >= maxMessages ) then local c_messages = messages_btm; messages_btm = { } for i,v in ipairs ( c_messages ) do if ( i ~= 1 ) then table.insert ( messages_btm, { v[1], v[2], v[3], v[4] } ) end end end table.insert ( messages_btm, { msg, r, g, b } ) timer_btm[GsubedMessage] = setTimer ( function ( msg ) for i,v in ipairs ( messages_btm ) do if ( v[1] == msg ) then table.remove ( messages_btm, i ) break end end end, time*1000, 1, msg ) return_value = true else return_value = false end end return return_value or false end addEvent("sendServerMessage", true) addEventHandler("sendServerMessage", root, sendClientMessage) function dxDrawNotificationBar ( ) for i,v in ipairs ( messages_top ) do local i = i - 1 dxDrawRectangle ( ( sx/2-530/2 ), i*25, 530, 25, tocolor ( 0, 0, 0, 100 ) ) dxDrawText ( v[1], 0, i*25+5, sx, 25, tocolor ( v[2], v[3], v[4], 255 ), 1, "default-bold", "center", "top", true, false, false, true ) end for i,v in pairs ( messages_btm ) do local i = i - 1 local y = i * 25+25 if ( i+1 == #messages_btm ) then dxDrawRectangle ( ( sx/2-530/2 ), (sy-y), 530, 25, tocolor ( 0, 0, 0, 170 ) ) end dxDrawRectangle ( ( sx/2-530/2 ), (sy-y), 530, 25, tocolor ( 0, 0, 0, 150 ) ) dxDrawText ( v[1], 0, (sy-y+5), sx, sy, tocolor ( v[2], v[3], v[4], 255 ), 1, "default-bold", "center", "top", true, false, false, true ) end end addEventHandler ( "onClientRender", root, dxDrawNotificationBar ) addEventHandler('onClientPlayerChangeNick', root, function(oldNick, newNick) sendClientMessage("#1E90FF"..oldNick.."#FFFFFF mudou o nome para #ff0000"..newNick.."#FFFFFF.", 30, 144, 255, false, 5) end ) addEventHandler('onClientPlayerJoin', root, function() sendClientMessage("#1E90FF"..getPlayerName(source).." #FFFFFFEsta chegando na cidade.", 30, 144, 255, false, 5) end ) Quando eu tento fazer ele só aparece o N/A, nunca aparece o ID realmente, alguém pode me ajudar? Não estou entendendo mt bem Link to comment
DNL291 Posted November 7, 2020 Share Posted November 7, 2020 A linha: local ID = getElementData(player, "ID") or "N/A" Deve estar em alguma função, ela está fora e player será um valor nulo. Link to comment
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now