forked from Simnation/Main
348 lines
19 KiB
Lua
348 lines
19 KiB
Lua
Nabla.LogLevel = Nabla.LogLevels.WARN -- Log levels are ALL, TRACE, DEBUG, INFO, WARN, ERROR, FATAL, OFF (default is WARN)
|
|
|
|
Config = {
|
|
|
|
-- Please check our FAQ if you have any question : https://fivem.nabla.sh/faq
|
|
|
|
-- List of players who have access to the actions, set WhiteListEnabled = true/false to enable/disable the whitelist
|
|
WhiteListEnabled = true,
|
|
WhiteList = {
|
|
'ip:192.168.168.35',
|
|
'steam:12345',
|
|
'mechanic',
|
|
'mechanic:5',
|
|
'nabla.evc', -- To use with ACE, add this to your server.cfg : add_ace identifier.YOURIDENTIFIER nabla.evc allow
|
|
},
|
|
|
|
-- If true only whitelisted player can control the lights / sirens
|
|
WhiteListedControl = false,
|
|
|
|
-- Keybinds, you can choose from here : https://docs.fivem.net/docs/game-references/input-mapper-parameter-ids/
|
|
DefaultControls = function()
|
|
RegisterKeyMapping('+evc_menu', 'EVC - Menu (Hold for trailer)', 'KEYBOARD', 'F6') -- Open placement menu
|
|
RegisterKeyMapping('+evc_lights', 'EVC - Lights', 'KEYBOARD', 'LMENU') -- Enable lights
|
|
RegisterKeyMapping('+evc_siren', 'EVC - Siren', 'KEYBOARD', 'E') -- Enable sirens (holding with sirens on will trigger alternative siren, holding with sirens off will trigger horn)
|
|
RegisterKeyMapping('+evc_siren_tone', 'EVC - Siren Tone', 'KEYBOARD', 'G') -- Change the siren tone
|
|
RegisterKeyMapping('+evc_spawn_toggle', 'EVC - Spawn Toggle', 'KEYBOARD', 'F7') -- Put / Remove lights, objects and sirens
|
|
end,
|
|
|
|
-- Handle entityCreated / entityRemoved automatically, if you set this to false make sure to add :
|
|
-- TriggerServerEvent('EVC:entityCreated', NetworkGetNetworkIdFromEntity(veh)) -- When you create a vehicle and after you set it's plate
|
|
-- TriggerServerEvent('EVC:entityRemoved', NetworkGetNetworkIdFromEntity(veh)) -- When you delete a vehicle
|
|
-- Otherwise the script will not work
|
|
HandleEntityCreatedRemoved = true,
|
|
|
|
-- Allow the keybind and the menu option to toggle lights, objects and sirens from the vehicle
|
|
AllowToggle = true,
|
|
|
|
-- Should be loaded from a separate resource
|
|
Models = {
|
|
Lights = {
|
|
["FakeItemToShowOptions"] = { -- This is a fake item to show available options per light/object
|
|
WhiteList = {"mechanic"}, -- You can also set the whitelist at the object level, if nothing is specified, the global whitelist will be used. Syntax is same as global
|
|
Extras = true, -- Does this object has extras ? Default to false
|
|
Doors = true, -- Does this object has doors ? Default to false
|
|
Offset = vector3(-0.45, -0.1, 0.9), -- Offset between center of object and 3D object (for displaying 3D marker)
|
|
Collision = false, -- You can also set the collision at the object level, if nothing is specified, the global collision setting will be used
|
|
},
|
|
["D3sAmberBeacon"] = {},
|
|
["D3sAntennaAmberStr"] = {},
|
|
["D3sAntennaBlueStr"] = {},
|
|
["D3sAntennaGreenStr"] = {},
|
|
["D3sAntennaPurpleStr"] = {},
|
|
["D3sAntennaRedStr"] = {},
|
|
["D3sAntennaWhiteStr"] = {},
|
|
["D3sBBFedSigArjent"] = {},
|
|
["D3sBlueBeacon"] = {},
|
|
["D3sEdge9000A"] = {Extras = true},
|
|
["D3sEdge9000A_L"] = {Extras = true},
|
|
["D3sEdge9000B"] = {Extras = true},
|
|
["D3sEdge9000B_L"] = {Extras = true},
|
|
["D3sEdge9000G"] = {Extras = true},
|
|
["D3sEdge9000G_L"] = {Extras = true},
|
|
["D3sEdge9000P"] = {Extras = true},
|
|
["D3sEdge9000P_L"] = {Extras = true},
|
|
["D3sEdge9000R"] = {Extras = true},
|
|
["D3sEdge9000RB"] = {Extras = true},
|
|
["D3sEdge9000RB_L"] = {Extras = true},
|
|
["D3sEdge9000R_L"] = {Extras = true},
|
|
["D3sRBFedSigArjent"] = {},
|
|
["D3sRRFedSigArjent"] = {},
|
|
["D3sRedBeacon"] = {},
|
|
["D3s_DotBoard"] = {Doors = true, Extras = true},
|
|
["D3s_MiniP_A"] = {Extras = true},
|
|
["D3s_MiniP_B"] = {Extras = true},
|
|
["D3s_MiniP_G"] = {Extras = true},
|
|
["D3s_MiniP_P"] = {Extras = true},
|
|
["D3s_MiniP_R"] = {Extras = true},
|
|
["D3s_OneGuard_A"] = {Extras = true},
|
|
["D3s_OneGuard_AA"] = {Extras = true},
|
|
["D3s_OneGuard_AW"] = {Extras = true},
|
|
["D3s_OneGuard_B"] = {Extras = true},
|
|
["D3s_OneGuard_BB"] = {Extras = true},
|
|
["D3s_OneGuard_BW"] = {Extras = true},
|
|
["D3s_OneGuard_G"] = {Extras = true},
|
|
["D3s_OneGuard_GG"] = {Extras = true},
|
|
["D3s_OneGuard_GW"] = {Extras = true},
|
|
["D3s_OneGuard_P"] = {Extras = true},
|
|
["D3s_OneGuard_PP"] = {Extras = true},
|
|
["D3s_OneGuard_PW"] = {Extras = true},
|
|
["D3s_OneGuard_R"] = {Extras = true},
|
|
["D3s_OneGuard_RB"] = {Extras = true},
|
|
["D3s_OneGuard_RW"] = {Extras = true},
|
|
["D3s_OneGuard_W"] = {Extras = true},
|
|
["D3s_RetroHighwayRiser"] = {Animation = true},
|
|
["D3s_S_Series_BB"] = {Extras = true},
|
|
["D3s_S_Series_RB"] = {Extras = true},
|
|
["D3s_S_Series_RR"] = {Extras = true},
|
|
["D3s_SideRunners_A"] = {Extras = true},
|
|
["D3s_SideRunners_B"] = {Extras = true},
|
|
["D3s_SideRunners_G"] = {Extras = true},
|
|
["D3s_SideRunners_P"] = {Extras = true},
|
|
["D3s_SideRunners_R"] = {Extras = true},
|
|
["D3s_SideRunners_RB"] = {Extras = true},
|
|
["D3s_XR2000_AA"] = {Extras = true},
|
|
["D3s_XR2000_BB"] = {Extras = true},
|
|
["D3s_XR2000_GG"] = {Extras = true},
|
|
["D3s_XR2000_PP"] = {Extras = true},
|
|
["D3s_XR2000_RB"] = {Extras = true},
|
|
["D3s_XR2000_RR"] = {Extras = true},
|
|
["WhelenAmberBeacon"] = {},
|
|
["WhelenBlueBeacon"] = {},
|
|
["WhelenGreenBeacon"] = {},
|
|
["WhelenRedBeacon"] = {},
|
|
["fbiold"] = {Offset = vector3(-0.45, -0.1, 0.9)},
|
|
["lightbarTwoSticks"] = {Offset = vector3(0.0, 0.45, 0.65)},
|
|
["longLightbar"] = {Offset = vector3(0.35, -1.15, 0.75)},
|
|
["longLightbarRed"] = {Offset = vector3(0.35, -1.15, 0.75)},
|
|
},
|
|
|
|
Objects = {
|
|
["D3sConeStackV1"] = {},
|
|
["D3sConeStackV2"] = {},
|
|
["D3sLadderRack"] = {},
|
|
["D3sToolboxV1"] = {},
|
|
["D3sWinchV1"] = {},
|
|
["D3s_AntennaBlack"] = {},
|
|
["D3s_AntennaLowProfile"] = {},
|
|
["D3s_AntennaSLVBLK"] = {},
|
|
["D3s_BedRack"] = {Extras = true},
|
|
["D3s_PartitionCage"] = {},
|
|
["D3s_PlateReaderV1"] = {},
|
|
["D3s_PushGuard_S"] = {},
|
|
["D3s_Pushbar_L"] = {},
|
|
["D3s_SirenV1"] = {},
|
|
["D3s_TruckRack"] = {},
|
|
},
|
|
},
|
|
|
|
-- List of native vehicles on which lights are controled using EVC
|
|
-- Has less priority than configs saved by model, plate ...
|
|
-- Remove from list to disable control by EVC
|
|
NativeVehiclesHash = {
|
|
["ambulance"] = {lights = {}, objects = {}, sirens = {AlternativeTones = {"VEHICLES_HORNS_AMBULANCE_WARNING"}, Tones = {"RESIDENT_VEHICLES_SIREN_WAIL_02"}}},
|
|
["fbi"] = {lights = {}, objects = {}, sirens = {AlternativeTones = {"VEHICLES_HORNS_POLICE_WARNING"}, Tones = {"RESIDENT_VEHICLES_SIREN_WAIL_02"}}},
|
|
["fbi2"] = {lights = {}, objects = {}, sirens = {AlternativeTones = {"VEHICLES_HORNS_POLICE_WARNING"}, Tones = {"RESIDENT_VEHICLES_SIREN_WAIL_02"}}},
|
|
["firetruk"] = {lights = {}, objects = {}, sirens = {AlternativeTones = {"VEHICLES_HORNS_FIRETRUCK_WARNING"}, Tones = {"RESIDENT_VEHICLES_SIREN_FIRETRUCK_WAIL_01"}}},
|
|
["lguard"] = {lights = {}, objects = {}, sirens = {AlternativeTones = {"VEHICLES_HORNS_POLICE_WARNING"}, Tones = {"VEHICLES_HORNS_SIREN_1"}}},
|
|
["police"] = {lights = {}, objects = {}, sirens = {AlternativeTones = {"VEHICLES_HORNS_POLICE_WARNING"}, Tones = {"VEHICLES_HORNS_SIREN_1"}}},
|
|
["police2"] = {lights = {}, objects = {}, sirens = {AlternativeTones = {"VEHICLES_HORNS_POLICE_WARNING"}, Tones = {"VEHICLES_HORNS_SIREN_1"}}},
|
|
["police3"] = {lights = {}, objects = {}, sirens = {AlternativeTones = {"VEHICLES_HORNS_POLICE_WARNING"}, Tones = {"VEHICLES_HORNS_SIREN_1"}}},
|
|
["police4"] = {lights = {}, objects = {}, sirens = {AlternativeTones = {"VEHICLES_HORNS_POLICE_WARNING"}, Tones = {"VEHICLES_HORNS_SIREN_1"}}},
|
|
["policeb"] = {lights = {}, objects = {}, sirens = {AlternativeTones = {"VEHICLES_HORNS_POLICE_WARNING"}, Tones = {"RESIDENT_VEHICLES_SIREN_QUICK_03"}}},
|
|
["policeold1"] = {lights = {}, objects = {}, sirens = {AlternativeTones = {"VEHICLES_HORNS_POLICE_WARNING"}, Tones = {"VEHICLES_HORNS_SIREN_1"}}},
|
|
["policeold2"] = {lights = {}, objects = {}, sirens = {AlternativeTones = {"VEHICLES_HORNS_POLICE_WARNING"}, Tones = {"VEHICLES_HORNS_SIREN_1"}}},
|
|
["policet"] = {lights = {}, objects = {}, sirens = {AlternativeTones = {"VEHICLES_HORNS_POLICE_WARNING"}, Tones = {"VEHICLES_HORNS_SIREN_1"}}},
|
|
["pranger"] = {lights = {}, objects = {}, sirens = {AlternativeTones = {"VEHICLES_HORNS_POLICE_WARNING"}, Tones = {"VEHICLES_HORNS_SIREN_1"}}},
|
|
["riot"] = {lights = {}, objects = {}, sirens = {AlternativeTones = {"VEHICLES_HORNS_POLICE_WARNING"}, Tones = {"VEHICLES_HORNS_SIREN_1"}}},
|
|
["riot2"] = {lights = {}, objects = {}, sirens = {AlternativeTones = {"VEHICLES_HORNS_POLICE_WARNING"}, Tones = {"VEHICLES_HORNS_SIREN_1"}}},
|
|
["sheriff"] = {lights = {}, objects = {}, sirens = {AlternativeTones = {"VEHICLES_HORNS_POLICE_WARNING"}, Tones = {"VEHICLES_HORNS_SIREN_1"}}},
|
|
["sheriff2"] = {lights = {}, objects = {}, sirens = {AlternativeTones = {"VEHICLES_HORNS_POLICE_WARNING"}, Tones = {"RESIDENT_VEHICLES_SIREN_WAIL_03"}}},
|
|
},
|
|
|
|
-- Maximum number of lights / objects per vehicle
|
|
Max = {
|
|
Lights = 10,
|
|
Objects = 10,
|
|
},
|
|
|
|
-- Enable or disable collsions on spawned objects / lights (turning this on can lead to weird behavior)
|
|
EnableCollision = false,
|
|
|
|
-- Spawned object are invicible
|
|
Invincible = false,
|
|
|
|
-- If true lights must be on for sirens to work
|
|
SirenNeedLights = false,
|
|
|
|
-- Audio banks
|
|
AudioBanks = {
|
|
"DLC_WMSIRENS\\SIRENPACK_ONE",
|
|
},
|
|
|
|
-- Range of the sirens
|
|
SirenRange = 200.0,
|
|
|
|
-- Anything can be added / removed to your likings
|
|
SirenTones = {
|
|
-- { -- This is a fake siren to show available options per siren
|
|
-- label = "label", -- Label for checkbox item
|
|
-- description = "description", -- Description for checkbox item
|
|
-- hash = "FAKE_SIREN_TO_SHOW_OPTIONS", -- API Hash of siren for PlaySoundFromEntity
|
|
-- ref = 0, -- API ref of siren for PlaySoundFromEntity
|
|
-- WhiteList = {}, -- You can also set the whitelist at the object level, if nothing is specified, the global whitelist will be used. Syntax is same as global
|
|
-- },
|
|
{hash = "SIRENS_AIRHORN", label = "AirHorn", description = "Add this siren", ref = 0},
|
|
{hash = "VEHICLES_HORNS_SIREN_1", label = "Horns 1", description = "Add this siren", ref = 0},
|
|
{hash = "VEHICLES_HORNS_SIREN_2", label = "Horns 2", description = "Add this siren", ref = 0},
|
|
{hash = "VEHICLES_HORNS_POLICE_WARNING", label = "Police Warning", description = "Add this siren", ref = 0},
|
|
{hash = "RESIDENT_VEHICLES_SIREN_WAIL_01", label = "Wail 1", description = "Add this siren", ref = 0},
|
|
{hash = "RESIDENT_VEHICLES_SIREN_WAIL_02", label = "Wail 2", description = "Add this siren", ref = 0},
|
|
{hash = "RESIDENT_VEHICLES_SIREN_WAIL_03", label = "Wail 3", description = "Add this siren", ref = 0},
|
|
{hash = "RESIDENT_VEHICLES_SIREN_QUICK_01", label = "Quick 1", description = "Add this siren", ref = 0},
|
|
{hash = "RESIDENT_VEHICLES_SIREN_QUICK_02", label = "Quick 2", description = "Add this siren", ref = 0},
|
|
{hash = "RESIDENT_VEHICLES_SIREN_QUICK_03", label = "Quick 3", description = "Add this siren", ref = 0},
|
|
{hash = "VEHICLES_HORNS_AMBULANCE_WARNING", label = "Ambulance", description = "Add this siren", ref = 0},
|
|
{hash = "VEHICLES_HORNS_FIRETRUCK_WARNING", label = "Firetruck", description = "Add this siren", ref = 0},
|
|
{hash = "RESIDENT_VEHICLES_SIREN_FIRETRUCK_WAIL_01", label = "Firetruck wail 1", description = "Add this siren", ref = 0},
|
|
{hash = "RESIDENT_VEHICLES_SIREN_FIRETRUCK_QUICK_01", label = "Firetruck wail 2", description = "Add this siren", ref = 0},
|
|
|
|
-- Custom sirens (from https://github.com/Walsheyy/WMServerSirens)
|
|
{hash = "SIREN_ALPHA", label = "Custom Alpha", description = "Add this siren", ref = "DLC_WMSIRENS_SOUNDSET"},
|
|
{hash = "SIREN_BRAVO", label = "Custom Bravo", description = "Add this siren", ref = "DLC_WMSIRENS_SOUNDSET"},
|
|
{hash = "SIREN_CHARLIE", label = "Custom Charlie", description = "Add this siren", ref = "DLC_WMSIRENS_SOUNDSET"},
|
|
{hash = "SIREN_DELTA", label = "Custom Delta", description = "Add this siren", ref = "DLC_WMSIRENS_SOUNDSET"},
|
|
{hash = "SIREN_ECHO", label = "Custom Echo", description = "Add this siren", ref = "DLC_WMSIRENS_SOUNDSET"},
|
|
{hash = "SIREN_FOXTROT", label = "Custom Foxtrot", description = "Add this siren", ref = "DLC_WMSIRENS_SOUNDSET"},
|
|
{hash = "SIREN_GOLF", label = "Custom Golf", description = "Add this siren", ref = "DLC_WMSIRENS_SOUNDSET"},
|
|
{hash = "SIREN_HOTEL", label = "Custom Hotel", description = "Add this siren", ref = "DLC_WMSIRENS_SOUNDSET"},
|
|
},
|
|
|
|
-- Placement sensitivity (step)
|
|
Sensitivity = {
|
|
Tx = {0.01, 0.1, 1.0}, -- Translation
|
|
Rx = {1.0, 10.0, 45.0}, -- Rotation
|
|
},
|
|
|
|
-- Range during placement
|
|
Range = {
|
|
Tx = 10.0, -- Translation
|
|
Rx = 180.0, -- Rotation
|
|
},
|
|
|
|
-- Function to customize the menus
|
|
Customize = function(menu)
|
|
menu:SetBannerRectangle(NativeUI.CreateRectangle(0, 0, 0, 0, 122, 32, 20, 255.0))
|
|
end,
|
|
|
|
-- Disable lights / siren when leaving the vehicle, will NOT turn back on when entering
|
|
TurnOffOnExit = {
|
|
Sirens = false,
|
|
Lights = false,
|
|
},
|
|
|
|
-- Should a notif be sent if a user press a keybind but no vehicle is in range ?
|
|
NoVehNotif = false,
|
|
|
|
-- Save per model, per plate, per user+plate or per name ?
|
|
-- Per name is not loaded automatically, you have to go in the menu and enter the template name you want to load
|
|
-- Tip 1 : To disable server save, set all to false
|
|
-- Tip 2 : Priority is : UUID > Plate > Model, meaning you can override the model settings by saving per plate
|
|
SavePerModel = true,
|
|
SavePerPlate = true,
|
|
SavePerUUID = true,
|
|
GenerateUUID = function(identifier, vehicle)
|
|
return identifier..":"..GetVehicleNumberPlateText(vehicle)
|
|
end,
|
|
SavePerName = true,
|
|
|
|
-- Spawn objects / lights only if player is whitelisted
|
|
SpawnOnlyIfWhiteListed = false,
|
|
|
|
-- Translations
|
|
Strings = {
|
|
['no_veh'] = 'No vehicle nearby',
|
|
['open_veh'] = 'Open menu for this vehicle',
|
|
['saved'] = '~g~Saved !~w~',
|
|
['clear'] = '~g~Config cleared !~w~',
|
|
['error'] = '~r~Error !~w~',
|
|
|
|
-- Main menu
|
|
['open'] = {'Press your keybind to open the Nabla\'s Emergency Vehicle Creator'},
|
|
['toggle'] = {'Toggle lights, objects and sirens', 'Toggle the spawn of entities and siren, can also be toggled with the "EVC - Spawn Toggle" button'},
|
|
['passenger_control'] = {'Passenger control', 'Allow passengers to control the lights / sirens'},
|
|
['save'] = {'Save config by', 'Choose how the config will be saved and loaded to the car'},
|
|
['save_model'] = 'Model',
|
|
['save_plate'] = 'Plate',
|
|
['save_uuid'] = 'UUID',
|
|
['save_name'] = 'Name',
|
|
['load_name'] = {'Load by name', 'Load a config by using a custom name'},
|
|
|
|
-- Lights / Objects
|
|
['add_edit'] = {
|
|
["Objects"] = "Add, edit and remove equipements on this vehicle",
|
|
["Lights"] = "Add, edit and remove lights on this vehicle",
|
|
},
|
|
["Lights"] = "Lights",
|
|
["Objects"] = "Equipements",
|
|
["spawn"] = {"Spawn", "Select the model you wish to spawn"},
|
|
["select"] = {"Selected", "Select the element you wish to move"},
|
|
["mirror"] = {"Mirror from", "Will copy the position and orientation from this element onto the selected one"},
|
|
["tspeed"] = {"Translation Speed", "Select translation speed"},
|
|
["rspeed"] = {"Rotation Speed", "Select rotation speed"},
|
|
["tx"] = {"X", "Move left / right"},
|
|
["ty"] = {"Y", "Move front / rear"},
|
|
["tz"] = {"Z", "Move up / down"},
|
|
["rx"] = {"Pitch", "Rotate around X"},
|
|
["ry"] = {"Roll", "Rotate around Y"},
|
|
["rz"] = {"Yaw", "Rotate around Z"},
|
|
["del"] = {"Delete", "Remove this element (remember to save)"},
|
|
["ext"] = {"Extras", "Enable / disable extras"},
|
|
["doors"] = {"Doors", "Open / close doors"},
|
|
["livery"] = {"Livery", "Select the livery"},
|
|
|
|
-- Sirens
|
|
["sirens"] = {"Sirens", "Add and remove sirens on this vehicle"},
|
|
["altsiren"] = {"Alternative Siren", "Choose the siren that will be played when holding the siren button"},
|
|
},
|
|
|
|
|
|
-- Can the menu be opened from anywhere ? If set to false, add markers below
|
|
MenuOpenAnyWhere = true,
|
|
Markers = {
|
|
vector3(-2097.81, 2655.79, 2.44),
|
|
},
|
|
|
|
-- Distance to show markers, help text...
|
|
DrawMarkerDistance = 50.0,
|
|
DrawTextDistance = 2.0,
|
|
|
|
-- Function for drawing markers
|
|
DrawMarker = function(pos)
|
|
DrawMarker(2, pos.x, pos.y, pos.z, 0.0, 0.0, 0.0, 0, 0.0, 0.0, 1.5, 1.5, 1.5, 255, 176, 39, 100, false, true, 2, true, false, false, false)
|
|
end,
|
|
}
|
|
|
|
table.sort(Config.SirenTones, function(a,b) return a.label < b.label end)
|
|
|
|
local prev = nil
|
|
function ShowNotification(message)
|
|
if prev ~= nil then
|
|
RemoveNotification(prev)
|
|
end
|
|
AddTextEntry(GetCurrentResourceName().."Notif", Config.Strings[message])
|
|
BeginTextCommandThefeedPost(GetCurrentResourceName().."Notif")
|
|
prev = EndTextCommandThefeedPostTicker(false, false)
|
|
end
|
|
|
|
function DisplayHelpText(lineOne, lineTwo, lineThree)
|
|
BeginTextCommandDisplayHelp("THREESTRINGS")
|
|
AddTextComponentSubstringPlayerName(lineOne)
|
|
AddTextComponentSubstringPlayerName(lineTwo or "")
|
|
AddTextComponentSubstringPlayerName(lineThree or "")
|
|
EndTextCommandDisplayHelp(0, 0, 0, -1)
|
|
end
|
|
Config.NativeVehicles = {}
|
|
for k,v in pairs(Config.NativeVehiclesHash) do
|
|
Config.NativeVehicles[tostring(GetHashKey(k))] = v
|
|
end
|