mirror of
https://github.com/Resxt/Plutonium-T6-Scripts.git
synced 2025-05-09 22:14:54 +00:00
chat_command_give 1.1.0
Added giveperk command
This commit is contained in:
parent
b08352acda
commit
d0776fde3f
@ -7,9 +7,12 @@ These scripts go in `scripts\zm`
|
||||
| Name | Description | Arguments expected | Example | Permission level |
|
||||
|---|---|---|---|---|
|
||||
| givepowerup | Makes the powerup drop on the player, which activates it | (1) the code name of the powerup | `!givepowerup full_ammo` | 2 |
|
||||
| giveperk | Gives the chosen perk to the targeted player | (1) the name of the targeted player (2) the name of the perk (multiple aliases available, see the GetPerkInfos function in [chat_commands](../chat_commands.gsc)) | `!giveperk me jugg` | 2 |
|
||||
|
||||
You can use [chat_command_info.gsc](../README.md#chat_command_infogsc) to list available powerups.
|
||||
Alternatively you can use [this](https://github.com/plutoniummod/t6-scripts/blob/main/ZM/Core/maps/mp/zombies/_zm_powerups.gsc#L95) to get powerup code names from your browser (first parameter of the `add_zombie_powerup` function calls). Note that this lists all powerups without taking into account whether they're available on the map you play on or not.
|
||||
You can use [chat_command_info.gsc](../README.md#chat_command_infogsc) to list available powerups and perks.
|
||||
Alternatively you can use [this](https://github.com/plutoniummod/t6-scripts/blob/main/ZM/Core/maps/mp/zombies/_zm_powerups.gsc#L95) to get powerup code names from your browser (first parameter of the `add_zombie_powerup` function calls). Note that this lists all powerups without taking into account whether they're available on the map you play on or not.
|
||||
|
||||
You can disable the perk music and/or the bottle animation whenever you use `!giveperk` by changing the corresponding boolean(s) to false in the `GivePlayerPerk` function call.
|
||||
|
||||
Note that like other scripts on this page this is a ZM only script, but this script also has a global version (works in both MP and ZM) that you can find [here](../chat_command_give.gsc) if you're looking for more give commands.
|
||||
You can have both installed at the same time as long as this script is in the `zm` folder and the global version is either in the `scripts` folder or the `mp` folder.
|
||||
@ -18,6 +21,8 @@ You can have both installed at the same time as long as this script is in the `z
|
||||
|---|
|
||||
| `!givepowerup all` |
|
||||
| `!givepowerup all_no_nuke` |
|
||||
| `!giveperk me all` |
|
||||
| `!giveperk me quickrevive` |
|
||||
|
||||
## chat_command_no_target.gsc
|
||||
|
||||
|
@ -3,6 +3,7 @@
|
||||
Init()
|
||||
{
|
||||
CreateCommand(level.chat_commands["ports"], "givepowerup", "function", ::GivePowerupCommand, 2, [], array("spawnpowerup", "powerup", "pu"));
|
||||
CreateCommand(level.chat_commands["ports"], "giveperk", "function", ::GivePerkCommand, 2, [], array("perk"));
|
||||
}
|
||||
|
||||
|
||||
@ -24,6 +25,21 @@ GivePowerupCommand(args)
|
||||
}
|
||||
}
|
||||
|
||||
GivePerkCommand(args)
|
||||
{
|
||||
if (args.size < 2)
|
||||
{
|
||||
return NotEnoughArgsError(2);
|
||||
}
|
||||
|
||||
error = GivePlayerPerk(args[0], args[1], true, true);
|
||||
|
||||
if (IsDefined(error))
|
||||
{
|
||||
return error;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
/* Logic section */
|
||||
@ -62,5 +78,45 @@ GivePlayerPowerup(powerupName)
|
||||
}
|
||||
}
|
||||
|
||||
GivePlayerPerk(playerName, perkName, enableMusic, enableAnimation)
|
||||
{
|
||||
player = FindPlayerByName(playerName);
|
||||
|
||||
if (!IsDefined(player))
|
||||
{
|
||||
return PlayerDoesNotExistError(playerName);
|
||||
}
|
||||
|
||||
if (ToLower(perkName) == "all")
|
||||
{
|
||||
foreach (perk in GetAvailablePerks())
|
||||
{
|
||||
player thread maps\mp\zombies\_zm_perks::give_perk(perk, 0);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
perkInfos = GetPerkInfos(perkName);
|
||||
|
||||
if (perkInfos.size > 0)
|
||||
{
|
||||
if (enableMusic)
|
||||
{
|
||||
player thread maps\mp\zombies\_zm_audio::play_jingle_or_stinger( perkInfos["music"]);
|
||||
}
|
||||
|
||||
if (enableAnimation)
|
||||
{
|
||||
player thread vending_trigger_post_think(player, perkInfos["perk_name"]);
|
||||
}
|
||||
else
|
||||
{
|
||||
player thread maps\mp\zombies\_zm_perks::give_perk(perkInfos["perk_name"], 0);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
return PerkDoesNotExistError(perkName);
|
||||
}
|
||||
}
|
||||
}
|
Loading…
x
Reference in New Issue
Block a user