chat_command_give 1.0.0

This commit is contained in:
Resxt
2023-10-27 13:50:21 +02:00
parent 139ff05c46
commit ea309f9d28
2 changed files with 53 additions and 0 deletions

View File

@@ -0,0 +1,41 @@
#include scripts\chat_commands;
Init()
{
CreateCommand(level.chat_commands["ports"], "givepowerup", "function", ::GivePowerupCommand, 2, [], array("spawnpowerup", "powerup", "pu"));
}
/* Command section */
GivePowerupCommand(args)
{
if (args.size < 1)
{
return NotEnoughArgsError(1);
}
error = GivePlayerPowerup(args[0]);
if (IsDefined(error))
{
return error;
}
}
/* Logic section */
GivePlayerPowerup(powerupName)
{
if (IsValidPowerup(powerupName))
{
level thread maps\mp\zombies\_zm_powerups::specific_powerup_drop(powerupName, self.origin);
}
else
{
return PowerupDoesNotExistError(powerupName);
}
}