mirror of
https://github.com/Resxt/Plutonium-IW5-Scripts.git
synced 2025-04-19 20:52:54 +00:00
chat_command_god_mode 1.0.0
This commit is contained in:
parent
1c2222443e
commit
b308c84758
@ -52,6 +52,19 @@ Note that this does not work during the prematch period.
|
|||||||
| `!freeze me` |
|
| `!freeze me` |
|
||||||
| `!freeze Resxt` |
|
| `!freeze Resxt` |
|
||||||
|
|
||||||
|
## chat_command_god_mode.gsc
|
||||||
|
|
||||||
|
Toggles whether the targeted player is in god mode (invincible) or not.
|
||||||
|
|
||||||
|
| # | Argument | Mandatory |
|
||||||
|
|---|---|---|
|
||||||
|
| 1 | The name of the player to toggle god mode for | :white_check_mark: |
|
||||||
|
|
||||||
|
| Examples |
|
||||||
|
|---|
|
||||||
|
| `!god me` |
|
||||||
|
| `!god Resxt` |
|
||||||
|
|
||||||
## chat_command_invisible.gsc
|
## chat_command_invisible.gsc
|
||||||
|
|
||||||
Toggles invisibility on the targeted player.
|
Toggles invisibility on the targeted player.
|
||||||
|
80
chat_commands/chat_command_god_mode.gsc
Normal file
80
chat_commands/chat_command_god_mode.gsc
Normal file
@ -0,0 +1,80 @@
|
|||||||
|
#include scripts\chat_commands;
|
||||||
|
|
||||||
|
Init()
|
||||||
|
{
|
||||||
|
CreateCommand(level.commands_servers_ports, "god", "function", ::GodModeCommand, ["default_help_one_player"]);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
/* Command section */
|
||||||
|
|
||||||
|
GodModeCommand(args)
|
||||||
|
{
|
||||||
|
if (args.size < 1)
|
||||||
|
{
|
||||||
|
return NotEnoughArgsError(1);
|
||||||
|
}
|
||||||
|
|
||||||
|
error = ToggleGodMode(args[0]);
|
||||||
|
|
||||||
|
if (IsDefined(error))
|
||||||
|
{
|
||||||
|
return error;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
/* Logic section */
|
||||||
|
|
||||||
|
ToggleGodMode(playerName)
|
||||||
|
{
|
||||||
|
player = FindPlayerByName(playerName);
|
||||||
|
|
||||||
|
if (!IsDefined(player))
|
||||||
|
{
|
||||||
|
return PlayerDoesNotExistError(playerName);
|
||||||
|
}
|
||||||
|
|
||||||
|
commandName = "god";
|
||||||
|
|
||||||
|
ToggleStatus(commandName, "God Mode", player);
|
||||||
|
|
||||||
|
if (GetStatus(commandName, player))
|
||||||
|
{
|
||||||
|
player DoGodMode(true);
|
||||||
|
player thread ThreadGodMode();
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
player DoGodMode(false);
|
||||||
|
player notify("chat_commands_god_mode_off");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
ThreadGodMode()
|
||||||
|
{
|
||||||
|
self endon("disconnect");
|
||||||
|
self endon("chat_commands_god_mode_off");
|
||||||
|
|
||||||
|
for(;;)
|
||||||
|
{
|
||||||
|
self waittill("spawned_player");
|
||||||
|
|
||||||
|
self DoGodMode(true);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
DoGodMode(enabled)
|
||||||
|
{
|
||||||
|
health = 99999;
|
||||||
|
|
||||||
|
if (!enabled)
|
||||||
|
{
|
||||||
|
health = GetDvarInt("scr_player_maxhealth");
|
||||||
|
}
|
||||||
|
|
||||||
|
self.maxhealth = health;
|
||||||
|
self.health = health;
|
||||||
|
}
|
Loading…
x
Reference in New Issue
Block a user