fix bots
This commit is contained in:
parent
cf210237bd
commit
1d18d35be6
@ -193,7 +193,7 @@ namespace profile_infos
|
|||||||
const auto* svs_clients = *game::svs_clients;
|
const auto* svs_clients = *game::svs_clients;
|
||||||
for (unsigned int i = 0; i < *game::svs_numclients; ++i)
|
for (unsigned int i = 0; i < *game::svs_numclients; ++i)
|
||||||
{
|
{
|
||||||
if (svs_clients[i].header.state >= 1 && !game::SV_BotIsBot(i) && !game::Session_IsHost(game::SV_MainMP_GetServerLobby(), i))
|
if (svs_clients[i].header.state >= 1 && !game::SV_ClientIsBot(i) && !game::Session_IsHost(game::SV_MainMP_GetServerLobby(), i))
|
||||||
{
|
{
|
||||||
send_profile_info(svs_clients[i].remoteAddress, user_id, info);
|
send_profile_info(svs_clients[i].remoteAddress, user_id, info);
|
||||||
}
|
}
|
||||||
@ -205,7 +205,7 @@ namespace profile_infos
|
|||||||
const auto* svs_clients = *game::svs_clients;
|
const auto* svs_clients = *game::svs_clients;
|
||||||
for (unsigned int i = 0; i < *game::svs_numclients; ++i)
|
for (unsigned int i = 0; i < *game::svs_numclients; ++i)
|
||||||
{
|
{
|
||||||
if (svs_clients[i].header.state >= 1 && !game::SV_BotIsBot(i) && game::Session_IsHost(game::SV_MainMP_GetServerLobby(), i))
|
if (svs_clients[i].header.state >= 1 && !game::SV_ClientIsBot(i) && game::Session_IsHost(game::SV_MainMP_GetServerLobby(), i))
|
||||||
{
|
{
|
||||||
assert(i == 0);
|
assert(i == 0);
|
||||||
|
|
||||||
@ -310,7 +310,7 @@ namespace profile_infos
|
|||||||
const auto* svs_clients = *game::svs_clients;
|
const auto* svs_clients = *game::svs_clients;
|
||||||
for (unsigned int i = 0; i < *game::svs_numclients; ++i)
|
for (unsigned int i = 0; i < *game::svs_numclients; ++i)
|
||||||
{
|
{
|
||||||
if (svs_clients[i].header.state >= 1 && !game::SV_BotIsBot(i) && !game::Session_IsHost(game::SV_MainMP_GetServerLobby(), i))
|
if (svs_clients[i].header.state >= 1 && !game::SV_ClientIsBot(i) && !game::Session_IsHost(game::SV_MainMP_GetServerLobby(), i))
|
||||||
{
|
{
|
||||||
send_xuid(svs_clients[i].remoteAddress, xuid, client_index);
|
send_xuid(svs_clients[i].remoteAddress, xuid, client_index);
|
||||||
}
|
}
|
||||||
@ -344,6 +344,11 @@ namespace profile_infos
|
|||||||
{
|
{
|
||||||
auto result = client_connect_hook.invoke<const char*>(client_num, script_pers_id);
|
auto result = client_connect_hook.invoke<const char*>(client_num, script_pers_id);
|
||||||
|
|
||||||
|
if (game::SV_ClientIsBot(client_num))
|
||||||
|
{
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
|
||||||
const auto client = game::svs_clients[client_num];
|
const auto client = game::svs_clients[client_num];
|
||||||
std::uint64_t xuid{};
|
std::uint64_t xuid{};
|
||||||
game::StringToXUID(client->playerGuid, &xuid);
|
game::StringToXUID(client->playerGuid, &xuid);
|
||||||
@ -367,7 +372,7 @@ namespace profile_infos
|
|||||||
{
|
{
|
||||||
session_unregister_remote_player_hook.invoke<void>(session, slot);
|
session_unregister_remote_player_hook.invoke<void>(session, slot);
|
||||||
|
|
||||||
set_client_xuid_to_session(game::SV_MainMP_GetServerLobby(), slot);
|
set_client_xuid_to_session(session, slot);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -214,6 +214,16 @@ namespace game
|
|||||||
Cbuf_AddCall(0, SV_CmdsMP_CheckLoadGame);
|
Cbuf_AddCall(0, SV_CmdsMP_CheckLoadGame);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
bool SV_ClientIsBot(client_t* client)
|
||||||
|
{
|
||||||
|
return client->remoteAddress.type == NA_BOT;
|
||||||
|
}
|
||||||
|
|
||||||
|
bool SV_ClientIsBot(unsigned int client_num)
|
||||||
|
{
|
||||||
|
return svs_clients[client_num]->remoteAddress.type == NA_BOT;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
size_t operator"" _b(const size_t ptr)
|
size_t operator"" _b(const size_t ptr)
|
||||||
|
@ -64,6 +64,9 @@ namespace game
|
|||||||
void DB_EnumXAssets(const std::int32_t type, const std::function<void(XAssetHeader)>& callback);
|
void DB_EnumXAssets(const std::int32_t type, const std::function<void(XAssetHeader)>& callback);
|
||||||
|
|
||||||
void SV_CmdsMP_RequestMapRestart(bool loadScripts, bool migrate);
|
void SV_CmdsMP_RequestMapRestart(bool loadScripts, bool migrate);
|
||||||
|
|
||||||
|
bool SV_ClientIsBot(client_t* client);
|
||||||
|
bool SV_ClientIsBot(unsigned int client_num);
|
||||||
}
|
}
|
||||||
|
|
||||||
size_t operator"" _b(const size_t ptr);
|
size_t operator"" _b(const size_t ptr);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user