mirror of
https://github.com/etlegacy/wolfadmin.git
synced 2024-11-10 06:41:53 +00:00
Fixed possibility to setlevel higher than current level
This commit is contained in:
parent
7ddde82e8d
commit
329eb3afc7
1 changed files with 24 additions and 10 deletions
|
@ -15,12 +15,16 @@
|
||||||
-- You should have received a copy of the GNU General Public License
|
-- You should have received a copy of the GNU General Public License
|
||||||
-- along with this program. If not, see <http://www.gnu.org/licenses/>.
|
-- along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
|
||||||
local auth = require (wolfa_getLuaPath()..".auth.auth")
|
|
||||||
local settings = require (wolfa_getLuaPath()..".util.settings")
|
|
||||||
local db = require (wolfa_getLuaPath()..".db.db")
|
|
||||||
local commands = require (wolfa_getLuaPath()..".commands.commands")
|
|
||||||
local admin = require (wolfa_getLuaPath()..".admin.admin")
|
local admin = require (wolfa_getLuaPath()..".admin.admin")
|
||||||
|
|
||||||
|
local auth = require (wolfa_getLuaPath()..".auth.auth")
|
||||||
|
|
||||||
|
local db = require (wolfa_getLuaPath()..".db.db")
|
||||||
|
|
||||||
|
local commands = require (wolfa_getLuaPath()..".commands.commands")
|
||||||
|
|
||||||
|
local settings = require (wolfa_getLuaPath()..".util.settings")
|
||||||
|
|
||||||
function commandSetLevel(clientId, command, victim, level)
|
function commandSetLevel(clientId, command, victim, level)
|
||||||
if not victim or not level then
|
if not victim or not level then
|
||||||
return false
|
return false
|
||||||
|
@ -36,9 +40,15 @@ function commandSetLevel(clientId, command, victim, level)
|
||||||
return false
|
return false
|
||||||
end
|
end
|
||||||
|
|
||||||
|
if auth.getPlayerLevel(cmdClient) > auth.getPlayerLevel(clientId) then
|
||||||
|
return false
|
||||||
|
elseif level > auth.getPlayerLevel(clientId) then
|
||||||
|
return false
|
||||||
|
end
|
||||||
|
|
||||||
level = tonumber(level) or 0
|
level = tonumber(level) or 0
|
||||||
|
|
||||||
admin.setPlayerLevel(cmdClient, tonumber(level), clientId)
|
admin.setPlayerLevel(cmdClient, level, clientId)
|
||||||
|
|
||||||
return false
|
return false
|
||||||
end
|
end
|
||||||
|
@ -65,21 +75,25 @@ function commandSetLevel(clientId, command, victim, level)
|
||||||
return true
|
return true
|
||||||
end
|
end
|
||||||
|
|
||||||
|
level = tonumber(level) or 0
|
||||||
|
|
||||||
if auth.getPlayerLevel(cmdClient) > auth.getPlayerLevel(clientId) then
|
if auth.getPlayerLevel(cmdClient) > auth.getPlayerLevel(clientId) then
|
||||||
et.trap_SendConsoleCommand(et.EXEC_APPEND, "csay "..clientId.." \"^dsetlevel: ^9sorry, but your intended victim has a higher admin level than you do.\";")
|
et.trap_SendConsoleCommand(et.EXEC_APPEND, "csay "..clientId.." \"^dsetlevel: ^9sorry, but your intended victim has a higher admin level than you do.\";")
|
||||||
|
|
||||||
return true
|
return true
|
||||||
elseif not db.getLevel(tonumber(level)) then
|
elseif not db.getLevel(level) then
|
||||||
et.trap_SendConsoleCommand(et.EXEC_APPEND, "csay "..clientId.." \"^dsetlevel: ^9this admin level does not exist.\";")
|
et.trap_SendConsoleCommand(et.EXEC_APPEND, "csay "..clientId.." \"^dsetlevel: ^9this admin level does not exist.\";")
|
||||||
|
|
||||||
|
return true
|
||||||
|
elseif level > auth.getPlayerLevel(clientId) then
|
||||||
|
et.trap_SendConsoleCommand(et.EXEC_APPEND, "csay "..clientId.." \"^dsetlevel: ^9you may not setlevel higher than your current level.\";")
|
||||||
|
|
||||||
return true
|
return true
|
||||||
end
|
end
|
||||||
|
|
||||||
level = tonumber(level) or 0
|
|
||||||
|
|
||||||
admin.setPlayerLevel(cmdClient, tonumber(level), clientId)
|
admin.setPlayerLevel(cmdClient, tonumber(level), clientId)
|
||||||
|
|
||||||
et.trap_SendConsoleCommand(et.EXEC_APPEND, "csay -1 \"^dsetlevel: ^7"..et.gentity_get(cmdClient, "pers.netname").." ^9is now a level ^7"..level.." ^9player.\";")
|
et.trap_SendConsoleCommand(et.EXEC_APPEND, "cchat -1 \"^dsetlevel: ^7"..et.gentity_get(cmdClient, "pers.netname").." ^9is now a level ^7"..level.." ^9player.\";")
|
||||||
|
|
||||||
return false
|
return false
|
||||||
end
|
end
|
||||||
|
|
Loading…
Reference in a new issue