[Script] Add ufo and noclip function

This commit is contained in:
FutureRave 2021-10-16 13:36:29 +01:00
parent 3cbe6e820c
commit 4a40a89e70
No known key found for this signature in database
GPG Key ID: E883E2BC9657D955
2 changed files with 23 additions and 0 deletions

View File

@ -531,6 +531,28 @@ namespace Components
{
Script::ScriptStorage.clear();
});
Script::AddFunction("NoClip", [](Game::scr_entref_t entref)
{
if (entref >= Game::MAX_GENTITIES || Game::g_entities[entref].client == nullptr)
{
Game::Scr_Error(Utils::String::VA("^1NoClip: entity %u is not a client\n", entref));
return;
}
Game::g_entities[entref].client->flags ^= Game::PLAYER_FLAG_NOCLIP;
});
Script::AddFunction("Ufo", [](Game::scr_entref_t entref)
{
if (entref >= Game::MAX_GENTITIES || Game::g_entities[entref].client == nullptr)
{
Game::Scr_Error(Utils::String::VA("^1Ufo: entity %u is not a client\n", entref));
return;
}
Game::g_entities[entref].client->flags ^= Game::PLAYER_FLAG_UFO;
});
}
Script::Script()

View File

@ -931,6 +931,7 @@ namespace Game
extern int* demoRecording;
extern int* serverMessageSequence;
constexpr auto MAX_GENTITIES = 2048;
extern gentity_t* g_entities;
extern netadr_t* connectedHost;