wesssley Posted February 25, 2023 Posted February 25, 2023 Queria por esse chat para somente se a pessoa tem tal element data conseguir visualizar e escrever, ele está por acl, tentei por por element data mais não consegui, entendo um pouco sobre, fiz para aparecer blip e mensagem no chat, porém não consigo fazer um bate papo. ComandoDoChatGlobal = "copom" function adminchat ( thePlayer, _, ... ) local message = table.concat ( { ... }, " " ) 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 if getElementData ( source, "TrabalhoPolicial", true ) then outputChatBox("#FF0000[Facção#FF0000]#ffffff "..getPlayerName(thePlayer).. "#FF0000:#ffffff "..message, player, 255, 255, 255, true) elseif isObjectInACLGroup ("user."..conta, aclGetGroup ( "Policial" ) ) then if getElementData ( source, "TrabalhoPolicial", true ) then outputChatBox("#FF0000[Facção#FF0000]#ffffff "..getPlayerName(thePlayer).. "#FF0000:#ffffff "..message, player, 255, 255, 255, true) end end 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 if isObjectInACLGroup ( "user.".. getAccountName ( account ), aclGetGroup ( "Policial" ) ) then inGroup = true break end end return inGroup end
Doongogar Posted February 25, 2023 Posted February 25, 2023 (edited) creio que em vez de "source" você teria que usar o "player", para filtrar o loop para somente as pessoas que tem o element data e o "elseif" aparenta estar fazendo a mesma coisa que o "if" acima então tirei e indentei o codigo ComandoDoChatGlobal = "copom" function adminchat ( thePlayer, _, ... ) local message = table.concat ( { ... }, " " ) 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 if getElementData(player, "TrabalhoPolicial") == true then outputChatBox("#FF0000[Facção#FF0000]#ffffff "..getPlayerName(thePlayer).. "#FF0000:#ffffff "..message, player, 255, 255, 255, true) end 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 if isObjectInACLGroup ( "user.".. getAccountName ( account ), aclGetGroup ( "Policial" ) ) then inGroup = true break end end return inGroup end Edited February 25, 2023 by SciptNovato 1
Doongogar Posted February 25, 2023 Posted February 25, 2023 de nada meu mano, se poder ta reagindo com um thanks pra ajudar, agradeço demais 1
Recommended Posts