Otavio_Augusto Posted November 25, 2020 Share Posted November 25, 2020 Estou com um problema onde quando não estou na Acl 'Policial' e mesmo eu estando nas outras não funciona o que está errado?? grupoSegurar = {"Policial", "Admin", "Console"}, function Segurar(thePlayer) for _, acl in ipairs(grupoSegurar) do iprint(_, acl) if not isObjectInACLGroup("user."..getAccountName(getPlayerAccount(thePlayer)) , aclGetGroup(acl)) then return else for _, targetPlayer in ipairs(getElementsByType("player")) do local x, y, z = getElementPosition(thePlayer) local tx, ty, tz = getElementPosition(targetPlayer) if (getDistanceBetweenPoints3D(x, y, z, tx, ty, tz)>1) then else if targetPlayer ~= thePlayer then if getElementData(thePlayer, "char.viszEffect") then setElementData(thePlayer, "char.viszEffect", false) setPedAnimation(targetPlayer, "GANG", "prtial_gngtlkA", false, false) detachElements(targetPlayer, thePlayer, 0, 0.5, 0 ) setElementFrozen(targetPlayer, false) else setElementData(thePlayer, "char.viszEffect", true) attachElements(targetPlayer, thePlayer, 0, 0.5, 0) setElementFrozen(targetPlayer, true) end end end end end end end Link to comment
ber Posted November 26, 2020 Share Posted November 26, 2020 grupoSegurar = {"Policial", "Admin", "Console"}, function Segurar(thePlayer) for i, v in pairs(grupoSegurar) do if isObjectInACLGroup("user."..getAccountName(getPlayerAccount(thePlayer)) , aclGetGroup(v)) then for _, targetPlayer in ipairs(getElementsByType("player")) do local x, y, z = getElementPosition(thePlayer) local tx, ty, tz = getElementPosition(targetPlayer) if (getDistanceBetweenPoints3D(x, y, z, tx, ty, tz)>1) then else if targetPlayer ~= thePlayer then if getElementData(thePlayer, "char.viszEffect") then setElementData(thePlayer, "char.viszEffect", false) setPedAnimation(targetPlayer, "GANG", "prtial_gngtlkA", false, false) detachElements(targetPlayer, thePlayer, 0, 0.5, 0 ) setElementFrozen(targetPlayer, false) else setElementData(thePlayer, "char.viszEffect", true) attachElements(targetPlayer, thePlayer, 0, 0.5, 0) setElementFrozen(targetPlayer, true) end end end end end end end Não use return end em uma tabela assim, pois se ele não estiver na primeira ACL da tabela já vai cancelar a função e não vai considerar as outras ACLs. Do jeito que eu editei acima deve funcionar. 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