Page cover image

Configuration Modules

This page will outline and explain how to create a configuration module and how to configure the vehicle for its setup.


Creating a configuration module

1

Please navigate to the modules folder within the resource, which can be found at the following path. settings > modules

2

Create a new file

Now that you are in the appropriate location, please proceed to create your module file. This can be accomplished by copying and pasting the provided example file.

3

Renaming your file

Now you have a new module file, Please ensure the name of the file is the spawn code of the vehicle.

4

Vehicle Configuration

You now have a new work vehicle! Within the file you create, there are configurable variables and values that are unique to the vehicle. The details regarding this content are explained later on this page.


Tanks

This table facilitates the customization of the vehicle's foam and water tanks. Here, you can select whether the vehicle should carry water or foam, as well as specify the storage capacity for each.

---@section tanks
---@description: This table facilitates the configuration of the vehicles' foam and water tanks.
['tanks'] = {
    canCarryWater = true,
    canCarryFoam = true,

    ['water'] = {start = 1800.0, capacity = 1800.0}, ---|> Measured in liters
    ['foam'] = {start = 200.0, capacity = 200.0}, ---|> Measured in liters
},

Panel offset

This vector3 value represents the offset in which you can find the pumping panel interaction on the vehicle You can use this free ressource to help you with the vector3

---@section panelOffset
---@description: This parameter enables the configuration of the panel interaction position on the vehicle.
panelOffset = vector3(0.9, 0.5, 0.75),

Valves

This table allows for the creation and editing of the vehicles valves, These valves are section into sub tables of Intakes and discharges.

When creating an intake valve, you will be provided with two variables: label and offset. The label represents the text displayed on the pump interface, allowing for easy identification of the valve, while the offset indicates the valve's position on the vehicle.

{ 
   label = 'Pump Intake',
   offset = vector3(0.899999, 0.460000, -0.350000)
},

Misc

This table includes various functions related to the Pumping User Interfaces vehicle page. These functions have been designed to be open, allowing you to specify and configure them for your vehicles.

areLockersOpen

This function determines whether the vehicle's lockers or shutters are open, enabling the code to accurately display information on the vehicle's page. If the lockers are open, this will be reflected on the page. If this function is not configured correctly, the lockers will default to closed.

By default, the function will check for .ycd file animations, a common method used in vehicles to realistically depict the opening and closing of lockers. If your vehicle does not utilize .ycd animations, you can modify this function to check whether specific extras or doors are open. Examples are provided in the section below for further clarification.

---@param vehicle int
---@return boolean
areLockersOpen = function(vehicle)
    if not IsVehicleAConvertible(vehicle, true) then 
        return false
    end

    local state = GetConvertibleRoofState(vehicle)
    return state == 1 or state == 2 or state == 6
end

Example for vehicles that utilize .ycd animations.

---@param vehicle int
---@return boolean
areLockersOpen = function(vehicle)
    if not IsVehicleAConvertible(vehicle, true) then 
        return false
    end

    local state = GetConvertibleRoofState(vehicle)
    return state == 1 or state == 2 or state == 6
end
areEmergencyLightsOn

This function verifies whether the vehicle's emergency lights are activated. It will update the vehicle page on the pump interface to reflect the status of the lights. In the event of an error, this function will default to false.

By default, this function is integrated into z_els. If z_els is not utilized, additional examples are provided below this expandable section.

---@param vehicle int
---@return boolean | nil
areEmergencyLightsOn = function(vehicle)
    if GetResourceState('z_els') ~= 'started' then 
        return false
    end

    return exports['z_els']:is999ModeActive(vehicle)
end

Example of vehicles that utilize z_els

---@param vehicle int
---@return boolean | nil
areEmergencyLightsOn = function(vehicle)
    if GetResourceState('z_els') ~= 'started' then 
        return false
    end

    return exports['z_els']:is999ModeActive(vehicle)
end
areSceneLightsOn

This function verifies whether the vehicle's emergency lights are activated. It will update the vehicle page on the pump interface to reflect the status of the lights. In the event of an error, this function will default to false.

By default, this function is integrated into z_els. If z_els is not utilized, additional examples are provided below this expandable section.

---@param vehicle int
---@return boolean | nil
areSceneLightsOn = function(vehicle)
    if GetResourceState('z_els') ~= 'started' then 
        return false
    end

    return exports['z_els']:areSceneLightsActive(vehicleHandle)
end

Example of vehicles that utilize z_els

---@param vehicle int
---@return boolean | nil
areSceneLightsOn = function(vehicle)
    if GetResourceState('z_els') ~= 'started' then 
        return false
    end

    return exports['z_els']:areSceneLightsActive(vehicleHandle)
end
isAdvisorLightOn

This function verifies whether the vehicle's advisor lights are activated. It will update the vehicle page on the pump interface to reflect the status of the advisor. In the event of an error, this function will default to false.

By default, this function is integrated into z_els. If z_els is not utilized, additional examples are provided below this expandable section.

---@param vehicle int
---@return boolean | nil
isAdvisorLightOn = function(vehicle)
    if GetResourceState('z_els') ~= 'started' then 
        return false
    end

    return exports['z_els']:areRearRedsActive(vehicle)
end

Example of vehicles that utilize z_els

---@param vehicle int
---@return boolean | nil
isAdvisorLightOn = function(vehicle)
    if GetResourceState('z_els') ~= 'started' then 
        return false
    end

    return exports['z_els']:areRearRedsActive(vehicle)
end

Last updated