HeroInventory: Difference between revisions

From Multi Theft Auto: Wiki
Jump to navigation Jump to search
No edit summary
No edit summary
Line 2: Line 2:
HeroInventory is a new way to expand a roleplay server's features. This resource allows a server to not only archive items; but organize them appropriately! Adding items, and groups are very simple.
HeroInventory is a new way to expand a roleplay server's features. This resource allows a server to not only archive items; but organize them appropriately! Adding items, and groups are very simple.


==Functions==
==Player Functions==
===addPlayerItem===
===addPlayerItem===
<syntaxhighlight lang="lua">
<syntaxhighlight lang="lua">
Line 18: Line 18:
@description
@description
This will add an item to a client.
This will add an item to a client.
</syntaxhighlight>
===refreshClientGroups===
<syntaxhighlight lang="lua">
bool refreshClientGroups( )
</syntaxhighlight>
<syntaxhighlight lang="lua">
@title
refreshClientGroups
@author
Malicious Hero.
@parameters
@description
This is not really a function used when exporting; but it's important this command remains
in this resource because without this, groups would not be sync properly.
</syntaxhighlight>
===removeItemFromPlayer===
<syntaxhighlight lang="lua">
bool removeItemFromPlayer( element playerElement, int itemID, [ int amount ] )
</syntaxhighlight>
<syntaxhighlight lang="lua">
@title
removeItemFromPlayer
@author
Malicious Hero.
@parameters
playerElement - The player.
itemID - The item ID
amount - The amount you wish to remove. You can leave this blank to remove everything.
@description
Use this function to remove an item from a player.
</syntaxhighlight>
===transferPlayerItem===
<syntaxhighlight lang="lua">
bool transferPlayerItem( element playerElement, element targetElement, int itemID, int amount )
</syntaxhighlight>
<syntaxhighlight lang="lua">
@title
transferPlayerItem
@author
Malicious Hero.
@parameters
playerElement - The player.
targetElement - The target.
itemID - The item ID
amount - The amount you wish to remove. You can leave this blank to remove everything.
@description
Use this function to move one item to another player.
</syntaxhighlight>
===doesPlayerHaveItem===
<syntaxhighlight lang="lua">
bool doesPlayerHaveItem( element playerElement, int itemID)
</syntaxhighlight>
<syntaxhighlight lang="lua">
@title
doesPlayerHaveItem
@author
Malicious Hero.
@parameters
playerElement - The player.
itemID - The item ID
@description
Use this function to move one item to another player.
@returns
if returning true, it will return the amount as well.
</syntaxhighlight>
===getPlayerItemAmount===
<syntaxhighlight lang="lua">
bool getPlayerItemAmount( element playerElement, int itemID )
</syntaxhighlight>
<syntaxhighlight lang="lua">
@title
getPlayerItemAmount
@author
Malicious Hero.
@parameters
playerElement - The player.
itemID - The item ID
@description
Use this function to get a player's item amount
@returns
The amount item. If false, they don't have the item
</syntaxhighlight>
==Group Functions==
===addInventoryGroup===
<syntaxhighlight lang="lua">
bool addInventoryGroup( string group_name, path imagesrc )
</syntaxhighlight>
<syntaxhighlight lang="lua">
@title
addInventoryGroup
@author
Malicious Hero.
@parameters
group_name - Indicates the group name that you wish to add.
imagesrc - The picture you want to associate with the group.
@description
This will add a inventory group, which will allow the server to create new items.
Please keep in mind that in s_inventory_config.lua, you are able to set the maximum amount
of groups you allow.
</syntaxhighlight>
===removeInventoryGroup===
<syntaxhighlight lang="lua">
bool removeInventoryGroup( string group_name )
</syntaxhighlight>
<syntaxhighlight lang="lua">
@title
removeInventoryGroup
@author
Malicious Hero.
@parameters
group_name - Indicates the group name that you wish to add.
@description
This will remove an inventory group.
</syntaxhighlight>
</syntaxhighlight>

Revision as of 20:51, 13 January 2013

Description

HeroInventory is a new way to expand a roleplay server's features. This resource allows a server to not only archive items; but organize them appropriately! Adding items, and groups are very simple.

Player Functions

addPlayerItem

bool addPlayerItem ( element playerElement, int itemID, int amount )
@title
        addPlayerItem
@author
	Malicious Hero.
@parameters
	playerElement - The element you wish to add an item to.
	itemID - The item ID; This can be found in g_items.lua.
	amount - The amount of the item you want.
@description
	This will add an item to a client.

refreshClientGroups

bool refreshClientGroups( )
@title
	refreshClientGroups
@author
	Malicious Hero.
@parameters
		
@description
	This is not really a function used when exporting; but it's important this command remains
	in this resource because without this, groups would not be sync properly.

removeItemFromPlayer

bool removeItemFromPlayer( element playerElement, int itemID, [ int amount ] )
@title
	removeItemFromPlayer
@author
	Malicious Hero.
@parameters
	playerElement - The player.
	itemID - The item ID
	amount - The amount you wish to remove. You can leave this blank to remove everything.
@description
	Use this function to remove an item from a player.

transferPlayerItem

bool transferPlayerItem( element playerElement, element targetElement, int itemID, int amount )
@title
	transferPlayerItem
@author
	Malicious Hero.
@parameters
	playerElement - The player.
	targetElement - The target.
	itemID - The item ID
	amount - The amount you wish to remove. You can leave this blank to remove everything.
@description
	Use this function to move one item to another player.

doesPlayerHaveItem

bool doesPlayerHaveItem( element playerElement, int itemID)
@title
	doesPlayerHaveItem
@author
	Malicious Hero.
@parameters
	playerElement - The player.
	itemID - The item ID
@description
	Use this function to move one item to another player.
@returns
	if returning true, it will return the amount as well.

getPlayerItemAmount

bool getPlayerItemAmount( element playerElement, int itemID )
@title
	getPlayerItemAmount
@author
	Malicious Hero.
@parameters
	playerElement - The player.
	itemID - The item ID
@description
	Use this function to get a player's item amount
@returns
	The amount item. If false, they don't have the item

Group Functions

addInventoryGroup

bool addInventoryGroup( string group_name, path imagesrc )
@title
	addInventoryGroup
@author
	Malicious Hero.
@parameters
	group_name - Indicates the group name that you wish to add.
	imagesrc - The picture you want to associate with the group.
@description
	This will add a inventory group, which will allow the server to create new items.
	Please keep in mind that in s_inventory_config.lua, you are able to set the maximum amount
	of groups you allow.

removeInventoryGroup

bool removeInventoryGroup( string group_name )
@title
	removeInventoryGroup
@author
	Malicious Hero.
@parameters
	group_name - Indicates the group name that you wish to add.
@description
	This will remove an inventory group.