Skip to content

Commands / Exports / Events

To unlock the full potential of the Grew esxAddon, this page provides an overview of the available commands and exports.
It is recommended to include the script as required in the fxmanifest.lua to ensure that exports are loaded smoothly and
available in all server-side files, allowing the addon to interact seamlessly with other server functions.

dependency {
'grew_esxAddon'
}

If you have any questions about setting up or using the script, feel free to reach out. You can contact us via email or in the support channel on our Discord.

Commands

removeitem <playerId> <item> <count>

Description This command removes the specified quantity of an item from the specified user. The command requires:

  • playerId: The ID of the player from whom the item will be removed.
  • item: The item to be removed.
  • count: The quantity of the item to remove.

Example This example removes 3 units of “bread” from the player with ID 1: /removeitem 1 bread 3

Requirements
  • Permissions: Only available to users with mod permissions.
  • Player Online: The player must be online for the command to execute successfully.
Notes

removeweapon <playerId> <weapon>

Description This command removes the specified weapon from the specified user. The command requires:

  • playerId: The ID of the player from whom the weapon will be removed.
  • weapon: The weapon to be removed (use the exact weapon name as listed in the database).

Example This example removes the weapon “weapon_pistol” from the player with ID 1: /removeweapon 1 weapon_pistol

Requirements
  • Permissions: Only available to users with mod permissions.
  • Player Online: The player must be online for the command to execute successfully.
Notes

Exports

The following exports are available exclusively on the server side and can be used in all server-side files.

getAllItems

Description Returns a list of all items from the database.

Example This example retrieves all items from the database:

local allItems = exports["grew_esxAddon"]:getAllItems()

getAllJobs

Description Returns a list of all jobs from the database.

Example This example retrieves all jobs from the database:

local allJobs = exports["grew_esxAddon"]:getAllJobs()

getAllRanks

Description Returns a list of all ranks from the database.

Example This example retrieves all ranks from the database:

local allRanks = exports["grew_esxAddon"]:getAllRanks()

getAllLicenses

Description Returns a list of all licenses from the database.

Example This example retrieves all licenses from the database:

local allLicenses = exports["grew_esxAddon"]:getAllLicenses()

Events

triggerSyncServerCallback

Description This event triggers a synchronous callback on the server side. It waits for the callback to return a response before continuing the code execution.
Useful for cases where you need a response from the server before proceeding with additional logic on the client side.

Example This example calls triggerSyncServerCallback to retrieve data from the server, waiting until a response is received:

local result = exports["grew_esxAddon"]:triggerSyncServerCallback("exampleEvent", 1, "param1", "param2")
if result then
print("Server callback completed successfully!")
else
print("Server callback failed or timed out.")
end

triggerSyncClientCallback

Description This event triggers a synchronous callback on the client side.
It waits for a response from the client before continuing execution on the server side, which is helpful in cases where server logic relies on client feedback.

Example This example uses triggerSyncClientCallback to send a request from the server to the client, with a timeout mechanism in case of a delay:

local clientResult = triggerSyncClientCallback("exampleClientEvent", 1, "paramA", "paramB")
if clientResult then
print("Client callback returned data successfully!")
else
print("Client callback failed or timed out.")
end