From 9e207b3c9a00044b23aad68df96b2f2fa7568935 Mon Sep 17 00:00:00 2001 From: FutureRave Date: Wed, 2 Mar 2022 11:46:02 +0000 Subject: [PATCH] Clamp ping instead of throwing error --- src/Components/Modules/Bots.cpp | 8 ++------ 1 file changed, 2 insertions(+), 6 deletions(-) diff --git a/src/Components/Modules/Bots.cpp b/src/Components/Modules/Bots.cpp index f8ebd34e..cdab519a 100644 --- a/src/Components/Modules/Bots.cpp +++ b/src/Components/Modules/Bots.cpp @@ -119,13 +119,9 @@ namespace Components { Script::AddFunction("SetPing", [](Game::scr_entref_t entref) // gsc: self SetPing() { - const auto ping = Game::Scr_GetInt(0); + auto ping = Game::Scr_GetInt(0); - if (ping < 0 || ping > 999) - { - Game::Scr_ParamError(0, "^1SetPing: Ping needs to be between 0 and 999!\n"); - return; - } + ping = std::clamp(ping, 0, 999); const auto* ent = Game::GetPlayerEntity(entref); auto* client = Script::GetClient(ent);