Added god/demigod and fixed ufo
This commit is contained in:
parent
a3947c1461
commit
6d916ebd47
@ -164,8 +164,11 @@ namespace Components
|
|||||||
static int toastDurationMedium = 2500;
|
static int toastDurationMedium = 2500;
|
||||||
static int toastDurationLong = 5000;
|
static int toastDurationLong = 5000;
|
||||||
|
|
||||||
// Disable native noclip command
|
// Disable native cheat commands
|
||||||
Utils::Hook::Nop(0x474846, 5);
|
Utils::Hook::Nop(0x474846, 5); // Cmd_Noclip_f
|
||||||
|
Utils::Hook::Nop(0x474859, 5); // Cmd_UFO_f
|
||||||
|
Utils::Hook::Nop(0x47480A, 5); // Cmd_God_f
|
||||||
|
Utils::Hook::Nop(0x47481D, 5); // Cmd_DemiGod_f
|
||||||
|
|
||||||
Command::Add("noclip", [](Command::Params*)
|
Command::Add("noclip", [](Command::Params*)
|
||||||
{
|
{
|
||||||
@ -213,6 +216,52 @@ namespace Components
|
|||||||
Toast::Show("cardicon_abduction", "Success", "UFO toggled", toastDurationShort);
|
Toast::Show("cardicon_abduction", "Success", "UFO toggled", toastDurationShort);
|
||||||
});
|
});
|
||||||
|
|
||||||
|
Command::Add("god", [](Command::Params*)
|
||||||
|
{
|
||||||
|
int clientNum = Game::CG_GetClientNum();
|
||||||
|
if (!Game::CL_IsCgameInitialized() || clientNum >= 18 || clientNum < 0)
|
||||||
|
{
|
||||||
|
Logger::Print("You are not hosting a match!\n");
|
||||||
|
Toast::Show("cardicon_stop", "Error", "You are not hosting a match!", toastDurationMedium);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!Dvar::Var("sv_cheats").get<bool>())
|
||||||
|
{
|
||||||
|
Logger::Print("Cheats disabled!\n");
|
||||||
|
Toast::Show("cardicon_stop", "Error", "Cheats disabled!", toastDurationMedium);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
Game::g_entities[clientNum].flags ^= Game::FL_GODMODE;
|
||||||
|
|
||||||
|
Logger::Print("Godmode toggled\n");
|
||||||
|
Toast::Show("cardicon_abduction", "Success", "Godmode toggled", toastDurationShort);
|
||||||
|
});
|
||||||
|
|
||||||
|
Command::Add("demigod", [](Command::Params*)
|
||||||
|
{
|
||||||
|
int clientNum = Game::CG_GetClientNum();
|
||||||
|
if (!Game::CL_IsCgameInitialized() || clientNum >= 18 || clientNum < 0)
|
||||||
|
{
|
||||||
|
Logger::Print("You are not hosting a match!\n");
|
||||||
|
Toast::Show("cardicon_stop", "Error", "You are not hosting a match!", toastDurationMedium);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!Dvar::Var("sv_cheats").get<bool>())
|
||||||
|
{
|
||||||
|
Logger::Print("Cheats disabled!\n");
|
||||||
|
Toast::Show("cardicon_stop", "Error", "Cheats disabled!", toastDurationMedium);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
Game::g_entities[clientNum].flags ^= Game::FL_DEMI_GODMODE;
|
||||||
|
|
||||||
|
Logger::Print("Demigod toggled\n");
|
||||||
|
Toast::Show("cardicon_abduction", "Success", "Demigod toggled", toastDurationShort);
|
||||||
|
});
|
||||||
|
|
||||||
Command::Add("setviewpos", [](Command::Params* params)
|
Command::Add("setviewpos", [](Command::Params* params)
|
||||||
{
|
{
|
||||||
int clientNum = Game::CG_GetClientNum();
|
int clientNum = Game::CG_GetClientNum();
|
||||||
|
@ -636,7 +636,7 @@ namespace Components
|
|||||||
Script::ScriptStorage.clear();
|
Script::ScriptStorage.clear();
|
||||||
});
|
});
|
||||||
|
|
||||||
Script::AddFunction("Noclip", [](Game::scr_entref_t entref)
|
Script::AddFunction("Noclip", [](Game::scr_entref_t entref) // gsc: Noclip(<optional int toggle>);
|
||||||
{
|
{
|
||||||
if (entref >= Game::MAX_GENTITIES || Game::g_entities[entref].client == nullptr)
|
if (entref >= Game::MAX_GENTITIES || Game::g_entities[entref].client == nullptr)
|
||||||
{
|
{
|
||||||
@ -644,7 +644,7 @@ namespace Components
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (Game::Scr_GetNumParam() == 1 && Game::Scr_GetType(0) == Game::VAR_INTEGER)
|
if (Game::Scr_GetNumParam() == 1u && Game::Scr_GetType(0) == Game::VAR_INTEGER)
|
||||||
{
|
{
|
||||||
if (Game::Scr_GetInt(0))
|
if (Game::Scr_GetInt(0))
|
||||||
{
|
{
|
||||||
@ -661,7 +661,7 @@ namespace Components
|
|||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
Script::AddFunction("Ufo", [](Game::scr_entref_t entref)
|
Script::AddFunction("Ufo", [](Game::scr_entref_t entref) // gsc: Ufo(<optional int toggle>);
|
||||||
{
|
{
|
||||||
if (entref >= Game::MAX_GENTITIES || Game::g_entities[entref].client == nullptr)
|
if (entref >= Game::MAX_GENTITIES || Game::g_entities[entref].client == nullptr)
|
||||||
{
|
{
|
||||||
@ -669,7 +669,7 @@ namespace Components
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (Game::Scr_GetNumParam() == 1 && Game::Scr_GetType(0) == Game::VAR_INTEGER)
|
if (Game::Scr_GetNumParam() == 1u && Game::Scr_GetType(0) == Game::VAR_INTEGER)
|
||||||
{
|
{
|
||||||
if (Game::Scr_GetInt(0))
|
if (Game::Scr_GetInt(0))
|
||||||
{
|
{
|
||||||
@ -685,6 +685,56 @@ namespace Components
|
|||||||
Game::g_entities[entref].client->flags ^= Game::PLAYER_FLAG_UFO;
|
Game::g_entities[entref].client->flags ^= Game::PLAYER_FLAG_UFO;
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
|
Script::AddFunction("God", [](Game::scr_entref_t entref) // gsc: God(<optional int toggle>);
|
||||||
|
{
|
||||||
|
if (entref >= Game::MAX_GENTITIES)
|
||||||
|
{
|
||||||
|
Game::Scr_Error(Utils::String::VA("^1God: entity %u is out of bounds\n", entref));
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (Game::Scr_GetNumParam() == 1u && Game::Scr_GetType(0) == Game::VAR_INTEGER)
|
||||||
|
{
|
||||||
|
if (Game::Scr_GetInt(0))
|
||||||
|
{
|
||||||
|
Game::g_entities[entref].flags |= Game::FL_GODMODE;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
Game::g_entities[entref].flags &= ~Game::FL_GODMODE;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
Game::g_entities[entref].flags ^= Game::FL_GODMODE;
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
Script::AddFunction("Demigod", [](Game::scr_entref_t entref) // gsc: Demigod(<optional int toggle>);
|
||||||
|
{
|
||||||
|
if (entref >= Game::MAX_GENTITIES)
|
||||||
|
{
|
||||||
|
Game::Scr_Error(Utils::String::VA("^1Demigod: entity %u is out of bounds\n", entref));
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (Game::Scr_GetNumParam() == 1u && Game::Scr_GetType(0) == Game::VAR_INTEGER)
|
||||||
|
{
|
||||||
|
if (Game::Scr_GetInt(0))
|
||||||
|
{
|
||||||
|
Game::g_entities[entref].flags |= Game::FL_DEMI_GODMODE;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
Game::g_entities[entref].flags &= ~Game::FL_DEMI_GODMODE;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
Game::g_entities[entref].flags ^= Game::FL_DEMI_GODMODE;
|
||||||
|
}
|
||||||
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
Script::Script()
|
Script::Script()
|
||||||
|
@ -189,6 +189,28 @@ namespace Game
|
|||||||
ERR_MAPLOADERRORSUMMARY = 0x7
|
ERR_MAPLOADERRORSUMMARY = 0x7
|
||||||
} errorParm_t;
|
} errorParm_t;
|
||||||
|
|
||||||
|
enum entityFlag
|
||||||
|
{
|
||||||
|
FL_GODMODE = 0x1,
|
||||||
|
FL_DEMI_GODMODE = 0x2,
|
||||||
|
FL_NOTARGET = 0x4,
|
||||||
|
FL_NO_KNOCKBACK = 0x8,
|
||||||
|
FL_NO_RADIUS_DAMAGE = 0x10,
|
||||||
|
FL_SUPPORTS_LINKTO = 0x1000,
|
||||||
|
FL_NO_AUTO_ANIM_UPDATE = 0x2000,
|
||||||
|
FL_GRENADE_TOUCH_DAMAGE = 0x4000,
|
||||||
|
FL_STABLE_MISSILES = 0x20000,
|
||||||
|
FL_REPEAT_ANIM_UPDATE = 0x40000,
|
||||||
|
FL_VEHICLE_TARGET = 0x80000,
|
||||||
|
FL_GROUND_ENT = 0x100000,
|
||||||
|
FL_CURSOR_HINT = 0x200000,
|
||||||
|
FL_MISSILE_ATTRACTOR = 0x800000,
|
||||||
|
FL_WEAPON_BEING_GRABBED = 0x1000000,
|
||||||
|
FL_DELETE = 0x2000000,
|
||||||
|
FL_BOUNCE = 0x4000000,
|
||||||
|
FL_MOVER_SLIDE = 0x8000000
|
||||||
|
};
|
||||||
|
|
||||||
struct FxEffectDef;
|
struct FxEffectDef;
|
||||||
struct pathnode_t;
|
struct pathnode_t;
|
||||||
struct pathnode_tree_t;
|
struct pathnode_tree_t;
|
||||||
|
Loading…
Reference in New Issue
Block a user