Koja Scripts
NEW

Server Exports

Exports implemented in the script

Server Exports

1. exports('ToggleShop', function(shopId, disabled)

Description:
This function is used to toggle the availability of a shop. By passing a shopId and a boolean disabled parameter, you can enable or disable a shop on your server.

  • Arguments:
    • shopId (string): The unique identifier for the shop you want to enable or disable. Example: 'shop_1', 'shop_2'.
    • disabled (boolean): A flag that determines whether the shop should be enabled or disabled:
      • true – disables the shop.
      • false – enables the shop.
exports['koja-shops']:ToggleShop('shop_1', true)   -- Disables shop with ID 'shop_1'
exports['koja-shops']:ToggleShop('shop_2', false)  -- Enables shop with ID 'shop_2'

2. exports('ToggleProduct', function(shopId, productId, disabled)

Description:
This function is used to toggle the availability of a specific product within a shop. By passing a shopId, a productId, and a boolean disabled parameter, you can enable or disable specific products for sale in a shop.

  • Arguments:
    • shopId (string): The unique identifier for the shop where the product is located (e.g., 'shop_1', 'shop_2').
    • productId (string): The unique identifier for the product you want to enable or disable (e.g., 'garden_shovel', 'fishing_rod').
    • disabled (boolean): A flag that determines whether the product should be enabled or disabled:
      • true – disables the product.
      • false – enables the product.
exports['koja-shops']:ToggleProduct('shop_1', 'garden_shovel', true)  -- Disables product 'garden_shovel' in 'shop_1'
exports['koja-shops']:ToggleProduct('shop_1', 'burger', false)       -- Enables product 'burger' in 'shop_1'
  • Changing Language — Explanation of the locale configuration in the script
  • Target — Target Configuration
  • Adding a Shop — How to Add New Shops
  • SQL — SQL file needed when automatic database creation does not work properly
  • Configuration — back to the section overview