From 9ed579176cd78c12f88fd679b3f4be7094fddac1 Mon Sep 17 00:00:00 2001 From: fed <58637860+fedddddd@users.noreply.github.com> Date: Wed, 7 Dec 2022 00:14:50 +0100 Subject: [PATCH] Add some commands --- src/client/component/command.cpp | 54 ++++++++++++++++++++++++++++++++ 1 file changed, 54 insertions(+) diff --git a/src/client/component/command.cpp b/src/client/component/command.cpp index e6336139..e833d724 100644 --- a/src/client/component/command.cpp +++ b/src/client/component/command.cpp @@ -464,6 +464,60 @@ namespace command } }, scheduler::pipeline::server); }); + + add("setviewpos", [](const params& params) + { + if (!game::SV_Loaded()) + { + return; + } + + scripting::vector origin + ( + static_cast(std::atof(params.get(1))), + static_cast(std::atof(params.get(2))), + static_cast(std::atof(params.get(3))) + ); + + scheduler::once([=]() + { + try + { + const scripting::entity player{game::Scr_GetEntityId(0, 0)}; + player.call("setorigin", {origin}); + } + catch (...) + { + } + }, scheduler::pipeline::server); + }); + + add("setviewang", [](const params& params) + { + if (!game::SV_Loaded()) + { + return; + } + + scripting::vector angles + ( + static_cast(std::atof(params.get(1))), + static_cast(std::atof(params.get(2))), + static_cast(std::atof(params.get(3))) + ); + + scheduler::once([=]() + { + try + { + const scripting::entity player{game::Scr_GetEntityId(0, 0)}; + player.call("setplayerangles", {angles}); + } + catch (...) + { + } + }, scheduler::pipeline::server); + }); } }; }