Merge pull request #249 from Brentdevent/notarget

Notarget command
This commit is contained in:
Maurice Heumann 2021-08-30 19:18:52 +02:00 committed by GitHub
commit a4d9da9890
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -430,6 +430,20 @@ namespace command
: "^1off")); : "^1off"));
}); });
add("notarget", []()
{
if (!game::SV_Loaded())
{
return;
}
game::sp::g_entities[0].flags ^= 4;
game::CG_GameMessage(0, utils::string::va("notarget %s",
game::sp::g_entities[0].flags & 4
? "^2on"
: "^1off"));
});
add("noclip", []() add("noclip", []()
{ {
if (!game::SV_Loaded()) if (!game::SV_Loaded())
@ -452,8 +466,10 @@ namespace command
} }
game::sp::g_entities[0].client->flags ^= 2; game::sp::g_entities[0].client->flags ^= 2;
game::CG_GameMessage( game::CG_GameMessage(0, utils::string::va("ufo %s",
0, utils::string::va("ufo %s", game::sp::g_entities[0].client->flags & 2 ? "^2on" : "^1off")); game::sp::g_entities[0].client->flags & 2
? "^2on"
: "^1off"));
}); });
add("give", [](const params& params) add("give", [](const params& params)
@ -541,6 +557,23 @@ namespace command
: "^1off")); : "^1off"));
}); });
add_sv("notarget", [](const int client_num, const params_sv&)
{
if (!game::Dvar_FindVar("sv_cheats")->current.enabled)
{
game::SV_GameSendServerCommand(client_num, game::SV_CMD_RELIABLE,
"f \"Cheats are not enabled on this server\"");
return;
}
game::mp::g_entities[client_num].flags ^= 4;
game::SV_GameSendServerCommand(client_num, game::SV_CMD_RELIABLE,
utils::string::va("f \"notarget %s\"",
game::mp::g_entities[client_num].flags & 4
? "^2on"
: "^1off"));
});
add_sv("noclip", [](const int client_num, const params_sv&) add_sv("noclip", [](const int client_num, const params_sv&)
{ {
if (!game::Dvar_FindVar("sv_cheats")->current.enabled) if (!game::Dvar_FindVar("sv_cheats")->current.enabled)