Jump to content

Problema com Acl


Recommended Posts

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
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

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 account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...