Hooks

Available hooks for AShop

I don't define every definition every time, if you don't find the definition for a variable, check in definitions above.

Don't ever return a value in these hooks. This is useless, and will block the correct behavior of the addon.

🟩 ashop_unequip(PLAYER, SLOT_ID: Integer, PLY_ITEM: Table, ITEM: Table)

Called when a player unequip item.

PLAYER: The player object.

PLY_ITEM: Data of the player item, not the item itself. How much player spent to buy the item, when he bought it, what is his sql id, metadatas related to his item.

ITEM: The item data.

SLOT_ID: On which slot he tries to equip the item.

🟩 ashop_equipStateChange(PLAYER, free_slot: Integer{0, 1}, ply_item_id: Integer, old_item_equipped: Table or nil)

free_slot is either 1, or 0.

ply_item_id is the SQL ID of the ply_item table. You can do that: ply.ashop_data.items[ply_item_id] to retrieve the ply_item table.

old_item_equipped, same as ply_item_id, but for the previous item the player had on this slot.

🟩 ashop_equip(PLAYER, SLOT_ID: Integer, ITEM: Table, PLY_ITEM: Table)

When someone equips an item.

🟩 ashop_load(STATE: Integer)

When AShop changed in a new state:

State == 0: Autorun trigger, this is run right after every file were included. Called in shared.

State == 1: After AShop created SQL tables/ SQL tables are existing. Called in server.

State == 2: Everything loaded, every SQL data (items, renders, etc ... ) are good to use. Called in server.

🟧 ashop_playersync()

After a player received his AShop data. ONLY EQUIPPED ITEMS ARE LOADED AT THIS HOOK ! For optimisations purposes.

🟧 Ashop_PlayerNewItem(ply_item_id: Integer, PLY_ITEM: Table, ITEM: Table)

Player has a new item in his inventory. When he bought a new item, etc...

🟧 ashop_itemnew(item_id: Integer, ITEM: Table)

Player received the data of an item. THIS IS NOT WHEN HE RECEIVED A NEW ITEM IN INVENTORY. You most likely shouldn't use this hook, this is not the one you are looking for.

🟦 ashop_playerbuy(PLAYER, ply_item_id: Integer, item_id: Integer)

When someone buy something.

🟦 ashop_playerInit(PLAYER)

When the player data is loaded. He set as ready right after this hook.

Last updated