Repository navigation
User API
The User API is useful when you need to interact with users directly.
##Available Functions
UserHasCurrency();
UserGiveItem();
UserTakeItem();
UserGiveCurrency();
UserEquippedItem();
##UserHasCurrency();
UserHasCurrency(); is a function to test for if the user has at least the minimum amount of currency specified. This function takes three variables.
$api->UserHasCurrency($var1,$var2,$var3);
Variable #1 - Integer. Specifies the user testing on.
Variable #2 - Integer. Currency Type. Valid inputs are 1 (Primary) and 2 (Secondary)
The third variable is the minimum amount of currency to test for. Needs to be a valid integer.
This function returns true if the user has more than or equal to the minimum currency required. Function will return false if user does not have the minimum currency, user does not exist, or attempting to test against a non-existent currency.
##UserGiveItem();
UserGiveItem(); is a function used to give the specified user a quantity of an item to their inventory. This function takes three variables.
$api->UserGiveItem($var1,$var2,$var3);
Variable #1 - Integer. Specifies the user testing on.
The second variable is an integer, which is the item ID you wish to give to the player.
The third variable is an integer, which is the quantity of the second variable you wish to give to the user.
This function returns true if the item was given to the user, and false if it did not.
##UserTakeItem();
UserTakeItem(); is a function used to give the specified user a quantity of an item to their inventory. This function takes three variables.
$api->UserTakeItem($var1,$var2,$var3);
Variable #1 - Integer. Specifies the user testing on.
The second variable is an integer, which is the item ID you wish to take from the player.
The third variable is an integer, which is the quantity of the second variable you wish to take from the user.
This function returns true if the item was taken from the user, and false if it did not.
##UserGiveCurrency();
UserGiveCurrency(); is a function used to give the specified user a quantity of currency. This function takes three variables.
$api->UserGiveCurrency($var1,$var2,$var3);
Variable #1 - Integer. Specifies the user testing on.
Variable #2 - Integer. Currency Type. Valid inputs are 1 (Primary) and 2 (Secondary)
The third variable is an integer, which is the quantity of the currency you wish to give to the player..
This function returns true if the currency was taken to the user, and false if it did not.
##UserEquippedItem();
UserEquippedItem(); is a function used to test what the specified user has equipped in the specified slot. Optionally, you can test for if they have nothing equipped, anything equipped or a specified item equipped. This function takes three variables.
$api->UserEquippedItem($var1,$var2,$var3);
Variable #1 - Integer. Specifies the user testing on.
Variable #2 - Integer. Equipment slot. Valid inputs are 1 (Primary), 2 (Secondary), 3 (Armor)
Variable #3 - Integer. Item ID to test for. Specify -1 for any item. 0 for no item, and any number above 0 for a specific weapon.
Returns true if the user has the specified item in the specified slot. Returns false if otherwise.
Current Chivalry Engine Versions:
V1 - 1.0.3b released March 21, 2025
V2 - 2.0.2 released Jun 13, 2020
V3- 3.0.0-alpha1 released Sept 29, 2019