kanersps / es_admin

GNU Affero General Public License v3.0
26 stars 32 forks source link

Permission issue #36

Open niss1m opened 3 years ago

niss1m commented 3 years ago

Well I tried setting a permission to the goto command (mod and above) but for some reason the command only works for mods.

Mart0O0 commented 3 years ago

Same, Did you fix this?

Mart0O0 commented 1 year ago

server.lua

TriggerEvent("es:addGroup", "admin", "mod", "user", function(group) end)

-- Modify if you want, btw the admin needs to be able to target the group and it will work local groupsRequired = { slay = "superadmin", noclip = "admin", crash = "superadmin", freeze = "superadmin", bring = "mod", ["goto"] = "mod", slap = "superadmin", slay = "superadmin", kick = "admin", ban = "superadmin" }

-- Bring TriggerEvent('es:addGroupCommand', 'bring', "admin", function(source, args, user) if args[1] then if(tonumber(args[1]) and GetPlayerName(tonumber(args[1])))then local player = tonumber(args[1])

        -- User permission check
        TriggerEvent("es:getPlayerFromId", player, function(target)

            TriggerClientEvent('es_admin:teleportUser', target.get('source'), user.getCoords().x, user.getCoords().y, user.getCoords().z)

            TriggerClientEvent('chat:addMessage', player, { args = {"^1SYSTEM", "You have brought by ^2" .. GetPlayerName(source)} })
            TriggerClientEvent('chat:addMessage', source, { args = {"^1SYSTEM", "Player ^2" .. GetPlayerName(player) .. "^0 has been brought"} })
        end)
    else
        TriggerClientEvent('chat:addMessage', source, { args = {"^1SYSTEM", "Incorrect player ID"}})
    end
else
    TriggerClientEvent('chat:addMessage', source, { args = {"^1SYSTEM", "Incorrect player ID"}})
end

end, function(source, args, user) TriggerClientEvent('chat:addMessage', source, { args = {"^1SYSTEM", "Insufficienct permissions!"} }) end, {help = "Teleport a user to you", params = {{name = "userid", help = "The ID of the player"}}})

-- Bring mod

TriggerEvent('es:addGroupCommand', 'bring', "mod", function(source, args, user) if args[1] then if(tonumber(args[1]) and GetPlayerName(tonumber(args[1])))then local player = tonumber(args[1])

        -- User permission check
        TriggerEvent("es:getPlayerFromId", player, function(target)

            TriggerClientEvent('es_admin:teleportUser', target.get('source'), user.getCoords().x, user.getCoords().y, user.getCoords().z)

            TriggerClientEvent('chat:addMessage', player, { args = {"^1SYSTEM", "You have brought by ^2" .. GetPlayerName(source)} })
            TriggerClientEvent('chat:addMessage', source, { args = {"^1SYSTEM", "Player ^2" .. GetPlayerName(player) .. "^0 has been brought"} })
        end)
    else
        TriggerClientEvent('chat:addMessage', source, { args = {"^1SYSTEM", "Incorrect player ID"}})
    end
else
    TriggerClientEvent('chat:addMessage', source, { args = {"^1SYSTEM", "Incorrect player ID"}})
end

end, function(source, args, user) TriggerClientEvent('chat:addMessage', source, { args = {"^1SYSTEM", "Insufficienct permissions!"} }) end, {help = "Teleport a user to you", params = {{name = "userid", help = "The ID of the player"}}})

this is fix bring

CLOSED