Codex Studios
Visit our Tebex StoreOur Discord
  • ๐Ÿ‘‹Welcome to Codex Studios
  • Overview
    • ๐Ÿ’กAbout Us
    • โœจOur Features
  • ๐Ÿ’…RedM-Scripts
    • ๐ŸŒ[Codex Studios] : Core
      • Client Side
      • Server Side - CodexCore API
      • Config
      • ๐Ÿ“ Client Side (clientside.lua)
      • ๐Ÿงพ Server Side (serverside.lua)
      • ๐Ÿ›ก๏ธCodexCore Security Module
      • ๐Ÿ—’๏ธSecurity Detailed Explanation
      • ๐Ÿ”Client-Side: Securing Event Triggers
      • ๐Ÿ”’Server-Side: Securing Event Triggers
    • ๐Ÿ’ช[Codex Studios] : Trust Level
      • Client Side
      • Config
      • SQL
  • ๐Ÿ“ฆ[Codex Studios]: Supplies System
    • Client Side
    • Server-Side Town Supplies
    • Config
    • ๐Ÿช›Examples and Commands
    • Sql Updated
Powered by GitBook
On this page

Was this helpful?

  1. [Codex Studios]: Supplies System

Server-Side Town Supplies

The server-side code for managing town supplies is responsible for interacting with the database, fetching town data, and handling requests from clients. This allows town supplies to be adjusted, updated, and broadcasted to all connected clients. Below is the full breakdown, examples, and guidelines for developers using the server-side functionality.

๐Ÿ“ Correct Usage for Developers

To use the server-side functionality correctly, follow these key steps:

  1. Triggering Events:

    • Ensure you are calling the correct event for fetching town supplies:

      TriggerServerEvent('codex-studios-supplies:city_supplies')
    • You can fetch town supplies via the event codex-studios-supplies:city_supplies_refetch to refresh the data at any point:

      TriggerServerEvent('codex-studios-supplies:city_supplies_refetch')
  2. Removing Supplies:

    • To remove supplies from a town (e.g., after an event like a raid):

      TriggerServerEvent('codex-studios-supplies:city_removesupplies', "town_name")
  3. Resupplying a Town:

    • Use the resupply event when a town needs to be resupplied:

      TriggerServerEvent('codex-studios-supplies:city_resupplies', "town_name") 

๐Ÿšซ Incorrect Usage Examples

  1. Missing Town Parameter:

    • If you fail to provide the town parameter, the function will return an error:

      TriggerEvent('codex-studios-supplies:city_removesupplies', nil) -- This will not work
  2. Using Incorrect Event Names:

    • Calling events with wrong names will fail:

      TriggerEvent('wrong_event_name') -- This will not trigger the correct function
PreviousClient SideNextConfig

Last updated 1 month ago

Was this helpful?

๐Ÿ“ฆ