diff --git a/client/main.lua b/client/main.lua index 3a37fb7d..4def7780 100644 --- a/client/main.lua +++ b/client/main.lua @@ -101,7 +101,7 @@ function ReturnVehicleProvider() returnPrice = ESX.Math.Round(vehicles[i].price * 0.75) table.insert(elements, { - label = vehicles[i].name .. ' [$' .. returnPrice .. ']', + label = ('%s [%s]'):format(vehicles[i].name, _U('generic_shopitem', ESX.Math.GroupDigits(returnPrice))), value = vehicles[i].name }) end @@ -161,7 +161,7 @@ function OpenShopMenu() firstVehicleData = vehicle end - table.insert(options, vehicle.name .. ' $' .. vehicle.price .. '') + table.insert(options, ('%s %s'):format(vehicle.name, _U('generic_shopitem', ESX.Math.GroupDigits(vehicle.price)))) end table.insert(elements, { @@ -183,13 +183,13 @@ function OpenShopMenu() local vehicleData = vehiclesByCategory[data.current.name][data.current.value + 1] ESX.UI.Menu.Open('default', GetCurrentResourceName(), 'shop_confirm', { - title = _U('buy_vehicle_shop', vehicleData.name, vehicleData.price), + title = _U('buy_vehicle_shop', vehicleData.name, ESX.Math.GroupDigits(vehicleData.price)), align = 'top-left', elements = { - {label = _U('yes'), value = 'yes'}, {label = _U('no'), value = 'no'}, + {label = _U('yes'), value = 'yes'} } - }, function (data2, menu2) + }, function(data2, menu2) if data2.current.value == 'yes' then if Config.EnablePlayerManagement then ESX.TriggerServerCallback('esx_vehicleshop:buyVehicleSociety', function(hasEnoughMoney) @@ -234,7 +234,7 @@ function OpenShopMenu() if data3.current.value == 'personnal' then - ESX.TriggerServerCallback('esx_vehicleshop:buyVehicle', function (hasEnoughMoney) + ESX.TriggerServerCallback('esx_vehicleshop:buyVehicle', function(hasEnoughMoney) if hasEnoughMoney then IsInShopMenu = false @@ -615,7 +615,7 @@ function OpenPopVehicleMenu() for i=1, #vehicles, 1 do table.insert(elements, { - label = vehicles[i].name .. ' [MSRP $' .. vehicles[i].price .. ']', + label = ('%s [MSRP %s]'):format(vehicles[i].name, _U('generic_shopitem', ESX.Math.GroupDigits(vehicles[i].price))), value = vehicles[i].name }) end @@ -636,6 +636,7 @@ function OpenPopVehicleMenu() for i=1, #Vehicles, 1 do if model == Vehicles[i].model then CurrentVehicleData = Vehicles[i] + break end end end) @@ -651,7 +652,7 @@ function OpenRentedVehiclesMenu() for i=1, #vehicles, 1 do table.insert(elements, { - label = vehicles[i].playerName .. ' : ' .. vehicles[i].name .. ' - ' .. vehicles[i].plate, + label = ('%s: %s - %s'):format(vehicles[i].playerName, vehicles[i].name, vehicles[i].plate), value = vehicles[i].name }) end @@ -673,7 +674,7 @@ function OpenBossActionsMenu() title = _U('dealer_boss'), align = 'top-left', elements = { - {label = _U('boss_actions'), value = 'boss_actions'} + {label = _U('boss_actions'), value = 'boss_actions'} } }, function (data, menu) if data.current.value == 'boss_actions' then @@ -697,7 +698,10 @@ function OpenGetStocksMenu() local elements = {} for i=1, #items, 1 do - table.insert(elements, {label = 'x' .. items[i].count .. ' ' .. items[i].label, value = items[i].name}) + table.insert(elements, { + label = 'x' .. items[i].count .. ' ' .. items[i].label, + value = items[i].name + }) end ESX.UI.Menu.Open('default', GetCurrentResourceName(), 'stocks_menu', { @@ -850,7 +854,7 @@ AddEventHandler('esx_vehicleshop:hasEnteredMarker', function (zone) local resellPrice = math.floor(vehicleData.price / 100 * Config.ResellPercentage) CurrentAction = 'resell_vehicle' - CurrentActionMsg = _U('sell_menu', vehicleData.name, resellPrice) + CurrentActionMsg = _U('sell_menu', vehicleData.name, ESX.Math.GroupDigits(resellPrice)) CurrentActionData = { vehicle = vehicle, diff --git a/client/utils.lua b/client/utils.lua index ec8992de..cfb4b114 100644 --- a/client/utils.lua +++ b/client/utils.lua @@ -37,7 +37,7 @@ end function IsPlateTaken(plate) local callback = 'waiting' - ESX.TriggerServerCallback('esx_vehicleshop:isPlateTaken', function (isPlateTaken) + ESX.TriggerServerCallback('esx_vehicleshop:isPlateTaken', function(isPlateTaken) callback = isPlateTaken end, plate) diff --git a/locales/br.lua b/locales/br.lua index 7b8be885..f5a394b5 100644 --- a/locales/br.lua +++ b/locales/br.lua @@ -34,6 +34,7 @@ Locales['br'] = { ['set_vehicle_owner_rent'] = 'Atribuir veículo [Alugar]', ['set_vehicle_owner_sell'] = 'Veículos para [Venda]', ['shop_menu'] = 'pressione ~INPUT_CONTEXT~ para acessar o menu ~y~%s~s~ pela quantidade de ~g~$%s~s~', + ['generic_shopitem'] = '$%s', ['vehicle'] = 'veículo ', ['vehicle_dealer'] = 'Veículo - Concessionária', ['vehicle_menu'] = 'Pressione ~INPUT_CONTEXT~ para fazer o seu veículo', diff --git a/locales/de.lua b/locales/de.lua index 9a460209..dc0564f0 100644 --- a/locales/de.lua +++ b/locales/de.lua @@ -35,6 +35,7 @@ Locales['de'] = { ['set_vehicle_owner_sell'] = 'Fahrzeuge [Verkauf]', ['set_vehicle_owner_sell_society'] = 'Fahrzeuge [Verkauf] [Society]', ['shop_menu'] = 'Drücke ~INPUT_CONTEXT~ um das Menü zu öffnen', + ['generic_shopitem'] = '$%s', ['vehicle'] = 'Fahrzeug ', ['vehicle_dealer'] = 'Autohändler', ['vehicle_menu'] = 'Drücke ~INPUT_CONTEXT~ um ein Fahrzeug zu übergeben', diff --git a/locales/en.lua b/locales/en.lua index d7ea8eca..c78b3f56 100644 --- a/locales/en.lua +++ b/locales/en.lua @@ -40,6 +40,7 @@ Locales['en'] = { ['set_vehicle_owner_sell'] = 'sell vehicle', ['set_vehicle_owner_sell_society'] = 'assign Vehicle [Sale] [Society]', ['shop_menu'] = 'press ~INPUT_CONTEXT~ to access the menu', + ['generic_shopitem'] = '$%s', ['vehicle_dealer'] = 'vehicle - Car Dealer', ['vehicle_menu'] = 'press ~INPUT_CONTEXT~ to give back the rented vehicle', ['vehicle_purchased'] = 'you bought a vehicle', diff --git a/locales/fi.lua b/locales/fi.lua index 2e4a2aaf..7276b49f 100644 --- a/locales/fi.lua +++ b/locales/fi.lua @@ -40,6 +40,7 @@ Locales['fi'] = { ['set_vehicle_owner_sell'] = 'myy ajoneuvo', ['set_vehicle_owner_sell_society'] = 'määritä ajoneuvon [Hinta] [Firma]', ['shop_menu'] = 'paina ~INPUT_CONTEXT~ avataksesi menu', + ['generic_shopitem'] = '$%s', ['vehicle_dealer'] = 'ajonevuo - Autokauppa', ['vehicle_menu'] = 'paina ~INPUT_CONTEXT~ tehdäksesi tästä sinun ajoneuvo', ['vehicle_purchased'] = 'sinä ostit ajoneuvon', diff --git a/locales/fr.lua b/locales/fr.lua index 3042bc63..ccf25184 100644 --- a/locales/fr.lua +++ b/locales/fr.lua @@ -38,6 +38,7 @@ Locales['fr'] = { ['set_vehicle_owner_sell'] = 'Attribuer véhicule [Vente]', ['set_vehicle_owner_sell_society'] = 'Attribuer véhicule [Vente] [Société]', ['shop_menu'] = 'Appuez sur ~INPUT_CONTEXT~ pour accéder au menu', + ['generic_shopitem'] = '$%s', ['vehicle'] = 'Le véhicule', ['vehicle_dealer'] = 'Concessionnaire - Véhicules', ['vehicle_menu'] = 'Appuez sur ~INPUT_CONTEXT~ pour rendre votre véhicule', diff --git a/locales/pl.lua b/locales/pl.lua index ac65145e..06eed3df 100644 --- a/locales/pl.lua +++ b/locales/pl.lua @@ -38,6 +38,7 @@ Locales['pl'] = { ['set_vehicle_owner_sell'] = 'zarejestruj pojazd [Kupno]', ['set_vehicle_owner_sell_society'] = 'zarejestruj pojazd [Firmowe]', ['shop_menu'] = 'wcisnij ~INPUT_CONTEXT~ aby wejść do menu', + ['generic_shopitem'] = '$%s', ['the_boss'] = 'szef', ['vehicle_dealer'] = 'pojazdy - Sprzedawca aut', ['vehicle_menu'] = 'wcisnij ~INPUT_CONTEXT~ aby wyjąć pojazd', diff --git a/locales/sv.lua b/locales/sv.lua index c0483371..ce064351 100644 --- a/locales/sv.lua +++ b/locales/sv.lua @@ -8,7 +8,7 @@ Locales['sv'] = { ['purchase_type'] = 'till vem är fordonet?', ['society_type'] = 'företag', ['staff_type'] = 'personlig användning', - ['buy_vehicle_shop'] = 'Vill du köpa in %s för $%s?', + ['buy_vehicle_shop'] = 'vill du köpa in %s för %s SEK?', ['buy_vehicle'] = 'Köp in fordon', ['car_dealer'] = 'Bilhandlaren', ['create_bill'] = 'Ge faktura', @@ -28,25 +28,26 @@ Locales['sv'] = { ['not_enough_money'] = 'Du har inte tillräckligt mycket pengar', ['not_rental'] = 'Detta är inte ett ~r~uthyrt fordon~s~', ['not_yours'] = 'Det här fordonet tillhör inte dig', - ['paid_rental'] = 'du har ~y~betalat~s~ ditt hyrda fordon: ~g~$%s~s~', + ['paid_rental'] = 'du har ~y~betalat~s~ ditt hyrda fordon: ~g~%s SEK~s~', ['personal_vehicle'] = 'Privat fordon', ['pop_vehicle'] = 'Ställ ut fordon till salu', ['recruit'] = 'Anställ', ['rent_vehicle'] = 'bilförsäljare - Fordon för uthyrning', ['return_provider_menu'] = 'bilförsäljare - sälj tillbaka fordon till leverantör', ['rental_amount'] = 'Uthyrningsbelopp', - ['sell_menu'] = 'Tryck ~INPUT_CONTEXT~ för att sälja ~y~%s~s~ för ~g~$%s~s~', + ['sell_menu'] = 'Tryck ~INPUT_CONTEXT~ för att sälja ~y~%s~s~ för ~g~%s SEK~s~', ['set_vehicle_owner_rent'] = 'hyr ut fordon', ['set_vehicle_owner_sell'] = 'Sälj fordon', ['set_vehicle_owner_sell_society'] = 'sälj fordon till företag', ['shop_menu'] = 'Tryck ~INPUT_CONTEXT~ för att få fram menyn', + ['generic_shopitem'] = '%s SEK', ['vehicle_dealer'] = 'vehicle - Car Dealer', ['vehicle_menu'] = 'tryck på ~INPUT_CONTEXT~ för att ~o~lämna tillbaka~s~ fordonet till bilförsäljaren.', ['vehicle_purchased'] = 'Du köpte fordonet', ['vehicle_set_owned'] = 'Fordonet ~y~%s~s~ har tilldelats till ~b~%s~s~', ['vehicle_set_rented'] = 'Fordonet ~y~%s~s~ har hyrts ut till ~b~%s~s~', ['vehicle_sold'] = 'Fordonet har ~g~sålts~s~', - ['vehicle_sold_for'] = '~b~%s~s~ har ~y~sålts~s~ för ~g~$%s~s~', + ['vehicle_sold_for'] = '~b~%s~s~ har ~y~sålts~s~ för ~g~%s SEK~s~', ['vehicle_sold_to'] = '~y~%s~s~ har sålts till ~b~%s~s~', ['wash_money'] = 'Tvätta pengar', ['withdraw_amount'] = 'Belopp att ta ut', diff --git a/server/main.lua b/server/main.lua index 758d5798..18473003 100644 --- a/server/main.lua +++ b/server/main.lua @@ -45,8 +45,7 @@ AddEventHandler('esx_vehicleshop:setVehicleOwned', function (vehicleProps) ['@owner'] = xPlayer.identifier, ['@plate'] = vehicleProps.plate, ['@vehicle'] = json.encode(vehicleProps) - }, - function (rowsChanged) + }, function (rowsChanged) TriggerClientEvent('esx:showNotification', _source, _U('vehicle_belongs', vehicleProps.plate)) end) end) @@ -60,8 +59,7 @@ AddEventHandler('esx_vehicleshop:setVehicleOwnedPlayerId', function (playerId, v ['@owner'] = xPlayer.identifier, ['@plate'] = vehicleProps.plate, ['@vehicle'] = json.encode(vehicleProps) - }, - function (rowsChanged) + }, function (rowsChanged) TriggerClientEvent('esx:showNotification', playerId, _U('vehicle_belongs', vehicleProps.plate)) end) end) @@ -76,8 +74,7 @@ AddEventHandler('esx_vehicleshop:setVehicleOwnedSociety', function (society, veh ['@owner'] = 'society:' .. society, ['@plate'] = vehicleProps.plate, ['@vehicle'] = json.encode(vehicleProps), - }, - function (rowsChanged) + }, function (rowsChanged) end) end) @@ -117,7 +114,7 @@ AddEventHandler('esx_vehicleshop:rentVehicle', function (vehicle, plate, playerN ['@player_name'] = playerName, ['@base_price'] = basePrice, ['@rent_price'] = rentPrice, - ['@owner'] = owner, + ['@owner'] = owner }) end) end) @@ -212,13 +209,15 @@ ESX.RegisterServerCallback('esx_vehicleshop:buyVehicleSociety', function (source TriggerEvent('esx_addonaccount:getSharedAccount', 'society_' .. society, function (account) if account.money >= vehicleData.price then account.removeMoney(vehicleData.price) + MySQL.Async.execute('INSERT INTO cardealer_vehicles (vehicle, price) VALUES (@vehicle, @price)', { ['@vehicle'] = vehicleData.model, ['@price'] = vehicleData.price - }) + }, function(rowsChanged) + cb(true) + end) - cb(true) else cb(false) end @@ -278,9 +277,10 @@ AddEventHandler('esx_vehicleshop:returnProvider', function(vehicleModel) ['@id'] = id }) - TriggerClientEvent('esx:showNotification', _source, _U('vehicle_sold_for', vehicleModel, price)) + TriggerClientEvent('esx:showNotification', _source, _U('vehicle_sold_for', vehicleModel, ESX.Math.GroupDigits(price))) else - print('esx_vehicleshop: ' .. GetPlayerIdentifiers(_source)[1] .. ' attempted selling an invalid vehicle!') + + print(('esx_vehicleshop: %s attempted selling an invalid vehicle!'):format(GetPlayerIdentifiers(_source)[1])) end end) @@ -413,7 +413,7 @@ function PayRent(d, h, m) -- message player if connected if xPlayer ~= nil then xPlayer.removeAccountMoney('bank', result[i].rent_price) - TriggerClientEvent('esx:showNotification', xPlayer.source, _U('paid_rental', result[i].rent_price)) + TriggerClientEvent('esx:showNotification', xPlayer.source, _U('paid_rental', ESX.Math.GroupDigits(result[i].rent_price))) else -- pay rent either way MySQL.Sync.execute('UPDATE users SET bank = bank - @bank WHERE identifier = @identifier', {