From 5ce272a9caec4463f2b9093df748a51477b318c9 Mon Sep 17 00:00:00 2001 From: Mat Date: Tue, 17 Mar 2020 18:52:19 +0200 Subject: [PATCH] Kick players in hardcore mode --- hardcore.lua | 13 +++++++++++++ onkilling.lua | 24 ------------------------ 2 files changed, 13 insertions(+), 24 deletions(-) create mode 100644 hardcore.lua delete mode 100644 onkilling.lua diff --git a/hardcore.lua b/hardcore.lua new file mode 100644 index 0000000..08aded9 --- /dev/null +++ b/hardcore.lua @@ -0,0 +1,13 @@ +-- Implements the OnKilling hook handler that effectively implements the hardcore mode of the server + +-- If the server is in hardcore mode, bans the killed player +function OnKilling(Victim, Killer) + if (Victim:IsPlayer()) then + if (cRoot:Get():GetServer():IsHardcore()) then + local Reason = "Killed in hardcore mode" + + AddPlayerToBanlist(Victim:GetName(), Reason, "Server-Core") + KickPlayer(Victim:GetName(), Reason) + end + end +end diff --git a/onkilling.lua b/onkilling.lua deleted file mode 100644 index 09da43b..0000000 --- a/onkilling.lua +++ /dev/null @@ -1,24 +0,0 @@ - --- onkilling.lua - --- Implements the OnKilling hook handler that effectively implements the hardcore mode of the server - - - - - ---- Handler for the HOOK_KILLING hook --- If the server is in hardcore mode, bans the killed player -function OnKilling(a_Victim, a_Killer) - if (a_Victim:IsPlayer()) then - if (cRoot:Get():GetServer():IsHardcore()) then - AddPlayerToBanlist(a_Victim:GetName(), "Killed in hardcore mode", "Server-Core") - end - end - - return false -end - - - -