chat_command_rounds 1.0.0

This commit is contained in:
Resxt 2023-03-25 22:33:31 +01:00
parent 0e9181f188
commit acb66df149
2 changed files with 148 additions and 0 deletions

View File

@ -15,3 +15,22 @@ These scripts go in `scripts\zm`
| setpoints | Changes how much points the targeted player has | (1) the name of the targeted player (2) the new amount of points to set | `!setpoints me 50000` | 3 | | setpoints | Changes how much points the targeted player has | (1) the name of the targeted player (2) the new amount of points to set | `!setpoints me 50000` | 3 |
| addpoints | Gives points to the targeted player | (1) the name of the targeted player (2) the amount of points to give | `!addpoints Resxt 2500` | 3 | | addpoints | Gives points to the targeted player | (1) the name of the targeted player (2) the amount of points to give | `!addpoints Resxt 2500` | 3 |
| takepoints | Takes/removes points from the targeted player | (1) the name of the targeted player (2) the amount of points to take from the player | `!takepoints Resxt 500` | 3 | | takepoints | Takes/removes points from the targeted player | (1) the name of the targeted player (2) the amount of points to take from the player | `!takepoints Resxt 500` | 3 |
## chat_command_rounds.gsc
4 related commands in one file:
- Set round
- Change to previous round
- Change to next round
- Restart current round
| Name | Description | Arguments expected | Example | Permission level |
|---|---|---|---|---|
| setround | Kills all zombies and changes the round to the specified round | (1) the desired round number | `!setround 10` | 4 |
| previousround | Kills all zombies and changes the round to the previous round | none | `!previousround` | 4 |
| nextround | Kills all zombies and changes the round to the next round | none | `!nextround` | 4 |
| restartround | Kills all zombies and restarts the current round | none | `!restartround` | 4 |
It's recommend to only run these commands after at least one zombie has fully spawned (got out of the ground and starts walking).
Your score and kills don't increase when running these commands even if you're technically the one who kills the zombies.

View File

@ -0,0 +1,129 @@
#include scripts\chat_commands;
Init()
{
CreateCommand(level.chat_commands["ports"], "setround", "function", ::SetRoundCommand, 4);
CreateCommand(level.chat_commands["ports"], "previousround", "function", ::PreviousRoundCommand, 4);
CreateCommand(level.chat_commands["ports"], "nextround", "function", ::NextRoundCommand, 4);
CreateCommand(level.chat_commands["ports"], "restartround", "function", ::RestartRoundCommand, 4);
}
/* Command section */
SetRoundCommand(args)
{
if (args.size < 1)
{
return NotEnoughArgsError(1);
}
error = SetRound(args[0], true);
if (IsDefined(error))
{
return error;
}
TellAllPlayers(array("^5" + self.name + " ^7changed the round to round ^5" + args[0]));
}
PreviousRoundCommand(args)
{
error = SetRound((level.round_number - 1), true);
if (IsDefined(error))
{
return error;
}
TellAllPlayers(array("^5" + self.name + " ^7changed the round to the ^5previous round"));
}
NextRoundCommand(args)
{
error = SetRound((level.round_number + 1), true);
if (IsDefined(error))
{
return error;
}
TellAllPlayers(array("^5" + self.name + " ^7changed the round to the ^5next round"));
}
RestartRoundCommand(args)
{
error = SetRound((level.round_number), false);
if (IsDefined(error))
{
return error;
}
TellAllPlayers(array("^5" + self.name + " ^7restarted the ^5current ^7round"));
}
/* Logic section */
SetRound(roundNumber, doNukeEffect)
{
roundNumber = int(roundNumber);
if (roundNumber <= 0)
{
return InvalidRoundError(roundNumber);
}
self thread KillAllZombies(doNukeEffect);
if (level.round_number > 1 || roundNumber > 1 || level.round_number == roundNumber)
{
level.round_number = roundNumber - 1;
}
}
KillAllZombies(doNukeEffect)
{
zombies = GetAIArray("axis");
level.zombie_total = 0;
playerScore = self.score;
playerKills = self.kills;
if(IsDefined(zombies))
{
for(i=0; i < zombies.size; i++)
{
zombies[i] DoDamage(zombies[i].health * 5000, (0,0,0), self);
wait 0.05;
}
if (IsDefined(doNukeEffect) && doNukeEffect)
{
self DoNuke();
}
}
self.score = playerScore; // reset the player's score to the score he had before calling the command
self.kills = playerKills; // reset the player's kills to the kills he had before calling the command
}
DoNuke()
{
foreach(player in level.players)
{
level thread maps\mp\zombies\_zm_powerups::nuke_powerup(self, player.team);
player maps\mp\zombies\_zm_powerups::powerup_vo("nuke");
zombies = getaiarray(level.zombie_team);
player.zombie_nuked = arraysort(zombies, self.origin);
player notify("nuke_triggered");
}
}