[Bots] Add isBot GSC meth back
This commit is contained in:
parent
6737106785
commit
d75a5a71e5
@ -108,8 +108,19 @@ namespace Components
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void Bots::GScr_isTestClient(Game::scr_entref_t entref)
|
||||||
|
{
|
||||||
|
const auto* ent = Game::GetPlayerEntity(entref);
|
||||||
|
const auto* client = Script::GetClient(ent);
|
||||||
|
|
||||||
|
Game::Scr_AddBool(client->bIsTestClient == 1);
|
||||||
|
}
|
||||||
|
|
||||||
void Bots::AddMethods()
|
void Bots::AddMethods()
|
||||||
{
|
{
|
||||||
|
Script::AddMethod("IsBot", Bots::GScr_isTestClient); // Usage: self IsBot();
|
||||||
|
Script::AddMethod("IsTestClient", Bots::GScr_isTestClient); // Usage: self IsTestClient();
|
||||||
|
|
||||||
Script::AddMethod("SetPing", [](Game::scr_entref_t entref) // gsc: self SetPing(<int>)
|
Script::AddMethod("SetPing", [](Game::scr_entref_t entref) // gsc: self SetPing(<int>)
|
||||||
{
|
{
|
||||||
auto ping = Game::Scr_GetInt(0);
|
auto ping = Game::Scr_GetInt(0);
|
||||||
@ -128,14 +139,6 @@ namespace Components
|
|||||||
client->ping = static_cast<int16_t>(ping);
|
client->ping = static_cast<int16_t>(ping);
|
||||||
});
|
});
|
||||||
|
|
||||||
Script::AddMethod("IsTestClient", [](Game::scr_entref_t entref) // Usage: <bot> IsTestClient();
|
|
||||||
{
|
|
||||||
const auto* gentity = Game::GetPlayerEntity(entref);
|
|
||||||
const auto* client = Script::GetClient(gentity);
|
|
||||||
|
|
||||||
Game::Scr_AddBool(client->bIsTestClient == 1);
|
|
||||||
});
|
|
||||||
|
|
||||||
Script::AddMethod("BotStop", [](Game::scr_entref_t entref) // Usage: <bot> BotStop();
|
Script::AddMethod("BotStop", [](Game::scr_entref_t entref) // Usage: <bot> BotStop();
|
||||||
{
|
{
|
||||||
const auto* ent = Game::GetPlayerEntity(entref);
|
const auto* ent = Game::GetPlayerEntity(entref);
|
||||||
@ -327,6 +330,8 @@ namespace Components
|
|||||||
|
|
||||||
Bots::Bots()
|
Bots::Bots()
|
||||||
{
|
{
|
||||||
|
AssertOffset(Game::client_s, bIsTestClient, 0x41AF0);
|
||||||
|
|
||||||
// Replace connect string
|
// Replace connect string
|
||||||
Utils::Hook::Set<const char*>(0x48ADA6, "connect bot%d \"\\cg_predictItems\\1\\cl_anonymous\\0\\color\\4\\head\\default\\model\\multi\\snaps\\20\\rate\\5000\\name\\%s\\protocol\\%d\\checksum\\%d\\statver\\%d %u\\qport\\%d\"");
|
Utils::Hook::Set<const char*>(0x48ADA6, "connect bot%d \"\\cg_predictItems\\1\\cl_anonymous\\0\\color\\4\\head\\default\\model\\multi\\snaps\\20\\rate\\5000\\name\\%s\\protocol\\%d\\checksum\\%d\\statver\\%d %u\\qport\\%d\"");
|
||||||
|
|
||||||
|
@ -14,6 +14,7 @@ namespace Components
|
|||||||
|
|
||||||
static void Spawn(unsigned int count);
|
static void Spawn(unsigned int count);
|
||||||
|
|
||||||
|
static void GScr_isTestClient(Game::scr_entref_t entref);
|
||||||
static void AddMethods();
|
static void AddMethods();
|
||||||
|
|
||||||
static void BotAiAction(Game::client_t* cl);
|
static void BotAiAction(Game::client_t* cl);
|
||||||
|
Loading…
Reference in New Issue
Block a user