From e8a0f07296b22f358a4b4ad9b195ba149e70eae9 Mon Sep 17 00:00:00 2001 From: ElPumpo Date: Mon, 9 Apr 2018 12:56:27 +0200 Subject: [PATCH] Improved string formatting, minor edits --- client/main.lua | 29 ++++++++++++++--------------- locales/en.lua | 22 +++++++++++----------- locales/fr.lua | 14 +++++++------- localization/sv_esx_dmvschool.sql | 8 ++++++++ server/main.lua | 31 +++++++++++++------------------ 5 files changed, 53 insertions(+), 51 deletions(-) create mode 100644 localization/sv_esx_dmvschool.sql diff --git a/client/main.lua b/client/main.lua index e2ee0cf9..934923e7 100644 --- a/client/main.lua +++ b/client/main.lua @@ -125,21 +125,21 @@ function OpenDMVSchoolMenu() local elements = {} if not ownedLicenses['dmv'] then - table.insert(elements, {label = _U('theory_test') .. Config.Prices['dmv'], value = 'theory_test'}) + table.insert(elements, {label = _U('theory_test') .. ' $' .. Config.Prices['dmv'] .. '', value = 'theory_test'}) end if ownedLicenses['dmv'] then if not ownedLicenses['drive'] then - table.insert(elements, {label = _U('road_test_car') .. Config.Prices['drive'], value = 'drive_test', type = 'drive'}) + table.insert(elements, {label = _U('road_test_car') .. ' $' .. Config.Prices['drive'] .. '', value = 'drive_test', type = 'drive'}) end if not ownedLicenses['drive_bike'] then - table.insert(elements, {label = _U('road_test_bike') .. Config.Prices['drive_bike'], value = 'drive_test', type = 'drive_bike'}) + table.insert(elements, {label = _U('road_test_bike') .. ' $' .. Config.Prices['drive_bike'] .. '', value = 'drive_test', type = 'drive_bike'}) end if not ownedLicenses['drive_truck'] then - table.insert(elements, {label = _U('road_test_truck') .. Config.Prices['drive_truck'], value = 'drive_test', type = 'drive_truck'}) + table.insert(elements, {label = _U('road_test_truck') .. ' $' .. Config.Prices['drive_truck'] .. '', value = 'drive_test', type = 'drive_truck'}) end end @@ -239,7 +239,7 @@ end) Citizen.CreateThread(function() while true do - Citizen.Wait(0) + Citizen.Wait(10) local coords = GetEntityCoords(GetPlayerPed(-1)) @@ -256,7 +256,7 @@ end) Citizen.CreateThread(function() while true do - Citizen.Wait(0) + Citizen.Wait(10) local coords = GetEntityCoords(GetPlayerPed(-1)) local isInMarker = false @@ -287,7 +287,7 @@ end) Citizen.CreateThread(function() while true do - Citizen.Wait(0) + Citizen.Wait(10) if CurrentTest == 'theory' then @@ -308,7 +308,7 @@ end) Citizen.CreateThread(function() while true do - Citizen.Wait(0) + Citizen.Wait(10) if CurrentAction ~= nil then @@ -335,7 +335,7 @@ end) Citizen.CreateThread(function() while true do - Citizen.Wait(0) + Citizen.Wait(10) if CurrentTest == 'drive' then @@ -394,7 +394,7 @@ end) Citizen.CreateThread(function() while true do - Citizen.Wait(0) + Citizen.Wait(10) if CurrentTest == 'drive' then @@ -416,8 +416,8 @@ Citizen.CreateThread(function() DriveErrors = DriveErrors + 1 IsAboveSpeedLimit = true - ESX.ShowNotification(_U('driving_too_fast') .. v .. 'km/h') - ESX.ShowNotification(_U('errors') .. DriveErrors .. '~s~/' .. Config.MaxErrors) + ESX.ShowNotification(_U('driving_too_fast', v)) + ESX.ShowNotification(_U('errors', DriveErrors, Config.MaxErrors)) end @@ -435,9 +435,8 @@ Citizen.CreateThread(function() DriveErrors = DriveErrors + 1 ESX.ShowNotification(_U('you_damaged_veh')) - ESX.ShowNotification(_U('errors') .. DriveErrors .. '~s~/' .. Config.MaxErrors) - LastVehicleHealth = health - + ESX.ShowNotification(_U('errors', DriveErrors, Config.MaxErrors)) + LastVehicleHealth = health end end diff --git a/locales/en.lua b/locales/en.lua index 646f8839..7a22e717 100644 --- a/locales/en.lua +++ b/locales/en.lua @@ -1,6 +1,6 @@ Locales['en'] = { - ['you_paid'] = 'you paid ~g~$', + ['you_paid'] = 'you paid ~g~$%s~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: ~y~', ['next_point_speed'] = 'go to the next point! Speed Limit: ~y~', @@ -8,22 +8,22 @@ Locales['en'] = { ['good_lets_cont'] = '~g~Good~s~, continue.', ['stop_look_left'] = '~r~Stop~s~ and look ~y~left~s~. Speed Limit:~y~ ', ['good_turn_right'] = '~g~Good~s~, turn right and follow the line', - ['watch_traffic_lightson'] = 'watch traffic, and ~y~turn on your lights~s~!', + ['watch_traffic_lightson'] = 'watch the traffic and ~y~turn on your lights~s~!', ['stop_for_passing'] = '~r~Stop~s~ for passing vehicles!', ['hway_time'] = 'it\'s time to drive on the highway! Speed Limit:~y~ ', - ['gratz_stay_alert'] = 'congrats, stay ~r~alert~s~ whilst driving!', - ['passed_test'] = 'you ~g~passed~s~ the test', - ['failed_test'] = 'you ~r~failed~s~ the test', - ['theory_test'] = 'theoretical Driving Test $', - ['road_test_car'] = 'driving Test $', - ['road_test_bike'] = 'motorcycle Skills Test $', - ['road_test_truck'] = 'cDL Skills Test $', + ['gratz_stay_alert'] = 'i\'m impressed, but don\'t forget to stay ~r~alert~s~ whilst driving!', + ['passed_test'] = 'you ~g~passed~s~ the test, congratulations!', + ['failed_test'] = 'you ~r~failed~s~ 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', ['driving_school'] = 'driving School', ['press_open_menu'] = 'press ~INPUT_CONTEXT~ to open the menu', ['driving_school_blip'] = 'driving School', ['driving_test_complete'] = 'driving test completed', - ['driving_too_fast'] = '~r~You\'re driving too fast!~s~ Speed Limit:~y~ ', - ['errors'] = 'errors: ~r~', + ['driving_too_fast'] = '~r~You\'re driving too fast,~s~ the current speed limit is: ~y~%s~s~ km/h!', + ['errors'] = 'mistakes: ~r~%s~s~/%s', ['you_damaged_veh'] = 'you damaged the vehicle', } diff --git a/locales/fr.lua b/locales/fr.lua index c0d75435..6c34d87e 100644 --- a/locales/fr.lua +++ b/locales/fr.lua @@ -1,6 +1,6 @@ Locales['fr'] = { - ['you_paid'] = 'vous avez payé ~g~$', + ['you_paid'] = 'vous avez payé ~g~$%s~s~', ['go_next_point'] = 'allez vers le prochain passage !', ['in_town_speed'] = 'entrée en ville, attention à votre vitesse ! Vitesse limite : ~y~', ['next_point_speed'] = 'allez vers le prochain passage ! Vitesse limite : ~y~', @@ -14,16 +14,16 @@ Locales['fr'] = { ['gratz_stay_alert'] = 'bravo, restez vigiliant!', ['passed_test'] = 'vous avez ~g~réussi~s~ le test', ['failed_test'] = 'vous avez ~r~raté~s~ le test', - ['theory_test'] = 'examen du code $', - ['road_test_car'] = 'examen de conduite [voiture] $', - ['road_test_bike'] = 'examen de conduite [moto] $', - ['road_test_truck'] = 'examen de conduite [camion] $', + ['theory_test'] = 'examen du code', + ['road_test_car'] = 'examen de conduite [voiture]', + ['road_test_bike'] = 'examen de conduite [moto]', + ['road_test_truck'] = 'examen de conduite [camion]', ['driving_school'] = 'ecole de conduite', ['press_open_menu'] = 'appuyez sur ~INPUT_CONTEXT~ pour ouvrir le menu', ['driving_school_blip'] = 'auto-école', ['driving_test_complete'] = 'test de conduite terminé', - ['driving_too_fast'] = 'vous roulez trop vite, vitesse limite : ~y~', - ['errors'] = 'erreurs : ~r~', + ['driving_too_fast'] = 'vous roulez trop vite, vitesse limite: ~y~%s~s~ km/h!', + ['errors'] = 'erreurs : ~r~%s~s~/%s', ['you_damaged_veh'] = 'vous avez endommagé votre véhicule', } diff --git a/localization/sv_esx_dmvschool.sql b/localization/sv_esx_dmvschool.sql new file mode 100644 index 00000000..becaf0ff --- /dev/null +++ b/localization/sv_esx_dmvschool.sql @@ -0,0 +1,8 @@ +USE `essentialmode`; + +INSERT INTO `licenses` (`type`, `label`) VALUES + ('dmv', 'Körkortstillstånd'), + ('drive', 'B-körkort'), + ('drive_bike', 'A-körkort'), + ('drive_truck', 'C-körkort') +; diff --git a/server/main.lua b/server/main.lua index 2906c7d7..dd364795 100644 --- a/server/main.lua +++ b/server/main.lua @@ -3,32 +3,27 @@ ESX = nil TriggerEvent('esx:getSharedObject', function(obj) ESX = obj end) AddEventHandler('esx:playerLoaded', function(source) - TriggerEvent('esx_license:getLicenses', source, function(licenses) - TriggerClientEvent('esx_dmvschool:loadLicenses', source, licenses) - end) + TriggerEvent('esx_license:getLicenses', source, function(licenses) + TriggerClientEvent('esx_dmvschool:loadLicenses', source, licenses) + end) end) RegisterNetEvent('esx_dmvschool:addLicense') AddEventHandler('esx_dmvschool:addLicense', function(type) + local _source = source - local _source = source - - TriggerEvent('esx_license:addLicense', _source, type, function() - TriggerEvent('esx_license:getLicenses', _source, function(licenses) - TriggerClientEvent('esx_dmvschool:loadLicenses', _source, licenses) - end) - end) - + TriggerEvent('esx_license:addLicense', _source, type, function() + TriggerEvent('esx_license:getLicenses', _source, function(licenses) + TriggerClientEvent('esx_dmvschool:loadLicenses', _source, licenses) + end) + end) end) RegisterNetEvent('esx_dmvschool:pay') AddEventHandler('esx_dmvschool:pay', function(price) + local _source = source + local xPlayer = ESX.GetPlayerFromId(_source) - local _source = source - local xPlayer = ESX.GetPlayerFromId(_source) - - xPlayer.removeMoney(price) - - TriggerClientEvent('esx:showNotification', _source, _U('you_paid') .. price) - + xPlayer.removeMoney(price) + TriggerClientEvent('esx:showNotification', _source, _U('you_paid', price)) end)