From ca01e5d1ec0a3967bec58cda835571dad588436b Mon Sep 17 00:00:00 2001 From: Federico Cecchetto Date: Mon, 3 Jan 2022 23:32:40 +0100 Subject: [PATCH] Add kill command --- src/client/component/command.cpp | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) diff --git a/src/client/component/command.cpp b/src/client/component/command.cpp index f9746040..760a3b0b 100644 --- a/src/client/component/command.cpp +++ b/src/client/component/command.cpp @@ -7,6 +7,7 @@ #include "game/scripting/execution.hpp" #include "command.hpp" +#include "scheduler.hpp" #include "game_console.hpp" #include "chat.hpp" #include "fastfiles.hpp" @@ -426,6 +427,26 @@ namespace command { } }); + + add("kill", [](const params& params) + { + if (!game::SV_Loaded()) + { + return; + } + + scheduler::once([]() + { + try + { + const scripting::entity player = scripting::call("getentbynum", {0}).as(); + player.call("kill"); + } + catch (...) + { + } + }, scheduler::pipeline::server); + }); } }; }