-
Notifications
You must be signed in to change notification settings - Fork 3
/
config.lua
426 lines (411 loc) · 20.5 KB
/
config.lua
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
Config = {}
-- Debugging mode
Config.DebugMode = true
Config.ShowNotifications = true
-- Optimal configuration for debugging
-- Config.CheckInterval = 1000
-- Config.BaseBreakdownChance = 0.1
-- Config.MaxBreakdownChance = 1.0
Config.CheckInterval = 10000 -- Cooldown in milliseconds
Config.KilometerMultiplier = 1.0 -- Multiplier for vehicle mileage accumulation. Set to 1.0 for normal rate, higher values will increase mileage faster, and lower values will decrease mileage accumulation.
Config.BaseBreakdownChance = 0.01 -- Base failure probability per 1000 km
Config.MaxBreakdownChance = 0.5 -- Maximum probability of failure
Config.BreakdownCooldown = 10800000 -- Cooldown in milliseconds (e.g. 10800000 ms = 3 hours)
Config.preventVehicleFlip = true -- Disable flipping overturned cars
Config.AutoRunSQL = true -- If the script should run the SQL file automatically
Config.AutoVersionChecker = true -- If the script should search for the latest version and warn you in the console if founds one
Config.FrameWork = "esx" -- Only compatible with esx or qb (for the moment)
Config.UseOXNotifications = true -- If the script uses the ox_libs notifications or framework ones
Config.damageMultiplier = 5 -- Damage multiplier (general) applied to the engine in each crash
Config.ApplyDamageAll = true -- If the ApplyEngineDamage function applies the damage to the engine only or to engine/petroltank (if Config.ApplyDamagePetrol true)/body.
Config.ApplyDamagePetrol = false -- If the ApplyEngineDamage function applies the damage to petroltank, it can cause lots of fires.
Config.CheckIntervalEngineDamage = 2000 -- Cooldown in milliseconds
Config.ClassDamageMultipliers = { -- Damage multiplier (specific for each vehicle class) applied to the engine in each crash
[0] = { damageMultiplier = 4.5 }, -- Compacts
[1] = { damageMultiplier = 5.0 }, -- Sedans
[2] = { damageMultiplier = 5.5 }, -- SUVs
[3] = { damageMultiplier = 4.8 }, -- Coupes
[4] = { damageMultiplier = 5.5 }, -- Muscle
[5] = { damageMultiplier = 5.3 }, -- Sports Classics
[6] = { damageMultiplier = 6.0 }, -- Sports
[7] = { damageMultiplier = 6.5 }, -- Super
[8] = { damageMultiplier = 3.0 }, -- Motorcycles
[9] = { damageMultiplier = 5.2 }, -- Off-road
[10] = { damageMultiplier = 7.0 }, -- Industrial
[11] = { damageMultiplier = 5.5 }, -- Utility
[12] = { damageMultiplier = 5.0 }, -- Vans
[13] = { damageMultiplier = 2.5 }, -- Cycles
[14] = { damageMultiplier = 4.0 }, -- Boats
[15] = { damageMultiplier = 8.0 }, -- Helicopters
[16] = { damageMultiplier = 9.0 }, -- Planes
[17] = { damageMultiplier = 5.0 }, -- Service
[18] = { damageMultiplier = 5.0 }, -- Emergency
[19] = { damageMultiplier = 6.0 }, -- Military
[20] = { damageMultiplier = 7.5 }, -- Commercial
[21] = { damageMultiplier = 10.0 }, -- Trains
[22] = { damageMultiplier = 5.5 }, -- Open Wheel
}
-- Setting to use mileages systems (config your own external system if you have one in server.lua line 34)
Config.MileageSystem = 'default' -- default / jg-vehiclemileage / other
Config.KMDisplayPosition = 'top-center' -- Available positions for the NUI: 'bottom-right', 'bottom-left', 'top-right', 'top-left', 'bottom-center', 'top-center'
-- Config for the vehicle physics in harsh terrains
Config.EnableCarPhysics = true
Config.MaxSpeed = 40 -- In KM/hours
Config.CarPhysicsTimeout = 2500 -- In milliseconds
Config.CarSinking = false -- Works but it's as little bit buggy, not a great implementation
Config.reductionFactor = 0.1 -- How fast the vehicles brake on sand/grass
Config.TractionBonus = 0.2 -- Additional traction boost for emergency vehicles, improving grip on rough terrains like sand or grass
Config.PlayWarningSound = true -- If play warning sound when the brakes overheats
Config.ClassConfigs = {
[0] = { BrakeTemperaturaGain = 15, MaxBrakeTemp = 550, CoolingRate = 1.1 }, -- Compacts
[1] = { BrakeTemperaturaGain = 20, MaxBrakeTemp = 600, CoolingRate = 1.0 }, -- Sedans
[2] = { BrakeTemperaturaGain = 25, MaxBrakeTemp = 650, CoolingRate = 1.05 }, -- SUVs
[3] = { BrakeTemperaturaGain = 30, MaxBrakeTemp = 700, CoolingRate = 1.0 }, -- Coupes
[4] = { BrakeTemperaturaGain = 35, MaxBrakeTemp = 800, CoolingRate = 0.8 }, -- Muscle
[5] = { BrakeTemperaturaGain = 40, MaxBrakeTemp = 900, CoolingRate = 0.7 }, -- Sports Classics
[6] = { BrakeTemperaturaGain = 45, MaxBrakeTemp = 950, CoolingRate = 1.3 }, -- Sports
[7] = { BrakeTemperaturaGain = 50, MaxBrakeTemp = 1000, CoolingRate = 1.6 }, -- Super
[8] = { BrakeTemperaturaGain = 10, MaxBrakeTemp = 500, CoolingRate = 1.5 }, -- Motorcycles
[9] = { BrakeTemperaturaGain = 50, MaxBrakeTemp = 1100, CoolingRate = 0.4 }, -- Off-road
[10] = { BrakeTemperaturaGain = 55, MaxBrakeTemp = 1200, CoolingRate = 0.3 }, -- Industrial
[11] = { BrakeTemperaturaGain = 35, MaxBrakeTemp = 800, CoolingRate = 1.0 }, -- Utility
[12] = { BrakeTemperaturaGain = 30, MaxBrakeTemp = 750, CoolingRate = 1.2 }, -- Vans
[13] = { BrakeTemperaturaGain = 5, MaxBrakeTemp = 450, CoolingRate = 2.5 }, -- Cycles
[14] = { BrakeTemperaturaGain = 20, MaxBrakeTemp = 550, CoolingRate = 1.8 }, -- Boats
[15] = { BrakeTemperaturaGain = 60, MaxBrakeTemp = 1300, CoolingRate = 0.4 }, -- Helicopters
[16] = { BrakeTemperaturaGain = 65, MaxBrakeTemp = 1400, CoolingRate = 0.3 }, -- Planes
[17] = { BrakeTemperaturaGain = 20, MaxBrakeTemp = 600, CoolingRate = 1.6 }, -- Service
[18] = { BrakeTemperaturaGain = 20, MaxBrakeTemp = 650, CoolingRate = 1.5 }, -- Emergency
[19] = { BrakeTemperaturaGain = 25, MaxBrakeTemp = 700, CoolingRate = 1.5 }, -- Military
[20] = { BrakeTemperaturaGain = 70, MaxBrakeTemp = 1500, CoolingRate = 0.2 }, -- Commercial
[21] = { BrakeTemperaturaGain = 80, MaxBrakeTemp = 1600, CoolingRate = 0.1 }, -- Trains
[22] = { BrakeTemperaturaGain = 50, MaxBrakeTemp = 900, CoolingRate = 0.6 }, -- Open Wheel
}
-- Types of breakdowns
Config.BreakdownTypes = {
{
name = "MotorFailure",
chance = 0.2,
duration = 30000,
action = function(vehicle)
-- local currentHealth = GetVehicleEngineHealth(vehicle)
SetVehicleEngineOn(vehicle, false, true, true)
SetVehicleEngineHealth(vehicle, -4000)
-- TriggerEvent('realistic-vehicle:engineFailureFlag', vehicle, true)
if Config.ShowNotifications then
TriggerEvent('SendNotification', '', "¡El motor de tu vehículo se ha calentado y ha roto la culata!",
5000, "error")
end
-- Citizen.SetTimeout(Config.BreakdownTypes[1].duration, function()
-- SetVehicleEngineHealth(vehicle, currentHealth)
-- SetVehicleEngineOn(vehicle, true, true, true)
-- if Config.ShowNotifications then
-- TriggerEvent('SendNotification', '', "El motor de tu vehículo se ha enfriado.", 5000, "success")
-- end
-- TriggerEvent('realistic-vehicle:engineFailureFlag', vehicle, false)
-- end)
end
},
{
name = "TyreBurst",
chance = 0.7,
action = function(vehicle)
if GetVehicleTyresCanBurst(vehicle) == false then return end
local numWheels = GetVehicleNumberOfWheels(vehicle)
local affectedTire
if numWheels == 2 then
affectedTire = (math.random(2) - 1) * 4
elseif numWheels == 4 then
affectedTire = (math.random(4) - 1)
if affectedTire > 1 then affectedTire = affectedTire + 2 end
elseif numWheels == 6 then
affectedTire = (math.random(6) - 1)
else
affectedTire = 0
end
SetVehicleTyreBurst(vehicle, affectedTire, true, 1000.0)
if Config.ShowNotifications then
TriggerEvent('SendNotification', '', "¡Uno de los neumáticos de tu vehículo ha reventado!", 5000, "error")
end
end
},
{
name = "PowerLoss",
chance = 0.4,
duration = 20000,
action = function(vehicle)
SetVehicleEnginePowerMultiplier(vehicle, -50.0)
TriggerEvent('realistic-vehicle:powerLossFlag', vehicle, true)
if Config.ShowNotifications then
TriggerEvent('SendNotification', '', "¡Tu vehículo ha perdido potencia!", 5000, "error")
end
Citizen.SetTimeout(Config.BreakdownTypes[3].duration, function()
SetVehicleEnginePowerMultiplier(vehicle, 0.0)
TriggerEvent('realistic-vehicle:powerLossFlag', vehicle, false)
if Config.ShowNotifications then
TriggerEvent('SendNotification', '', "La potencia de tu vehículo ha sido restaurada.", 5000,
"success")
end
end)
end
},
{
name = "PetrolLoss",
chance = 1.6,
duration = 25000,
action = function(vehicle)
-- SetVehicleFuelLevel(vehicle, currentFuelLevel - 10.0)
SetVehicleEngineOn(vehicle, false, false, false)
TriggerEvent('realistic-vehicle:petrolLossFlag', vehicle, true)
if Config.ShowNotifications then
TriggerEvent('SendNotification', '', "¡Tu vehículo tiene una fuga de gasolina!", 5000, "error")
end
Citizen.SetTimeout(Config.BreakdownTypes[4].duration, function()
local currentFuelLevel = GetVehicleFuelLevel(vehicle)
SetVehicleFuelLevel(vehicle, currentFuelLevel)
SetVehicleEngineOn(vehicle, true, true, true)
TriggerEvent('realistic-vehicle:petrolLossFlag', vehicle, false)
if Config.ShowNotifications then
TriggerEvent('SendNotification', '', "La fuga de gasolina ha sido sellada.", 5000, "success")
end
end)
end
},
{
name = "TransmissionFailure",
chance = 0.3,
duration = 25000,
action = function(vehicle)
SetVehicleEngineOn(vehicle, false, true, true)
SetVehicleEngineHealth(vehicle, -500)
TriggerEvent('realistic-vehicle:transmissionFailureFlag', vehicle, true)
if Config.ShowNotifications then
TriggerEvent('SendNotification', '', "¡La transmisión de tu vehículo está fallando!", 5000, "error")
end
Citizen.SetTimeout(Config.BreakdownTypes[5].duration, function()
SetVehicleEngineHealth(vehicle, 1000.0)
SetVehicleEngineOn(vehicle, true, true, true)
TriggerEvent('realistic-vehicle:transmissionFailureFlag', vehicle, false)
if Config.ShowNotifications then
TriggerEvent('SendNotification', '', "La transmisión de tu vehículo ha sido reparada.", 5000,
"success")
end
end)
end
},
{
name = "BatteryDrain",
chance = 0.3,
duration = 60000,
action = function(vehicle)
TriggerEvent('realistic-vehicle:batteryDrainFlag', vehicle, true)
SetVehicleEngineOn(vehicle, false, true, true)
if Config.ShowNotifications then
TriggerEvent('SendNotification', '', "¡La batería de tu vehículo está vacía!", 5000, "error")
end
Citizen.SetTimeout(Config.BreakdownTypes[6].duration, function()
TriggerEvent('realistic-vehicle:batteryDrainFlag', vehicle, false)
SetVehicleEngineOn(vehicle, true, true, true)
if Config.ShowNotifications then
TriggerEvent('SendNotification', '', "La batería de tu vehículo se ha recargado.", 5000, "success")
end
end)
end
},
{
name = "RadiatorLeak",
chance = 0.3,
duration = 30000,
action = function(vehicle)
local initialTemperature = GetVehicleEngineTemperature(vehicle)
SetVehicleEngineTemperature(vehicle, GetVehicleEngineTemperature(vehicle) + 50.0)
TriggerEvent('realistic-vehicle:radiatorLeakFlag', vehicle, true)
if Config.ShowNotifications then
TriggerEvent('SendNotification', '', "¡El radiador de tu vehículo tiene una fuga!", 5000, "error")
end
Citizen.SetTimeout(Config.BreakdownTypes[7].duration, function()
SetVehicleEngineTemperature(vehicle, initialTemperature)
TriggerEvent('realistic-vehicle:radiatorLeakFlag', vehicle, false)
if Config.ShowNotifications then
TriggerEvent('SendNotification', '', "La fuga del radiador se ha sellado.", 5000, "success")
end
end)
end
},
{
name = "BrakeFailure",
chance = 0.3,
duration = 20000,
action = function(vehicle)
SetVehicleBrake(vehicle, true)
SetVehicleHandbrake(vehicle, true)
TriggerEvent('realistic-vehicle:brakeFailureFlag', vehicle, true)
if Config.ShowNotifications then
TriggerEvent('SendNotification', '', "¡Los frenos de tu vehículo están fallando!", 5000, "error")
end
Citizen.SetTimeout(Config.BreakdownTypes[8].duration, function()
SetVehicleBrake(vehicle, false)
SetVehicleHandbrake(vehicle, false)
TriggerEvent('realistic-vehicle:brakeFailureFlag', vehicle, false)
if Config.ShowNotifications then
TriggerEvent('SendNotification', '', "Los frenos de tu vehículo han sido reparados.", 5000, "success")
end
end)
end
},
{
name = "SuspensionDamage",
chance = 0.4,
duration = 30000,
action = function(vehicle)
SetVehicleSuspensionHeight(vehicle, 0.05)
TriggerEvent('realistic-vehicle:suspensionDamageFlag', vehicle, true)
if Config.ShowNotifications then
TriggerEvent('SendNotification', '', "¡La suspensión de tu vehículo está dañada!", 5000, "error")
end
Citizen.SetTimeout(Config.BreakdownTypes[9].duration, function()
SetVehicleSuspensionHeight(vehicle, 0.0)
TriggerEvent('realistic-vehicle:suspensionDamageFlag', vehicle, false)
if Config.ShowNotifications then
TriggerEvent('SendNotification', '', "La suspensión de tu vehículo ha sido reparada.", 5000,
"success")
end
end)
end
},
{
name = "AlternatorFailure",
chance = 0.2,
duration = 30000,
action = function(vehicle)
SetVehicleEngineOn(vehicle, false, true, false)
SetVehicleLights(vehicle, 1)
TriggerEvent('realistic-vehicle:alternatorFailureFlag', vehicle, true)
if Config.ShowNotifications then
TriggerEvent('SendNotification', '', "¡El alternador de tu vehículo está fallando!", 5000, "error")
end
Citizen.SetTimeout(Config.BreakdownTypes[10].duration, function()
TriggerEvent('realistic-vehicle:alternatorFailureFlag', vehicle, false)
if Config.ShowNotifications then
TriggerEvent('SendNotification', '', "El alternador de tu vehículo ha sido reparado.", 5000,
"success")
end
SetVehicleEngineOn(vehicle, true, true, true)
SetVehicleLights(vehicle, 0)
end)
end
},
{
name = "TransmissionFluidLeak",
chance = 0.3,
duration = 25000,
action = function(vehicle)
TriggerEvent('realistic-vehicle:transmissionFluidLeakFlag', vehicle, true)
if Config.ShowNotifications then
TriggerEvent('SendNotification', '', "¡Hay una fuga de fluido de transmisión!", 5000, "error")
end
SetVehicleEnginePowerMultiplier(vehicle, -50.0)
Citizen.SetTimeout(Config.BreakdownTypes[11].duration, function()
TriggerEvent('realistic-vehicle:transmissionFluidLeakFlag', vehicle, false)
if Config.ShowNotifications then
TriggerEvent('SendNotification', '', "La fuga de fluido de transmisión se ha reparado.", 5000,
"success")
end
SetVehicleEnginePowerMultiplier(vehicle, 0.0)
end)
end
},
{
name = "ClutchFailure",
chance = 0.3,
duration = 20000,
action = function(vehicle)
SetVehicleClutch(vehicle, 0.2)
TriggerEvent('realistic-vehicle:clutchFailureFlag', vehicle, true)
if Config.ShowNotifications then
TriggerEvent('SendNotification', '', "¡El embrague de tu vehículo está fallando!", 5000, "error")
end
Citizen.SetTimeout(Config.BreakdownTypes[12].duration, function()
SetVehicleClutch(vehicle, 1.0)
TriggerEvent('realistic-vehicle:clutchFailureFlag', vehicle, false)
if Config.ShowNotifications then
TriggerEvent('SendNotification', '', "El embrague de tu vehículo ha sido reparado.", 5000, "success")
end
end)
end
},
{
name = "FuelFilterClogged",
chance = 0.4,
duration = 20000,
action = function(vehicle)
DebugPrint(GetVehicleFuelLevel(vehicle))
SetVehicleFuelLevel(vehicle, 9.77)
TriggerEvent('realistic-vehicle:fuelFilterCloggedFlag', vehicle, true)
if Config.ShowNotifications then
TriggerEvent('SendNotification', '', "¡El filtro de combustible está obstruido!", 5000, "error")
end
Citizen.SetTimeout(Config.BreakdownTypes[13].duration, function()
SetVehicleFuelLevel(vehicle, GetVehicleFuelLevel(vehicle) + 40.0)
TriggerEvent('realistic-vehicle:fuelFilterCloggedFlag', vehicle, false)
if Config.ShowNotifications then
TriggerEvent('SendNotification', '', "El filtro de combustible ha sido limpiado.", 5000, "success")
end
end)
end
},
{
name = "HoodLatchFailure",
chance = 0.5,
duration = 20000,
action = function(vehicle)
SetVehicleDoorOpen(vehicle, 4, false, false)
--For Other Scripts Incompatibility
-- TriggerEvent('realistic-vehicle:hoodLatchFailureFlag', vehicle, true)
if Config.ShowNotifications then
TriggerEvent('SendNotification', '',
"¡El capó de tu vehículo se ha abierto debido a un fallo en los seguros!", 5000, "error")
end
-- To set if the hood closes on its own when a timeout finishes
-- Citizen.SetTimeout(Config.BreakdownTypes[14].duration, function()
-- SetVehicleDoorShut(vehicle, 4, false)
-- TriggerEvent('realistic-vehicle:hoodLatchFailureFlag', vehicle, false)
-- if Config.ShowNotifications then
-- TriggerEvent('SendNotification', '', "El capó de tu vehículo ha sido cerrado", 5000, "success")
-- end
-- end)
end
},
{
name = "DoorFallOffFailure",
chance = 0.2,
duration = 0,
action = function(vehicle)
local doorCount = GetNumberOfVehicleDoors(vehicle)
if doorCount > 0 then
local doorIndex = math.random(0, doorCount - 1)
if DoesVehicleHaveDoor(vehicle, doorIndex) then
SetVehicleDoorBroken(vehicle, doorIndex, false)
if Config.ShowNotifications then
TriggerEvent('SendNotification', '',
"¡Una de las puertas de tu vehículo se ha soltado y se ha caído!",
5000, "error")
end
else
DebugPrint('¡Esa puerta no existe!')
end
else
DebugPrint('¡Este vehículo no tiene puertas para soltarse!')
end
end
},
}
-- This vehicles will be excluded from the mileage probability of breakdowns
Config.ExcludedVehicles = {
"ADMINCAR",
}
Config.ExcludedPrefixes = {
"LSPD",
"LSSD",
"AMB",
}