Skip to content
Open
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion [esx_addons]/esx_dmvschool/fxmanifest.lua
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ server_scripts {
'@es_extended/locale.lua',
'locales/*.lua',
'config.lua',
'server/main.lua'
'server/*.lua'
}

client_scripts {
Expand Down
3 changes: 3 additions & 0 deletions [esx_addons]/esx_dmvschool/locales/de.lua
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thats not german

Original file line number Diff line number Diff line change
Expand Up @@ -27,4 +27,7 @@ Locales['de'] = {
['errors'] = 'Fehler: ~r~%s/%s',
['you_damaged_veh'] = 'Du hast das Fahrzeug beschädigt!',
['not_enough_money'] = 'Du hast nicht genug Geld!',
['latestVersion'] = "Du bruger den seneste version!",
['needUpdateResource'] = "Du skal downloade den nyeste version! Du bruger en gammel version i øjeblikket!",
['errorGetCurrentVersion'] = "Der opstod en fejl under forsøget på at hente den nuværende version!",
}
4 changes: 4 additions & 0 deletions [esx_addons]/esx_dmvschool/locales/en.lua
Original file line number Diff line number Diff line change
Expand Up @@ -27,4 +27,8 @@ Locales['en'] = {
['errors'] = 'mistakes: ~r~%s/%s',
['you_damaged_veh'] = 'you damaged the vehicle',
['not_enough_money'] = 'You don\'t have enough money',
['yourVersion'] = "Your version: ",
['latestVersion'] = "You are using the latest version!",
['needUpdateResource'] = "You need download latest version! You are using an old version at the moment!",
['errorGetCurrentVersion'] = "An error occurred while trying to get the current version!"
}
60 changes: 32 additions & 28 deletions [esx_addons]/esx_dmvschool/locales/es.lua
Original file line number Diff line number Diff line change
@@ -1,30 +1,34 @@
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!',
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!',
['test_failed_go_to_start_point'] = '~r~Go to the starting point, because you failed the test!',
['errors'] = 'Fallos: ~r~%s / %s',
['you_damaged_veh'] = '¡Has dañado el vehículo!',
['not_enough_money'] = 'No tienes suficiente dinero'
['errors'] = 'mistakes: ~r~%s/%s',
['you_damaged_veh'] = 'you damaged the vehicle',
['not_enough_money'] = 'You don\'t have enough money',
['yourVersion'] = "Your version: ",
['latestVersion'] = "You are using the latest version!",
['needUpdateResource'] = "You need download latest version! You are using an old version at the moment!",
['errorGetCurrentVersion'] = "An error occurred while trying to get the current version!"
}
6 changes: 5 additions & 1 deletion [esx_addons]/esx_dmvschool/locales/fi.lua
Original file line number Diff line number Diff line change
Expand Up @@ -26,5 +26,9 @@ Locales['fi'] = {
['test_failed_go_to_start_point'] = '~r~Go to the starting point, because you failed the test!',
['errors'] = 'mistakes: ~r~%s/%s',
['you_damaged_veh'] = 'Vahingoitit ajoneuvoa. Aja varovaisemmin...',
['not_enough_money'] = 'Sinulla ei ole tarpeeksi rahaa'
['not_enough_money'] = 'Sinulla ei ole tarpeeksi rahaa',
['yourVersion'] = "Versiosi: ",
['latestVersion'] = "Käytät uusinta versiota!",
['needUpdateResource'] = "Sinun täytyy ladata uusin versio! Käytät tällä hetkellä vanhaa versiota!",
['errorGetCurrentVersion'] = "Virhe tapahtui haettaessa nykyistä versiota!"
}
6 changes: 5 additions & 1 deletion [esx_addons]/esx_dmvschool/locales/fr.lua
Original file line number Diff line number Diff line change
Expand Up @@ -26,5 +26,9 @@ Locales['fr'] = {
['test_failed_go_to_start_point'] = '~r~Go to the starting point, because you failed the test!',
['errors'] = 'erreurs: ~r~%s/%s',
['you_damaged_veh'] = 'Vous avez endommagé votre véhicule',
['not_enough_money'] = 'Tu n\'as pas assez d\'argent'
['not_enough_money'] = 'Tu n\'as pas assez d\'argent',
['yourVersion'] = "Votre version : ",
['latestVersion'] = "Vous utilisez la dernière version !",
['needUpdateResource'] = "Vous devez télécharger la dernière version ! Vous utilisez actuellement une ancienne version !",
['errorGetCurrentVersion'] = "Une erreur s'est produite lors de la récupération de la version actuelle !"
}
4 changes: 4 additions & 0 deletions [esx_addons]/esx_dmvschool/locales/hu.lua
Original file line number Diff line number Diff line change
Expand Up @@ -27,4 +27,8 @@ Locales['hu'] = {
['errors'] = 'Hibapontok: ~r~%s/%s',
['you_damaged_veh'] = 'Összetörted az autót, ez drága lesz.',
['not_enough_money'] = 'Nincs elég pénzed!',
['yourVersion'] = "A verziód: ",
['latestVersion'] = "A legújabb verziót használod!",
['needUpdateResource'] = "Le kell töltened a legújabb verziót! Jelenleg egy régi verziót használsz!",
['errorGetCurrentVersion'] = "Hiba történt az aktuális verzió lekérése közben!"
}
4 changes: 4 additions & 0 deletions [esx_addons]/esx_dmvschool/locales/it.lua
Original file line number Diff line number Diff line change
Expand Up @@ -27,4 +27,8 @@ Locales['it'] = {
['errors'] = 'errori: ~r~%s/%s',
['you_damaged_veh'] = 'hai danneggiato il veicolo',
['not_enough_money'] = 'non hai abbastanza soldi',
['yourVersion'] = "La tua versione: ",
['latestVersion'] = "Stai usando l'ultima versione!",
['needUpdateResource'] = "Devi scaricare l'ultima versione! Stai usando una versione vecchia!",
['errorGetCurrentVersion'] = "Si è verificato un errore durante il recupero della versione corrente!"
}
4 changes: 4 additions & 0 deletions [esx_addons]/esx_dmvschool/locales/nl.lua
Original file line number Diff line number Diff line change
Expand Up @@ -27,4 +27,8 @@ Locales['nl'] = {
['errors'] = 'Fouten: ~r~%s/%s',
['you_damaged_veh'] = 'Je hebt het voertuig beschadigd',
['not_enough_money'] = 'Je hebt niet genoeg geld',
['yourVersion'] = "Jouw versie: ",
['latestVersion'] = "Je gebruikt de nieuwste versie!",
['needUpdateResource'] = "Je moet de nieuwste versie downloaden! Je gebruikt momenteel een oude versie!",
['errorGetCurrentVersion'] = "Er is een fout opgetreden bij het ophalen van de huidige versie!"
}
6 changes: 5 additions & 1 deletion [esx_addons]/esx_dmvschool/locales/pl.lua
Original file line number Diff line number Diff line change
Expand Up @@ -26,5 +26,9 @@ Locales['pl'] = {
['test_failed_go_to_start_point'] = '~r~Go to the starting point, because you failed the test!',
['errors'] = 'błędy: ~r~%s/%s',
['you_damaged_veh'] = 'uszkodziłeś auto',
['not_enough_money'] = 'Nie masz wystarczająco dużo pieniędzy'
['not_enough_money'] = 'Nie masz wystarczająco dużo pieniędzy',
['yourVersion'] = "Twoja wersja: ",
['latestVersion'] = "Używasz najnowszej wersji!",
['needUpdateResource'] = "Musisz pobrać najnowszą wersję! Obecnie używasz starej wersji!",
['errorGetCurrentVersion'] = "Wystąpił błąd podczas pobierania aktualnej wersji!"
}
4 changes: 4 additions & 0 deletions [esx_addons]/esx_dmvschool/locales/sr.lua
Original file line number Diff line number Diff line change
Expand Up @@ -27,4 +27,8 @@ Locales['sr'] = {
['errors'] = 'Greške: ~r~%s/%s',
['you_damaged_veh'] = 'Oštetili ste vozilo',
['not_enough_money'] = 'Nemate dovoljno novca',
['yourVersion'] = "Vaša verzija: ",
['latestVersion'] = "Koristite najnoviju verziju!",
['needUpdateResource'] = "Morate preuzeti najnoviju verziju! Trenutno koristite staru verziju!",
['errorGetCurrentVersion'] = "Došlo je do greške prilikom pokušaja dobavljanja trenutne verzije!"
}
4 changes: 4 additions & 0 deletions [esx_addons]/esx_dmvschool/locales/sv.lua
Original file line number Diff line number Diff line change
Expand Up @@ -27,4 +27,8 @@ Locales['sv'] = {
['errors'] = 'Misstag: ~r~%s/%s',
['you_damaged_veh'] = 'Du skadade fordonet',
['not_enough_money'] = 'Du har inte tillräckligt med pengar',
['yourVersion'] = "Din version: ",
['latestVersion'] = "Du använder den senaste versionen!",
['needUpdateResource'] = "Du måste ladda ner den senaste versionen! Du använder för närvarande en gammal version!",
['errorGetCurrentVersion'] = "Ett fel uppstod när den aktuella versionen försöktes hämtas!"
}
4 changes: 4 additions & 0 deletions [esx_addons]/esx_dmvschool/locales/tr.lua
Original file line number Diff line number Diff line change
Expand Up @@ -27,5 +27,9 @@ Locales['tr'] = {
['errors'] = 'Hatalar: ~r~%s/%s',
['you_damaged_veh'] = 'Araç hasar gördü',
['not_enough_money'] = 'Yeterli paranız yok',
['yourVersion'] = "Sürümünüz: ",
['latestVersion'] = "En son sürümü kullanıyorsunuz!",
['needUpdateResource'] = "En son sürümü indirmeniz gerekiyor! Şu anda eski bir sürüm kullanıyorsunuz!",
['errorGetCurrentVersion'] = "Mevcut sürüm alınmaya çalışılırken bir hata oluştu!"
}

4 changes: 4 additions & 0 deletions [esx_addons]/esx_dmvschool/locales/zh-cn.lua
Original file line number Diff line number Diff line change
Expand Up @@ -27,4 +27,8 @@ Locales['zh-cn'] = {
['errors'] = '失误: ~r~%s~s~/~g~%s~s~',
['you_damaged_veh'] = '载具出现受损!',
['not_enough_money'] = '您暂无足够现金',
['yourVersion'] = "你的版本:",
['latestVersion'] = "你正在使用最新版本!",
['needUpdateResource'] = "你需要下载最新版本!你当前使用的是旧版本!",
['errorGetCurrentVersion'] = "尝试获取当前版本时发生错误!"
}
95 changes: 95 additions & 0 deletions [esx_addons]/esx_dmvschool/server/updater.lua
Original file line number Diff line number Diff line change
@@ -0,0 +1,95 @@
DMV = DMV or {}

DMV.VersionCheckBaseURL = "https://raw.githubusercontent.com/esx-framework/ESX-Legacy-Addons/main/%5Besx_addons%5D/"

function DMV:ErrorHandle(msg)
local resourceName = GetCurrentResourceName()
print(("[^1ERROR^7] ^3%s^7: %s"):format(resourceName, msg))
end

function DMV:InfoHandle(msg, color)
local resourceName = GetCurrentResourceName()
local c = ({green=2, red=1, blue=4})[color] or 3
print(("[^9INFO^7] ^3%s^7: ^" .. c .. "%s^7"):format(resourceName, msg))
end

local function normalizeSemver(v)
if type(v) ~= "string" then return nil end
local three = v:match("%d+%.%d+%.%d+")
if three then return three end
local two = v:match("^%d+%.%d+$")
if two then return (two .. ".0") end
local one = v:match("^%d+$")
if one then return (one .. ".0.0") end
return nil
end

VERSION = {
Check = function(err, response, headers)
local resourceName = GetCurrentResourceName()
local currentVersion = GetResourceMetadata(resourceName, "version", 0)
if not currentVersion then return end

local manifestURL = DMV.VersionCheckBaseURL .. resourceName .. "/fxmanifest.lua"
DMV:InfoHandle(("Checking manifest from %s"):format(manifestURL), "blue")

if err ~= 200 or not response then
DMV:ErrorHandle(Translate("errorGetCurrentVersion"))
return
end

local remoteVersion = response:match("version%s+'([%d%.]+)'")
if not remoteVersion then
DMV:ErrorHandle(Translate("errorGetRemoteVersion"))
return
end

local latestVersion = normalizeSemver(remoteVersion)
currentVersion = normalizeSemver(currentVersion)

if not latestVersion or not currentVersion then
DMV:ErrorHandle(Translate("invalidVersion"))
return
end

if currentVersion == latestVersion then
DMV:InfoHandle(Translate("latestVersion"), "green")
DMV:InfoHandle(("Up to date version (%s)"):format(currentVersion), "green")
return
end

local currentVersionSplitted = { string.strsplit(".", currentVersion) }
local latestVersionSplitted = { string.strsplit(".", latestVersion) }

DMV:InfoHandle(Translate("currentVersion") .. latestVersion, "green")
DMV:InfoHandle(Translate("yourVersion") .. currentVersion, "blue")
DMV:InfoHandle(("Update available: remote %s > local %s"):format(latestVersion, currentVersion), "red")

for i = 1, #currentVersionSplitted do
local current, latest = tonumber(currentVersionSplitted[i]), tonumber(latestVersionSplitted[i])
if current ~= latest then
if not current or not latest then return end
if current < latest then
DMV:InfoHandle(Translate("needUpdateResource"), "red")
end
break
end
end
end,

RunVersionChecker = function()
CreateThread(function()
local resourceName = GetCurrentResourceName()
local manifestURL = DMV.VersionCheckBaseURL .. resourceName .. "/fxmanifest.lua"
PerformHttpRequest(manifestURL, VERSION.Check, "GET")
end)
end,
}

AddEventHandler("onResourceStart", function(resourceName)
local currentName = GetCurrentResourceName()
if resourceName ~= currentName then return end

Wait(100)
VERSION:RunVersionChecker()
end)