From 0a230d592d63c96ec927e8eb1b1b2b0c3fde99d9 Mon Sep 17 00:00:00 2001 From: Timo Smit Date: Mon, 13 Mar 2017 18:24:04 +0100 Subject: [PATCH] Fixed possibility to slap/gib players not playing or alive --- luamods/wolfadmin/commands/admin/gib.lua | 9 +++++++++ luamods/wolfadmin/commands/admin/slap.lua | 9 +++++++++ 2 files changed, 18 insertions(+) diff --git a/luamods/wolfadmin/commands/admin/gib.lua b/luamods/wolfadmin/commands/admin/gib.lua index 0e17714..82db3bc 100644 --- a/luamods/wolfadmin/commands/admin/gib.lua +++ b/luamods/wolfadmin/commands/admin/gib.lua @@ -21,6 +21,7 @@ local commands = require (wolfa_getLuaPath()..".commands.commands") local players = require (wolfa_getLuaPath()..".players.players") +local constants = require (wolfa_getLuaPath()..".util.constants") local settings = require (wolfa_getLuaPath()..".util.settings") function commandGib(clientId, command, victim) @@ -53,6 +54,14 @@ function commandGib(clientId, command, victim) elseif auth.getPlayerLevel(cmdClient) > auth.getPlayerLevel(clientId) then et.trap_SendConsoleCommand(et.EXEC_APPEND, "csay "..clientId.." \"^dgib: ^9sorry, but your intended victim has a higher admin level than you do.\";") + return true + elseif et.gentity_get(cmdClient, "sess.sessionTeam") ~= constants.TEAM_AXIS and et.gentity_get(cmdClient, "sess.sessionTeam") ~= constants.TEAM_ALLIES then + et.trap_SendConsoleCommand(et.EXEC_APPEND, "csay "..clientId.." \"^dgib: ^7"..et.gentity_get(cmdClient, "pers.netname").." ^9is not playing.\";") + + return true + elseif et.gentity_get(cmdClient, "health") <= 0 then + et.trap_SendConsoleCommand(et.EXEC_APPEND, "csay "..clientId.." \"^dgib: ^7"..et.gentity_get(cmdClient, "pers.netname").." ^9is not alive.\";") + return true end diff --git a/luamods/wolfadmin/commands/admin/slap.lua b/luamods/wolfadmin/commands/admin/slap.lua index e623a47..1d54559 100644 --- a/luamods/wolfadmin/commands/admin/slap.lua +++ b/luamods/wolfadmin/commands/admin/slap.lua @@ -21,6 +21,7 @@ local commands = require (wolfa_getLuaPath()..".commands.commands") local players = require (wolfa_getLuaPath()..".players.players") +local constants = require (wolfa_getLuaPath()..".util.constants") local settings = require (wolfa_getLuaPath()..".util.settings") function commandSlap(clientId, command, victim) @@ -53,6 +54,14 @@ function commandSlap(clientId, command, victim) elseif auth.getPlayerLevel(cmdClient) > auth.getPlayerLevel(clientId) then et.trap_SendConsoleCommand(et.EXEC_APPEND, "csay "..clientId.." \"^dslap: ^9sorry, but your intended victim has a higher admin level than you do.\";") + return true + elseif et.gentity_get(cmdClient, "sess.sessionTeam") ~= constants.TEAM_AXIS and et.gentity_get(cmdClient, "sess.sessionTeam") ~= constants.TEAM_ALLIES then + et.trap_SendConsoleCommand(et.EXEC_APPEND, "csay "..clientId.." \"^dslap: ^7"..et.gentity_get(cmdClient, "pers.netname").." ^9is not playing.\";") + + return true + elseif et.gentity_get(cmdClient, "health") <= 0 then + et.trap_SendConsoleCommand(et.EXEC_APPEND, "csay "..clientId.." \"^dslap: ^7"..et.gentity_get(cmdClient, "pers.netname").." ^9is not alive.\";") + return true end