Server functions

Things you can use to enhance your experience.

ashop.openMenu(PLAYER)

Function to open the menu on a player.

PLAYER:ashop_addCoinsSafe(amount: Integer, is_premium: Boolean)

Give coins to a player. Amount is the amount of coins. is_premium is true if you want to give premium coins, false otherwise. You can also call PS2 functions, there a compatibility for this.

ashop.actions.Buy(PLAYER, itemID: Integer, premium_buy: Boolean)

Premium_buy: Use premium coins ?

itemID: ID of the item, read in the hooks part for this.

ashop.actions.DeletePlayerItem(PLAYER, plyItemID: Integer)

Safely remove an item a player owns.

ashop.actions.DeletePlayerItemRaw(plyItemID: Integer)

Delete an item a player owns. This is only used for disconnected players.

ashop.actions.Refund(PLAYER, plyItemID: Integer, ratio: Float[0, 1] )

Ratio is between 0 and 1, you can add more if you want to give extra coins.

This is based on the price the player bought the item, not the current price.

ashop.actions.Give(PLAYER, item_id: Integer, metadata: nil, price_buy: Integer, premium_buy: Boolean, c: Function(plyitemid))

Metadata is a powerful feature, you can make unique item per player using this. In short, this will override the item data with the metadata data. You should avoid using it if you don't know what you are doing. This is used to allow players to put their own position, angles, etc... for items. But you can use it to make custom pac3 for a specific player item, etc... Set it to nil by default.

price_buy: How much the player spent to buy this item. 0 for gifted, the base price for bought items. Set whatever you want.

premium_buy: This was a buy, using premium coins ?

c: Not necessary, this is a callback with the ply_item_id number.

ashop.actions.GiveOffline(id: SteamID64, itemID: Integer, metadata: nil, price_buy: Integer, t: Integer, premium_buy: Boolean, callback: function(plyitemid), alreadyLogged: Boolean)

The offline version of the Give function, same parameters description. Internally, the give function call this one.

alreadyLogged: Set it to false, this is used to avoid putting the give 2 times in the logs, if the Give function was called.

t: Time when the item was bought, you can override it with a custom integer. The default value is os.time()

ashop.actions.ChangeUserMetadata(PLAYER, plyItemID: Integer, newParams: Table, ignoreUserCheck: Boolean)

Override metadatas of a player item. Same thing as the give function.

ignoreUserCheck: Disable the verification that the edited metadatas are strictly user editable. Use it to customise player items.

Last updated