Skip to content

Commit

Permalink
refactor: (esx_dmvschool): Better Speeding check system
Browse files Browse the repository at this point in the history
  • Loading branch information
bitpredator committed Apr 2, 2024
1 parent 300493c commit 66ac52a
Show file tree
Hide file tree
Showing 18 changed files with 580 additions and 512 deletions.
301 changes: 181 additions & 120 deletions server-data/resources/[esx_addons]/esx_dmvschool/client/main.lua

Large diffs are not rendered by default.

37 changes: 19 additions & 18 deletions server-data/resources/[esx_addons]/esx_dmvschool/config.lua
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,8 @@ Config = {}
Config.DrawDistance = 10.0
Config.MaxErrors = 5
Config.SpeedMultiplier = 3.6
Config.Locale = 'en'
Config.SpeedingErrorDelay = 5000 --Min: 5000ms
Config.Locale = GetConvar('esx:locale', 'en')

Config.Prices = {
dmv = 500,
Expand Down Expand Up @@ -46,28 +47,28 @@ Config.CheckPoints = {
{
Pos = {x = 255.139, y = -1400.731, z = 29.537},
Action = function(playerPed, vehicle, setCurrentZoneType)
DrawMissionText(_U('next_point_speed', Config.SpeedLimits['residence']), 5000)
DrawMissionText(TranslateCap('next_point_speed', Config.SpeedLimits['residence']), 5000)
end
},

{
Pos = {x = 271.874, y = -1370.574, z = 30.932},
Action = function(playerPed, vehicle, setCurrentZoneType)
DrawMissionText(_U('go_next_point'), 5000)
DrawMissionText(TranslateCap('go_next_point'), 5000)
end
},

{
Pos = {x = 234.907, y = -1345.385, z = 29.542},
Action = function(playerPed, vehicle, setCurrentZoneType)
CreateThread(function()
DrawMissionText(_U('stop_for_ped'), 5000)
DrawMissionText(TranslateCap('stop_for_ped'), 5000)
PlaySound(-1, 'RACE_PLACED', 'HUD_AWARDS', false, 0, true)
FreezeEntityPosition(vehicle, true)
Wait(4000)

FreezeEntityPosition(vehicle, false)
DrawMissionText(_U('good_lets_cont'), 5000)
DrawMissionText(TranslateCap('good_lets_cont'), 5000)
end)
end
},
Expand All @@ -78,35 +79,35 @@ Config.CheckPoints = {
setCurrentZoneType('town')

CreateThread(function()
DrawMissionText(_U('stop_look_left', Config.SpeedLimits['town']), 5000)
DrawMissionText(TranslateCap('stop_look_left', Config.SpeedLimits['town']), 5000)
PlaySound(-1, 'RACE_PLACED', 'HUD_AWARDS', false, 0, true)
FreezeEntityPosition(vehicle, true)
Wait(6000)

FreezeEntityPosition(vehicle, false)
DrawMissionText(_U('good_turn_right'), 5000)
DrawMissionText(TranslateCap('good_turn_right'), 5000)
end)
end
},

{
Pos = {x = 178.550, y = -1401.755, z = 27.725},
Action = function(playerPed, vehicle, setCurrentZoneType)
DrawMissionText(_U('watch_traffic_lightson'), 5000)
DrawMissionText(TranslateCap('watch_traffic_lightson'), 5000)
end
},

{
Pos = {x = 113.160, y = -1365.276, z = 27.725},
Action = function(playerPed, vehicle, setCurrentZoneType)
DrawMissionText(_U('go_next_point'), 5000)
DrawMissionText(TranslateCap('go_next_point'), 5000)
end
},

{
Pos = {x = -73.542, y = -1364.335, z = 27.789},
Action = function(playerPed, vehicle, setCurrentZoneType)
DrawMissionText(_U('stop_for_passing'), 5000)
DrawMissionText(TranslateCap('stop_for_passing'), 5000)
PlaySound(-1, 'RACE_PLACED', 'HUD_AWARDS', false, 0, true)
FreezeEntityPosition(vehicle, true)
Wait(6000)
Expand All @@ -117,14 +118,14 @@ Config.CheckPoints = {
{
Pos = {x = -355.143, y = -1420.282, z = 27.868},
Action = function(playerPed, vehicle, setCurrentZoneType)
DrawMissionText(_U('go_next_point'), 5000)
DrawMissionText(TranslateCap('go_next_point'), 5000)
end
},

{
Pos = {x = -439.148, y = -1417.100, z = 27.704},
Action = function(playerPed, vehicle, setCurrentZoneType)
DrawMissionText(_U('go_next_point'), 5000)
DrawMissionText(TranslateCap('go_next_point'), 5000)
end
},

Expand All @@ -133,44 +134,44 @@ Config.CheckPoints = {
Action = function(playerPed, vehicle, setCurrentZoneType)
setCurrentZoneType('freeway')

DrawMissionText(_U('hway_time', Config.SpeedLimits['freeway']), 5000)
DrawMissionText(TranslateCap('hway_time', Config.SpeedLimits['freeway']), 5000)
PlaySound(-1, 'RACE_PLACED', 'HUD_AWARDS', false, 0, true)
end
},

{
Pos = {x = -463.237, y = -1592.178, z = 37.519},
Action = function(playerPed, vehicle, setCurrentZoneType)
DrawMissionText(_U('go_next_point'), 5000)
DrawMissionText(TranslateCap('go_next_point'), 5000)
end
},

{
Pos = {x = -900.647, y = -1986.28, z = 26.109},
Action = function(playerPed, vehicle, setCurrentZoneType)
DrawMissionText(_U('go_next_point'), 5000)
DrawMissionText(TranslateCap('go_next_point'), 5000)
end
},

{
Pos = {x = 1225.759, y = -1948.792, z = 38.718},
Action = function(playerPed, vehicle, setCurrentZoneType)
DrawMissionText(_U('go_next_point'), 5000)
DrawMissionText(TranslateCap('go_next_point'), 5000)
end
},

{
Pos = {x = 1225.759, y = -1948.792, z = 38.718},
Action = function(playerPed, vehicle, setCurrentZoneType)
setCurrentZoneType('town')
DrawMissionText(_U('in_town_speed', Config.SpeedLimits['town']), 5000)
DrawMissionText(TranslateCap('in_town_speed', Config.SpeedLimits['town']), 5000)
end
},

{
Pos = {x = 1163.603, y = -1841.771, z = 35.679},
Action = function(playerPed, vehicle, setCurrentZoneType)
DrawMissionText(_U('gratz_stay_alert'), 5000)
DrawMissionText(TranslateCap('gratz_stay_alert'), 5000)
PlaySound(-1, 'RACE_PLACED', 'HUD_AWARDS', false, 0, true)
end
},
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
INSERT INTO `licenses` (`type`, `label`) VALUES
('dmv', 'Driving Permit'),
('drive', 'Drivers License'),
('drive_bike', 'Motorcycle License'),
('drive_truck', 'Commercial Drivers License')
;
('dmv', 'Code de la route'),
('drive', 'Permis de conduire'),
('drive_bike', 'Permis moto'),
('drive_truck', 'Permis camion')
;
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,10 @@ fx_version 'adamant'

game 'gta5'

description 'ESX DMV School'
description "A DMV School for players to get their drivers license"

version '1.0.0'
version '1.0'
legacyversion '1.9.1'

lua54 'yes'

Expand Down
56 changes: 28 additions & 28 deletions server-data/resources/[esx_addons]/esx_dmvschool/locales/de.lua
Original file line number Diff line number Diff line change
@@ -1,29 +1,29 @@
Locales['de'] = {
['you_paid'] = 'Du zahlst %s€ an die Fahrschule!',
['go_next_point'] = 'Fahre zum nächsten Punkt!',
['in_town_speed'] = 'Du betrittst die Stadt! Neues Geschwindigkeitslimit: %s km/h',
['next_point_speed'] = 'Fahre zum nächsten Punkt. Neues Geschwindigkeitslimit: %s km/h',
['stop_for_ped'] = '~r~Stoppe, und lasse den Fußgänger den Weg passieren!',
['good_lets_cont'] = 'Gut! Weiter so.',
['stop_look_left'] = '~r~Stopp und gucke Links. Geschwindigkeitslimit: %s km/h',
['good_turn_right'] = 'Gut, biege rechts ab, und folge der Linie!',
['watch_traffic_lightson'] = 'Gucke auf den Vehrkehr und schalte deine Lichter an!',
['stop_for_passing'] = '~r~Stopp für Fahrende fahrzeuge!',
['hway_time'] = 'Es ist Zeit auf der Autobahn zu fahren! Neues Geschwindigkeitslimit: %s km/h',
['gratz_stay_alert'] = 'Ich bin Stolz auf dich! Jedoch bleibe ~r~wachsam während du fährst!',
['passed_test'] = 'Du hast den Test bestanden! Glückwunsch!',
['failed_test'] = 'Du hast ~r~leider den Test nicht bestanden! Viel Glück beim nächsten mal!',
['theory_test'] = 'Theoretische Fahrprüfung',
['road_test_car'] = 'Auto Führerscheinprüfung',
['road_test_bike'] = 'Motorrad Führerscheinprüfung',
['road_test_truck'] = 'LKW Führerscheinprüfung',
['school_item'] = '%s€',
['driving_school'] = 'Fahrschule',
['press_open_menu'] = 'Drücke [E] um das Menü zu öffnen!',
['driving_school_blip'] = 'Fahrschule',
['driving_test_complete'] = 'Führerschein Test beendet!',
['driving_too_fast'] = '~r~Du bist zu Schnell Das derzeitige Geschwindigkeitslimit beträgt: %s km/h!',
['errors'] = 'Fehler: ~r~%s/%s',
['you_damaged_veh'] = 'Du hast das Fahrzeug beschädigt!',
['not_enough_money'] = 'Du hast nicht genug Geld!',
Locales["de"] = {
["you_paid"] = "Du zahlst %s€ an die Fahrschule!",
["go_next_point"] = "Fahre zum nächsten Punkt!",
["in_town_speed"] = "Du betrittst die Stadt! Neues Geschwindigkeitslimit: %s km/h",
["next_point_speed"] = "Fahre zum nächsten Punkt. Neues Geschwindigkeitslimit: %s km/h",
["stop_for_ped"] = "~r~Stoppe, und lasse den Fußgänger den Weg passieren!",
["good_lets_cont"] = "Gut! Weiter so.",
["stop_look_left"] = "~r~Stopp und gucke Links. Geschwindigkeitslimit: %s km/h",
["good_turn_right"] = "Gut, biege rechts ab, und folge der Linie!",
["watch_traffic_lightson"] = "Gucke auf den Vehrkehr und schalte deine Lichter an!",
["stop_for_passing"] = "~r~Stopp für Fahrende fahrzeuge!",
["hway_time"] = "Es ist Zeit auf der Autobahn zu fahren! Neues Geschwindigkeitslimit: %s km/h",
["gratz_stay_alert"] = "Ich bin Stolz auf dich! Jedoch bleibe ~r~wachsam während du fährst!",
["passed_test"] = "Du hast den Test bestanden! Glückwunsch!",
["failed_test"] = "Du hast ~r~leider den Test nicht bestanden! Viel Glück beim nächsten mal!",
["theory_test"] = "Theoretische Fahrprüfung",
["road_test_car"] = "Auto Führerscheinprüfung",
["road_test_bike"] = "Motorrad Führerscheinprüfung",
["road_test_truck"] = "LKW Führerscheinprüfung",
["school_item"] = "%s€",
["driving_school"] = "Fahrschule",
["press_open_menu"] = "Drücke [E] um das Menü zu öffnen!",
["driving_school_blip"] = "Fahrschule",
["driving_test_complete"] = "Führerschein Test beendet!",
["driving_too_fast"] = "~r~Du bist zu Schnell Das derzeitige Geschwindigkeitslimit beträgt: %s km/h!",
["errors"] = "Fehler: ~r~%s/%s",
["you_damaged_veh"] = "Du hast das Fahrzeug beschädigt!",
["not_enough_money"] = "Du hast nicht genug Geld!",
}
56 changes: 28 additions & 28 deletions server-data/resources/[esx_addons]/esx_dmvschool/locales/en.lua
Original file line number Diff line number Diff line change
@@ -1,29 +1,29 @@
Locales['en'] = {
['you_paid'] = 'you paid $%s to the DMV school',
['go_next_point'] = 'go to the next point!',
['in_town_speed'] = 'entered town, pay attention to your speed! Speed Limit: %s km/h',
['next_point_speed'] = 'go to the next point! Speed Limit: %s km/h',
['stop_for_ped'] = '~r~Stop for the pedestrian crossing',
['good_lets_cont'] = 'Good, continue.',
['stop_look_left'] = '~r~Stop and look left. Speed Limit: %s km/h',
['good_turn_right'] = 'Good, turn right and follow the line',
['watch_traffic_lightson'] = 'watch the traffic and turn on your lights!',
['stop_for_passing'] = '~r~Stop for passing vehicles!',
['hway_time'] = 'it\'s time to drive on the highway! Speed Limit: %s km/h',
['gratz_stay_alert'] = 'i\'m impressed, but don\'t forget to stay ~r~alert whilst driving!',
['passed_test'] = 'you passed the test, congratulations!',
['failed_test'] = 'you ~r~failed the test, better luck next time!',
['theory_test'] = 'theoretical Driving Test',
['road_test_car'] = 'driving Test',
['road_test_bike'] = 'motorcycle Skills Test',
['road_test_truck'] = 'truck Skills Test',
['school_item'] = '$%s',
['driving_school'] = 'driving School',
['press_open_menu'] = 'press [E] to open the menu',
['driving_school_blip'] = 'driving School',
['driving_test_complete'] = 'driving test completed',
['driving_too_fast'] = '~r~You\'re driving too fast, the current speed limit is: %s km/h!',
['errors'] = 'mistakes: ~r~%s/%s',
['you_damaged_veh'] = 'you damaged the vehicle',
['not_enough_money'] = 'You don\'t have enough money',
Locales["en"] = {
["you_paid"] = "you paid $%s to the DMV school",
["go_next_point"] = "go to the next point!",
["in_town_speed"] = "entered town, pay attention to your speed! Speed Limit: %s km/h",
["next_point_speed"] = "go to the next point! Speed Limit: %s km/h",
["stop_for_ped"] = "~r~Stop for the pedestrian crossing",
["good_lets_cont"] = "Good, continue.",
["stop_look_left"] = "~r~Stop and look left. Speed Limit: %s km/h",
["good_turn_right"] = "Good, turn right and follow the line",
["watch_traffic_lightson"] = "watch the traffic and turn on your lights!",
["stop_for_passing"] = "~r~Stop for passing vehicles!",
["hway_time"] = "it's time to drive on the highway! Speed Limit: %s km/h",
["gratz_stay_alert"] = "i'm impressed, but don't forget to stay ~r~alert whilst driving!",
["passed_test"] = "you passed the test, congratulations!",
["failed_test"] = "you ~r~failed the test, better luck next time!",
["theory_test"] = "theoretical Driving Test",
["road_test_car"] = "driving Test",
["road_test_bike"] = "motorcycle Skills Test",
["road_test_truck"] = "truck Skills Test",
["school_item"] = "$%s",
["driving_school"] = "driving School",
["press_open_menu"] = "press [E] to open the menu",
["driving_school_blip"] = "driving School",
["driving_test_complete"] = "driving test completed",
["driving_too_fast"] = "~r~You're driving too fast, the current speed limit is: %s km/h!",
["errors"] = "mistakes: ~r~%s/%s",
["you_damaged_veh"] = "you damaged the vehicle",
["not_enough_money"] = "You don't have enough money",
}
56 changes: 28 additions & 28 deletions server-data/resources/[esx_addons]/esx_dmvschool/locales/es.lua
Original file line number Diff line number Diff line change
@@ -1,29 +1,29 @@
Locales['es'] = {
['you_paid'] = 'Pagaste %s$ a la autoescuela',
['go_next_point'] = '¡Vete al siguiente punto!',
['in_town_speed'] = '¡Entraste a la ciudad, presta atención a tu velocidad! Límite de velocidad: %s km/h',
['next_point_speed'] = '¡Vete al siguiente punto! Límite de velocidad: %s km/h',
['stop_for_ped'] = '~r~Para en el paso de peatones',
['good_lets_cont'] = 'Bien, continua',
['stop_look_left'] = '~r~Para y mira a la izquierda. Límite de velocidad: %s km/h',
['good_turn_right'] = 'Bien, gira a la derecha y sigue la línea',
['watch_traffic_lightson'] = '¡Mira el tráfico y enciende las luces!',
['stop_for_passing'] = '¡~r~Para para que pasen los vehículos!',
['hway_time'] = '¡Es hora de conducir por la autopista! Límite de velocidad: %s km/h',
['gratz_stay_alert'] = '¡Estoy impresionado pero no dejes de estar ~r~alerta mientras conduces!',
['passed_test'] = 'Has aprobado el examen, ¡Enorabuena!',
['failed_test'] = 'Has ~r~suspendido el examen, ¡Más suerte la próxima vez!',
['theory_test'] = 'Examen teórico de conducir',
['road_test_car'] = 'Examen práctico de conducir',
['road_test_bike'] = 'Examen práctico de moto',
['road_test_truck'] = 'Examen práctico de camiones',
['school_item'] = '%s$',
['driving_school'] = 'Escuela de conducción',
['press_open_menu'] = 'Pulsa [E] para abrir el menú',
['driving_school_blip'] = 'Autoescuela',
['driving_test_complete'] = 'Examen de conducir finalizado',
['driving_too_fast'] = '¡~r~Estás conduciendo muy rápido, el límite de velocidad actual es: %s km/h!',
['errors'] = 'Fallos: ~r~%s / %s',
['you_damaged_veh'] = '¡Has dañado el vehículo!',
['not_enough_money'] = 'No tienes suficiente dinero'
Locales["es"] = {
["you_paid"] = "Pagaste %s$ a la autoescuela",
["go_next_point"] = "¡Vete al siguiente punto!",
["in_town_speed"] = "¡Entraste a la ciudad, presta atención a tu velocidad! Límite de velocidad: %s km/h",
["next_point_speed"] = "¡Vete al siguiente punto! Límite de velocidad: %s km/h",
["stop_for_ped"] = "~r~Para en el paso de peatones",
["good_lets_cont"] = "Bien, continua",
["stop_look_left"] = "~r~Para y mira a la izquierda. Límite de velocidad: %s km/h",
["good_turn_right"] = "Bien, gira a la derecha y sigue la línea",
["watch_traffic_lightson"] = "¡Mira el tráfico y enciende las luces!",
["stop_for_passing"] = "¡~r~Para para que pasen los vehículos!",
["hway_time"] = "¡Es hora de conducir por la autopista! Límite de velocidad: %s km/h",
["gratz_stay_alert"] = "¡Estoy impresionado pero no dejes de estar ~r~alerta mientras conduces!",
["passed_test"] = "Has aprobado el examen, ¡Enorabuena!",
["failed_test"] = "Has ~r~suspendido el examen, ¡Más suerte la próxima vez!",
["theory_test"] = "Examen teórico de conducir",
["road_test_car"] = "Examen práctico de conducir",
["road_test_bike"] = "Examen práctico de moto",
["road_test_truck"] = "Examen práctico de camiones",
["school_item"] = "%s$",
["driving_school"] = "Escuela de conducción",
["press_open_menu"] = "Pulsa [E] para abrir el menú",
["driving_school_blip"] = "Autoescuela",
["driving_test_complete"] = "Examen de conducir finalizado",
["driving_too_fast"] = "¡~r~Estás conduciendo muy rápido, el límite de velocidad actual es: %s km/h!",
["errors"] = "Fallos: ~r~%s / %s",
["you_damaged_veh"] = "¡Has dañado el vehículo!",
["not_enough_money"] = "No tienes suficiente dinero",
}
Loading

0 comments on commit 66ac52a

Please sign in to comment.