Skip to content

👔 Mannequin

Documentation relating to the jo_clothingstore_mannequin add-on for Clothing store script.

1. Installation

WARNING

Clothing store script is required to use this add-on.

To install jo_clothingstore_mannequin:

  • Drag and drop the resource into your resources folder: jo_clothingstore_mannequin
  • Add this ensure in your server.cfg after ensure jo_clothingstore:
    • ensure jo_clothingstore_mannequin

Congratulations, the Mannequin add-on is ready to be used!

2. Usage

The Mannequin add-on lets players sell outfits through persistent mannequins placed in the world. It is an add-on of jo_clothingstore: before a seller can sell an outfit from a mannequin, they must first create and save at least one male or female outfit from the clothing store or wardrobe outfit menu. Mannequins can also be saved without an outfit.

The Premade Outfits add-on can help sellers create outfits faster by buying ready-made outfits and saving them into their clothing-store outfit list before using them on mannequins.

3. Configuration

The configuration file is config.lua in the resource root. Do not edit this file directly as your changes may be lost during updates. Instead, use overwriteConfig.lua to store your customizations.

  • config.lua - Default configuration maintained by developers. Do not modify this file.
  • overwriteConfig.lua - This is where you place only the values you want to override.

How to customize the configuration

  1. Open /overwriteConfig.lua
  2. Find the value you want to change in config.lua (e.g., Config.language )
  3. Copy only that line into overwriteConfig.lua
  4. Edit the copied value to your liking

The script loads config.lua first, then overwriteConfig.lua overwrites only the values you redefine. This ensures your customizations are preserved when updating the script.

Loading configuration...

4. For developers

Actions

Actions are one of the two types of Hooks. They provide a way to run a function at a specific point in the execution of scripts. Callback functions for an Action do not return anything back to the calling Action hook. They are the counterpart to Filters.

Below is a complete list of all available actions in the jo_clothingstore_mannequin script.

Shared init

Triggered when the add-on is initialized after jo_clothingstore starts.

lua
exports.jo_clothingstore_mannequin:registerAction("init", function()
    -- Your code here
end)

Server mannequinCreated

Triggered after a mannequin is created and synchronized to clients.

lua
-- @param source - integer server ID of the creator
-- @param mannequin - Mannequin created mannequin instance
exports.jo_clothingstore_mannequin:registerAction("mannequinCreated", function(source, mannequin)
    -- Your code here
end)

Server mannequinDeleted

Triggered after a mannequin is deleted and removed from clients.

lua
-- @param source - integer server ID of the owner
-- @param mannequinId - integer deleted mannequin ID
exports.jo_clothingstore_mannequin:registerAction("mannequinDeleted", function(source, mannequinId)
    -- Your code here
end)

Server mannequinUpdated

Triggered after a mannequin is updated and synchronized to clients.

lua
-- @param source - integer server ID of the editor
-- @param mannequin - Mannequin updated mannequin instance
exports.jo_clothingstore_mannequin:registerAction("mannequinUpdated", function(source, mannequin)
    -- Your code here
end)

Server outfitBought

Triggered after an outfit is purchased from a mannequin.

lua
-- @param source - integer server ID of the buyer
-- @param mannequin - Mannequin purchased mannequin instance
-- @param outfit - table outfit data
-- @param fullPrice - PriceGroupClass full mannequin price group
exports.jo_clothingstore_mannequin:registerAction("outfitBought", function(source, mannequin, outfit, fullPrice)
    -- Your code here
end)

Server outfitItemGiven

Triggered after a purchase gives the buyer an outfit item.

lua
-- @param source - integer server ID of the buyer
-- @param mannequin - Mannequin purchased mannequin instance
-- @param itemName - string outfit item name
-- @param metadata - table item metadata containing outfit, name, sexe, and description
exports.jo_clothingstore_mannequin:registerAction("outfitItemGiven", function(source, mannequin, itemName, metadata)
    -- Your code here
end)

Server salesCollected

Triggered after the owner collects stored mannequin sales.

lua
-- @param source - integer server ID of the owner
-- @param mannequin - Mannequin mannequin instance after stored sales are cleared
-- @param priceToRefund - PriceClass price refunded to the owner
exports.jo_clothingstore_mannequin:registerAction("salesCollected", function(source, mannequin, priceToRefund)
    -- Your code here
end)

Server sellerRevenueStored

Triggered after a purchase stores revenue on the seller's mannequin.

lua
-- @param source - integer server ID of the buyer
-- @param mannequin - Mannequin purchased mannequin instance
-- @param revenuePrice - PriceClass price stored for the seller
-- @param price - PriceClass price paid by the buyer
-- @param priceIndex - integer selected price index
exports.jo_clothingstore_mannequin:registerAction("sellerRevenueStored", function(source, mannequin, revenuePrice, price, priceIndex)
    -- Your code here
end)

Filters

Filters allow you to modify data or permissions synchronously at specific points in the script. Below is the complete list of jo_clothingstore_mannequin filters and how to use them.

Server canBuyOutfit

Control whether a player can buy an outfit from a mannequin. This filter is called after the selected price has been resolved and before the player is charged.

lua
-- @param canBuy - boolean (default true)
-- @param source - integer server ID of the buyer
-- @param mannequin - Mannequin purchased mannequin instance
-- @param price - PriceClass selected price
-- @param priceIndex - integer selected price index
exports.jo_clothingstore_mannequin:registerFilter("canBuyOutfit", function(canBuy, source, mannequin, price, priceIndex)
    return canBuy
end)

Server canCollectSales

Control whether the mannequin owner can collect stored sales.

lua
-- @param canCollect - boolean (default true)
-- @param source - integer server ID of the owner
-- @param mannequin - Mannequin mannequin instance
exports.jo_clothingstore_mannequin:registerFilter("canCollectSales", function(canCollect, source, mannequin)
    return canCollect
end)

Server canCreateMannequin

Control whether a player can create a mannequin. This filter is called after the mannequin owner, sex, limit, and price have been validated.

lua
-- @param canCreate - boolean (default true)
-- @param source - integer server ID of the creator
-- @param mannequin - Mannequin mannequin instance being created
exports.jo_clothingstore_mannequin:registerFilter("canCreateMannequin", function(canCreate, source, mannequin)
    return canCreate
end)

Server canDeleteMannequin

Control whether a player can delete a mannequin.

lua
-- @param canDelete - boolean (default true)
-- @param source - integer server ID of the owner
-- @param mannequin - Mannequin mannequin instance being deleted
exports.jo_clothingstore_mannequin:registerFilter("canDeleteMannequin", function(canDelete, source, mannequin)
    return canDelete
end)

Server canUpdateMannequin

Control whether a player can update a mannequin. This filter is called after ownership, sex, and price validation.

lua
-- @param canUpdate - boolean (default true)
-- @param source - integer server ID of the editor
-- @param existing - Mannequin current persisted mannequin instance
-- @param incoming - table incoming mannequin data
exports.jo_clothingstore_mannequin:registerFilter("canUpdateMannequin", function(canUpdate, source, existing, incoming)
    return canUpdate
end)

Server canUseMannequinMenuCommand

Control whether a player can use the mannequin menu command.

lua
-- @param canUse - boolean (default true)
-- @param source - integer server ID of the player
exports.jo_clothingstore_mannequin:registerFilter("canUseMannequinMenuCommand", function(canUse, source)
    return canUse
end)

Server overwriteBuyerPrice

Override the selected price before the buyer is charged. The second argument is the order type and is "mannequinOutfit" for Mannequin purchases.

lua
-- @param price - PriceClass selected price
-- @param typeOrder - string "mannequinOutfit"
-- @param source - integer server ID of the buyer
-- @param mannequin - Mannequin purchased mannequin instance
-- @param priceIndex - integer selected price index
exports.jo_clothingstore_mannequin:registerFilter("overwriteBuyerPrice", function(price, typeOrder, source, mannequin, priceIndex)
    return price
end)

Server overwriteSellerRevenue

Override the amount stored for the mannequin owner after a sale. By default, the stored revenue matches the buyer price, except item costs marked with keep = true.

WARNING

The price argument is the buyer price after overwriteBuyerPrice has already been applied. If you use overwriteBuyerPrice to change what the buyer pays, overwriteSellerRevenue receives that updated buyer price.

Return nil to prevent storing seller revenue for this purchase.

lua
-- @param revenuePrice - PriceClass|nil default seller revenue
-- @param source - integer server ID of the buyer
-- @param mannequin - Mannequin purchased mannequin instance
-- @param price - PriceClass price paid by the buyer
-- @param priceIndex - integer selected price index
exports.jo_clothingstore_mannequin:registerFilter("overwriteSellerRevenue", function(revenuePrice, source, mannequin, price, priceIndex)
    return revenuePrice
end)

Last updated: