mirror of
https://github.com/Resxt/Plutonium-T6-Scripts.git
synced 2025-04-19 13:42:54 +00:00
chat_command_points 1.1.0
Added the givepoints command that allows player to give some of their points to another player (basically transfer points)
This commit is contained in:
parent
9677af1641
commit
54c2c70b30
@ -4,17 +4,19 @@ These scripts go in `scripts\zm`
|
|||||||
|
|
||||||
## chat_command_points.gsc
|
## chat_command_points.gsc
|
||||||
|
|
||||||
3 related commands in one file:
|
4 related commands in one file:
|
||||||
|
|
||||||
- Set points
|
- Set points
|
||||||
- Add points
|
- Add points
|
||||||
- Take/remove points
|
- Take/remove points
|
||||||
|
- Give/transfer points
|
||||||
|
|
||||||
| Name | Description | Arguments expected | Example | Permission level |
|
| Name | Description | Arguments expected | Example | Permission level |
|
||||||
|---|---|---|---|---|
|
|---|---|---|---|---|
|
||||||
| 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 |
|
||||||
|
| givepoints | Gives/transfers points from the player running the command to the targeted player | (1) the name of the targeted player (2) the amount of points to give | `!givepoints Resxt 2500` | 2 |
|
||||||
|
|
||||||
## chat_command_rounds.gsc
|
## chat_command_rounds.gsc
|
||||||
|
|
||||||
|
@ -5,6 +5,7 @@ Init()
|
|||||||
CreateCommand(level.chat_commands["ports"], "setpoints", "function", ::SetPointsCommand, 3);
|
CreateCommand(level.chat_commands["ports"], "setpoints", "function", ::SetPointsCommand, 3);
|
||||||
CreateCommand(level.chat_commands["ports"], "addpoints", "function", ::AddPointsCommand, 3);
|
CreateCommand(level.chat_commands["ports"], "addpoints", "function", ::AddPointsCommand, 3);
|
||||||
CreateCommand(level.chat_commands["ports"], "takepoints", "function", ::TakePointsCommand, 3);
|
CreateCommand(level.chat_commands["ports"], "takepoints", "function", ::TakePointsCommand, 3);
|
||||||
|
CreateCommand(level.chat_commands["ports"], "givepoints", "function", ::GivePointsCommand, 2, [], array("pay", "transferpoints"));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -56,6 +57,21 @@ TakePointsCommand(args)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
GivePointsCommand(args)
|
||||||
|
{
|
||||||
|
if (args.size < 2)
|
||||||
|
{
|
||||||
|
return NotEnoughArgsError(2);
|
||||||
|
}
|
||||||
|
|
||||||
|
error = GivePoints(args[0], args[1]);
|
||||||
|
|
||||||
|
if (IsDefined(error))
|
||||||
|
{
|
||||||
|
return error;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/* Logic section */
|
/* Logic section */
|
||||||
@ -95,3 +111,28 @@ TakePlayerPoints(playerName, points)
|
|||||||
|
|
||||||
player.score -= int(points);
|
player.score -= int(points);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
GivePoints(playerName, points)
|
||||||
|
{
|
||||||
|
player = FindPlayerByName(playerName);
|
||||||
|
|
||||||
|
if (!IsDefined(player))
|
||||||
|
{
|
||||||
|
return PlayerDoesNotExistError(playerName);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (int(points) <= 0)
|
||||||
|
{
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (int(self.score) >= int(points))
|
||||||
|
{
|
||||||
|
self.score -= int(points);
|
||||||
|
player.score += int(points);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
return NotEnoughPointsError();
|
||||||
|
}
|
||||||
|
}
|
Loading…
x
Reference in New Issue
Block a user