Skip to content

Weapon storage

Documentation relating to the jo_gunrack.

1. Installation

Be sure you installed the required dependencies :

To install jo_gunrack:

  • Drag and drop the resource into your resources folder
    • jo_gunrack
  • Add this ensure in your server.cfg
    • ensure jo_gunrack Congratulation, the Weapon storage script is ready to be used!

2. Usage

Go to one of the locations to see the weapon storage. Press the 3rd eye key to interact with it.

3. Script 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. Know issues

No such export isActive in resource ox_target

My update of ox_target is in waiting of approval by the OX team. To wait the integration in the main script, you can use my edit : ox_target.
You can find the 3 lines I added here : the pull request

5. For developers

Exports

Shared Get script configuration

exports to get the script configuration

lua
exports.jo_gunrack:getConfig()

Filters

Filters are the new way to modify data used by the script. These filters are fired at a specific point in time during the execution of the script. But contrary to events, filters are synchronous.

  • Syntax:
lua
-- @param <actionName> - name of the action
-- @param <argumentList> - list of arguments which are passed
exports.jo_gunrack:RegisterFilter(<actionName>, function(variable)
  -- Add your new data here
	return variable -- Don't forget to return the value
end)

Client Limits gun adding

Fires before the player add a weapon into the weapon storage

lua
-- @param canAdd - boolean : true if can add a weapon
-- @param gunrackId - int : unique identifier of the weapon storage
-- @param rackId - int : number of the rack where the weapon is
exports.jo_gunrack:RegisterFilter('canAddWeapon', function(canAdd, gunrackId, rackId)
	return canAdd
end)

Client Limits gun grabbing

Fires before the player takes a weapon stored in the weapon storage

lua
-- @param isOwner - boolean : true if the player is the owner of the weapon
-- @param gunrackId - int : unique identifier of the weapon storage
-- @param rackId - int : number of the rack where the weapon is
exports.jo_gunrack:RegisterFilter('canTakeWeapon', function(isOwner, gunrackId, rackId)
	return isOwner
end)

Last updated: