SetPlayerArmor

From GT-MP
Jump to: navigation, search
SetPlayerArmor
Shared Function
Utilities-terminal.png Server-Side System-users.png Client-Side
Csharp.png C# Javascript.png JavaScript

This function sets the armor of the given player.


Syntax

API.setPlayerArmor(Client player, int armor);

Required Arguments

  • player: parameter input should be in Client type.
  • armor: parameter input should be in int type.


Usage example(s)

/setarmor command that sets your armor to the given value:

In C#
Server-Side Function

[Command("setarmor")]
public void CMD_SetArmor(Client player, int amount)
{
    API.setPlayerArmor(player, amount);
    API.sendChatMessageToPlayer(player, "Armor set to: " + amount);
}

/givearmor command that increases your armor by the given value:

In C#
Server-Side Function

[Command("givearmor")]
public void CMD_GiveArmor(Client player, int amount)
{
    API.setPlayerArmor(player, API.getPlayerArmor(player) + amount);
    API.sendChatMessageToPlayer(player, "Armor increased by: " + amount);
}


References