Instity Posted December 23, 2019 Share Posted December 23, 2019 Fiz um comando para setar um elementData por id so que em vez de setar pro player esta setando para mim, mesma coisa ao tentar remover o elementData function adicionarCorp(thePlayer, id) local player = getPlayerID(tonumber(id)) if isObjectInACLGroup("user." ..getAccountName(getPlayerAccount(thePlayer)), aclGetGroup("Admin")) then setElementData(player, "INT:BTS", tonumber(id)) outputChatBox("[INT]: #ffffffVocê colocou o jogador [ID]:"..id.." na corporação!", thePlayer,255,255,255, true) end end addCommandHandler("corp", adicionarCorp) function removeCorp(thePlayer, id) local player = getPlayerID(tonumber(id)) if isObjectInACLGroup("user." ..getAccountName(getPlayerAccount(thePlayer)), aclGetGroup("Admin")) then removeElementData(player, "INT:BTS", tonumber(id)) outputChatBox("[INT]: #ffffffVocê removeu o jogador [ID]:"..id.." da corporação!", thePlayer,255,255,255, true) end end addCommandHandler("rcorp", removeCorp) Link to comment
[M]ister Posted December 24, 2019 Share Posted December 24, 2019 Tente: function adicionarCorp(thePlayer, _, id) if (isObjectInACLGroup("user." ..getAccountName(getPlayerAccount(thePlayer)), aclGetGroup("Admin"))) then if (setElementData(getPlayerID(tonumber(id)), "INT:BTS", true)) then outputChatBox("[INT]: #ffffffVocê colocou o jogador [ID]:"..id.." na corporação!", thePlayer,255,255,255, true) end end end addCommandHandler("corp", adicionarCorp) function removeCorp(thePlayer, _, id) if (isObjectInACLGroup("user." ..getAccountName(getPlayerAccount(thePlayer)), aclGetGroup("Admin"))) then if (removeElementData(getPlayerID(tonumber(id)), "INT:BTS")) then outputChatBox("[INT]: #ffffffVocê removeu o jogador [ID]:"..id.." da corporação!", thePlayer,255,255,255, true) end end end addCommandHandler("rcorp", removeCorp) Obs: getPlayerID não é uma função nativa do MTA, espero que esteja importando/incluindo no seu código. 1 Link to comment
Instity Posted December 24, 2019 Author Share Posted December 24, 2019 (edited) 1 hour ago, [M]ister said: Tente: function adicionarCorp(thePlayer, _, id) if (isObjectInACLGroup("user." ..getAccountName(getPlayerAccount(thePlayer)), aclGetGroup("Admin"))) then if (setElementData(getPlayerID(tonumber(id)), "INT:BTS", true)) then outputChatBox("[INT]: #ffffffVocê colocou o jogador [ID]:"..id.." na corporação!", thePlayer,255,255,255, true) end end end addCommandHandler("corp", adicionarCorp) function removeCorp(thePlayer, _, id) if (isObjectInACLGroup("user." ..getAccountName(getPlayerAccount(thePlayer)), aclGetGroup("Admin"))) then if (removeElementData(getPlayerID(tonumber(id)), "INT:BTS")) then outputChatBox("[INT]: #ffffffVocê removeu o jogador [ID]:"..id.." da corporação!", thePlayer,255,255,255, true) end end end addCommandHandler("rcorp", removeCorp) Obs: getPlayerID não é uma função nativa do MTA, espero que esteja importando/incluindo no seu código. Funcionou perfeitamente sim o código está incluido. Edited December 24, 2019 by Instity 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