[General]: Do not apply some commands to bots (#730)

This commit is contained in:
Edo 2023-01-25 16:37:28 +00:00 committed by GitHub
parent 22a56012fb
commit e22ab6ab7d
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 14 additions and 5 deletions

View File

@ -254,7 +254,6 @@ namespace Components
}
const auto num = std::atoi(input);
if (num < 0 || num >= *Game::svs_clientCount)
{
Logger::Print("Bad client slot: {}\n", num);
@ -268,8 +267,13 @@ namespace Components
return;
}
if (cl->bIsTestClient)
{
return;
}
const std::string reason = params->size() < 3 ? "EXE_ERR_BANNED_PERM" : params->join(2);
Bans::BanClient(&Game::svs_clients[num], reason);
BanClient(&Game::svs_clients[num], reason);
});
Command::Add("unbanClient", [](Command::Params* params)

View File

@ -316,7 +316,7 @@ namespace Components
}
const auto* client = Game::SV_GetPlayerByNum();
if (client != nullptr)
if (client && !client->bIsTestClient)
{
Voice::SV_MuteClient(client - Game::svs_clients);
MuteClient(client);
@ -339,8 +339,12 @@ namespace Components
}
const auto* client = Game::SV_GetPlayerByNum();
if (client->bIsTestClient)
{
return;
}
if (client != nullptr)
if (client)
{
UnmuteClient(client);
Voice::SV_UnmuteClient(client - Game::svs_clients);

View File

@ -160,6 +160,7 @@ namespace Components
// 15 or more custom classes
Utils::Hook::Set<BYTE>(0x60A2FE, NUM_CUSTOM_CLASSES);
#ifdef _DEBUG
// Reset empty names
Command::Add("checkClasses", [](Command::Params*)
{
@ -170,7 +171,7 @@ namespace Components
if (!*className) strcpy_s(className, 24, Game::SEH_StringEd_GetString(Utils::String::VA("CLASS_SLOT%i", i + 1)));
}
});
#endif
return;
}