gabrielcosta Posted August 26, 2020 Posted August 26, 2020 Bom, não está reconhecendo o id do jogador quando digita num chat, está dando N/A. Print: https://prnt.sc/u6ikjl Código do chat: ComandoDoChatGlobal = "cp" ----COMANDO PARA UTILIZAR NO CHAT Ex:( /cp OI ) function adminchat ( thePlayer, _, ... ) local message = table.concat ( { ... }, " " ) local ID = getElementData(source, "ID") or "N/A" if ( isPlayerOnGroup ( thePlayer ) ) then for _, player in ipairs ( getElementsByType ( "player" ) ) do if ( isPlayerOnGroup ( player ) ) then conta = getAccountName(getPlayerAccount(thePlayer)) if isObjectInACLGroup ("user."..conta, aclGetGroup ( "Policial" ) ) then ----ACL DE QUEM VAI VER/USAR O CHAT outputChatBox("#ffFFFF| #FFA500COPOM #ffFFFF|#FFA500 "..getPlayerName(thePlayer).. " #ffffff["..ID..") » :#FFA500 "..message, player, 255, 255, 255, true) elseif isObjectInACLGroup ("user."..conta, aclGetGroup ( "Policial" ) ) then ----ACL DE QUEM VAI VER/USAR O CHAT outputChatBox("#ffFFFF| #FFA500COPOM #ffFFFF|#FFA500 "..getPlayerName(thePlayer).. " #ffffff["..ID..") » :#FFA500 "..message, player, 255, 255, 255, true) end end end end setElementData ( thePlayer, "Chat:Avisado", true ) setElementData ( thePlayer, "Chat:Delay1",true ) setTimer ( setElementData, 5000, 1, thePlayer, "Chat:Delay1", false ) end addCommandHandler ( ComandoDoChatGlobal, adminchat ) -------------------------------------------------------------------------------------------- function isPlayerOnGroup ( thePlayer ) local account = getPlayerAccount ( thePlayer ) local inGroup = false for _, group in ipairs ( { "Policial" } ) do ----ACL DE QUEM VAI VER/USAR O CHAT if isObjectInACLGroup ( "user.".. getAccountName ( account ), aclGetGroup ( group ) ) then inGroup = true break end end return inGroup end
Boechat Posted August 27, 2020 Posted August 27, 2020 addEventHandler("onPlayerLogin", getRootElement(), function(_, conta) setElementData(source, 'ID', getAccountID (conta)) end) Parece que seu getElementData() da linha 7 está retornando nil e assim está setando N/A no ID. Tenta colocar esse código acima e vê se funciona
ber Posted August 27, 2020 Posted August 27, 2020 (edited) O ativador foi declarado como thePlayer no parâmetro da função mas no getElementData (linha 7) está como source. Basta alterar esse source para thePlayer Edited August 27, 2020 by ber
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