From f4265fec52b27ec7513858985b7e8938f35e8423 Mon Sep 17 00:00:00 2001 From: ElPumpo Date: Sat, 9 Mar 2019 16:53:25 +0100 Subject: [PATCH] Use vector types, digit grouping, improved threads, locale file indent --- __resource.lua | 2 +- client/main.lua | 62 +++++++++++++++---------------- client/marker.lua | 94 +++++++++++++++++++---------------------------- config.lua | 52 +++++++++++++------------- locales/en.lua | 52 +++++++++++++------------- locales/sv.lua | 52 +++++++++++++------------- server/main.lua | 6 +-- 7 files changed, 147 insertions(+), 173 deletions(-) diff --git a/__resource.lua b/__resource.lua index 1a9cc5d8..3c677db1 100644 --- a/__resource.lua +++ b/__resource.lua @@ -2,7 +2,7 @@ resource_manifest_version '44febabe-d386-4d18-afbe-5e627f4af937' description 'ESX Boat' -version '0.1.0' +version '0.5.0' server_scripts { '@mysql-async/lib/MySQL.lua', diff --git a/client/main.lua b/client/main.lua index 4132c970..488de03d 100644 --- a/client/main.lua +++ b/client/main.lua @@ -10,7 +10,7 @@ Keys = { ["NENTER"] = 201, ["N4"] = 108, ["N5"] = 60, ["N6"] = 107, ["N+"] = 96, ["N-"] = 97, ["N7"] = 117, ["N8"] = 61, ["N9"] = 118 } -ESX = nil +ESX = nil isInShopMenu = false local spawnedVehicles = {} @@ -35,17 +35,15 @@ function OpenBoatShop(shop) local elements = {} for i=1, #Config.Vehicles, 1 do - table.insert(elements, { - label = (string.format ('%s - $%i', Config.Vehicles[i].label, Config.Vehicles[i].price)), + label = ('%s - $%s'):format(Config.Vehicles[i].label, ESX.Math.GroupDigits(Config.Vehicles[i].price)), name = Config.Vehicles[i].label, model = Config.Vehicles[i].model, price = Config.Vehicles[i].price }) end - ESX.UI.Menu.Open('default', GetCurrentResourceName(), 'boat_shop', - { + ESX.UI.Menu.Open('default', GetCurrentResourceName(), 'boat_shop', { title = _U('boat_shop'), align = 'top-left', elements = elements @@ -53,7 +51,7 @@ function OpenBoatShop(shop) ESX.UI.Menu.Open('default', GetCurrentResourceName(), 'boat_shop_confirm', { - title = _U('boat_shop_confirm', data.current.name, data.current.price), + title = _U('boat_shop_confirm', data.current.name, ESX.Math.GroupDigits(data.current.price)), align = 'top-left', elements = { { label = _U('confirm_no'), value = 'no' }, @@ -72,15 +70,15 @@ function OpenBoatShop(shop) ESX.TriggerServerCallback('esx_boat:buyBoat', function (bought) if bought then - ESX.ShowNotification(_U('boat_shop_bought', data.current.name, data.current.price)) + ESX.ShowNotification(_U('boat_shop_bought', data.current.name, ESX.Math.GroupDigits(data.current.price))) DeleteSpawnedVehicles() isInShopMenu = false ESX.UI.Menu.CloseAll() - CurrentAction = 'boat_shop' - CurrentActionMsg = _U('boat_shop_open') - + CurrentAction = 'boat_shop' + CurrentActionMsg = _U('boat_shop_open') + FreezeEntityPosition(playerPed, false) SetEntityVisible(playerPed, true) SetEntityCoords(playerPed, shop.Outside.x, shop.Outside.y, shop.Outside.z) @@ -88,7 +86,7 @@ function OpenBoatShop(shop) ESX.ShowNotification(_U('boat_shop_nomoney')) menu2.close() end - + end, props) else @@ -104,8 +102,8 @@ function OpenBoatShop(shop) isInShopMenu = false DeleteSpawnedVehicles() - CurrentAction = 'boat_shop' - CurrentActionMsg = _U('boat_shop_open') + CurrentAction = 'boat_shop' + CurrentActionMsg = _U('boat_shop_open') FreezeEntityPosition(playerPed, false) SetEntityVisible(playerPed, true) @@ -113,8 +111,8 @@ function OpenBoatShop(shop) end, function (data, menu) DeleteSpawnedVehicles() - - ESX.Game.SpawnLocalVehicle(data.current.model, shop.Inside, shop.Inside.h, function (vehicle) + + ESX.Game.SpawnLocalVehicle(data.current.model, shop.Inside, shop.Inside.w, function (vehicle) table.insert(spawnedVehicles, vehicle) TaskWarpPedIntoVehicle(playerPed, vehicle, -1) FreezeEntityPosition(vehicle, true) @@ -123,7 +121,8 @@ function OpenBoatShop(shop) -- spawn first vehicle DeleteSpawnedVehicles() - ESX.Game.SpawnLocalVehicle(Config.Vehicles[1].model, shop.Inside, shop.Inside.h, function (vehicle) + + ESX.Game.SpawnLocalVehicle(Config.Vehicles[1].model, shop.Inside, shop.Inside.w, function (vehicle) table.insert(spawnedVehicles, vehicle) TaskWarpPedIntoVehicle(playerPed, vehicle, -1) FreezeEntityPosition(vehicle, true) @@ -141,28 +140,29 @@ function OpenBoatGarage(garage) -- get all available boats local elements = {} for i=1, #ownedBoats, 1 do + ownedBoats[i] = json.decode(ownedBoats[i]) + table.insert(elements, { - label = getVehicleLabelFromHash(ownedBoats[i].model), + label = getVehicleLabelFromHash(ownedBoats[i].model), vehicleProps = ownedBoats[i] }) end - ESX.UI.Menu.Open('default', GetCurrentResourceName(), 'boat_garage', - { + ESX.UI.Menu.Open('default', GetCurrentResourceName(), 'boat_garage', { title = _U('garage'), align = 'top-left', elements = elements }, function (data, menu) -- make sure the spawn point isn't blocked - local playerPed = PlayerPedId() + local playerPed = PlayerPedId() local vehicleProps = data.current.vehicleProps if ESX.Game.IsSpawnPointClear(garage.SpawnPoint, 4.0) then TriggerServerEvent('esx_boat:takeOutVehicle', vehicleProps.plate) ESX.ShowNotification(_U('garage_taken')) - ESX.Game.SpawnVehicle(vehicleProps.model, garage.SpawnPoint, garage.SpawnPoint.h, function(vehicle) + ESX.Game.SpawnVehicle(vehicleProps.model, garage.SpawnPoint, garage.SpawnPoint.w, function(vehicle) TaskWarpPedIntoVehicle(playerPed, vehicle, -1) ESX.Game.SetVehicleProperties(vehicle, vehicleProps) end) @@ -172,7 +172,6 @@ function OpenBoatGarage(garage) ESX.ShowNotification(_U('garage_blocked')) end - end, function (data, menu) menu.close() @@ -185,19 +184,18 @@ function OpenBoatGarage(garage) end function OpenLicenceMenu(shop) - ESX.UI.Menu.Open('default', GetCurrentResourceName(), 'boat_license', - { + ESX.UI.Menu.Open('default', GetCurrentResourceName(), 'boat_license', { title = _U('license_menu'), align = 'top-left', elements = { { label = _U('license_buy_no'), value = 'no' }, - { label = _U('license_buy_yes', Config.LicensePrice), value = 'yes' } + { label = _U('license_buy_yes', ESX.Math.GroupDigits(Config.LicensePrice)), value = 'yes' } } }, function (data, menu) if data.current.value == 'yes' then ESX.TriggerServerCallback('esx_boat:buyBoatLicense', function (boughtLicense) if boughtLicense then - ESX.ShowNotification(_U('license_bought', Config.LicensePrice)) + ESX.ShowNotification(_U('license_bought', ESX.Math.GroupDigits(Config.LicensePrice))) menu.close() OpenBoatShop(shop) -- parse current shop @@ -206,19 +204,18 @@ function OpenLicenceMenu(shop) end end) else - CurrentAction = 'boat_shop' - CurrentActionMsg = _U('boat_shop_open') + CurrentAction = 'boat_shop' + CurrentActionMsg = _U('boat_shop_open') menu.close() end end, function (data, menu) - CurrentAction = 'boat_shop' - CurrentActionMsg = _U('boat_shop_open') + CurrentAction = 'boat_shop' + CurrentActionMsg = _U('boat_shop_open') menu.close() end) end function StoreBoatInGarage(vehicle, teleportCoords) - local vehicleProps = ESX.Game.GetVehicleProperties(vehicle) ESX.TriggerServerCallback('esx_boat:storeVehicle', function (rowsChanged) @@ -228,13 +225,12 @@ function StoreBoatInGarage(vehicle, teleportCoords) local playerPed = PlayerPedId() ESX.Game.Teleport(playerPed, teleportCoords, function() - SetEntityHeading(playerPed, teleportCoords.h) + SetEntityHeading(playerPed, teleportCoords.w) end) else ESX.ShowNotification(_U('garage_notowner')) end end, vehicleProps.plate) - end -- Key controls diff --git a/client/marker.lua b/client/marker.lua index cdc488c8..fd850ff0 100644 --- a/client/marker.lua +++ b/client/marker.lua @@ -79,83 +79,60 @@ AddEventHandler('esx_boat:hasExitedMarker', function() CurrentAction = nil end) --- Draw markers -Citizen.CreateThread(function() - while true do - - Citizen.Wait(1) - - local playerPed = PlayerPedId() - local coords = GetEntityCoords(playerPed) - - for i=1, #Config.Zones.BoatShops, 1 do - -- draw boat shop marker - local zone = Config.Zones.BoatShops[i].Outside - if GetDistanceBetweenCoords(coords, zone.x, zone.y, zone.z, true) < Config.DrawDistance then - DrawMarker(Config.MarkerType, zone.x, zone.y, zone.z, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, Config.Marker.x, Config.Marker.y, Config.Marker.z, Config.Marker.r, Config.Marker.g, Config.Marker.b, 100, false, true, 2, false, false, false, false) - end - end - - for i=1, #Config.Zones.Garages, 1 do - -- draw garage maker - local zoneOut = Config.Zones.Garages[i].GaragePos - if GetDistanceBetweenCoords(coords, zoneOut.x, zoneOut.y, zoneOut.z, true) < Config.DrawDistance then - DrawMarker(Config.MarkerType, zoneOut.x, zoneOut.y, zoneOut.z, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, Config.Marker.x, Config.Marker.y, Config.Marker.z, Config.Marker.r, Config.Marker.g, Config.Marker.b, 100, false, true, 2, false, false, false, false) - end - - -- draw store marker - local zoneIn = Config.Zones.Garages[i].StorePos - if GetDistanceBetweenCoords(coords, zoneIn.x, zoneIn.y, zoneIn.z, true) < Config.DrawDistance then - DrawMarker(Config.MarkerType, zoneIn.x, zoneIn.y, zoneIn.z, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, Config.StoreMarker.x, Config.StoreMarker.y, Config.StoreMarker.z, Config.StoreMarker.r, Config.StoreMarker.g, Config.StoreMarker.b, 100, false, true, 2, false, false, false, false) - end - end - - end -end) - -- Enter / Exit marker events Citizen.CreateThread(function() - while true do + Citizen.Wait(0) - Citizen.Wait(1) - - local playerPed = PlayerPedId() - local coords = GetEntityCoords(playerPed) - local isInMarker = false - local currentZone = nil - local currentZoneNum = nil + local playerPed = PlayerPedId() + local coords = GetEntityCoords(playerPed) + local isInMarker, hasExited, letSleep = false, false, true + local currentZone, currentZoneNum for i=1, #Config.Zones.BoatShops, 1 do + local distance = GetDistanceBetweenCoords(coords, Config.Zones.BoatShops[i].Outside, true) - if GetDistanceBetweenCoords(coords, Config.Zones.BoatShops[i].Outside.x, Config.Zones.BoatShops[i].Outside.y, Config.Zones.BoatShops[i].Outside.z, true) < Config.Marker.x then + if distance < Config.DrawDistance then + DrawMarker(Config.MarkerType, Config.Zones.BoatShops[i].Outside, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, Config.Marker.x, Config.Marker.y, Config.Marker.z, Config.Marker.r, Config.Marker.g, Config.Marker.b, 100, false, true, 2, false, nil, nil, false) + letSleep = false + end + + if distance < Config.Marker.x then isInMarker = true currentZone = 'boat_shop' currentZoneNum = i end - end for i=1, #Config.Zones.Garages, 1 do + local distance = GetDistanceBetweenCoords(coords, Config.Zones.Garages[i].GaragePos, true) - if GetDistanceBetweenCoords(coords, Config.Zones.Garages[i].GaragePos.x, Config.Zones.Garages[i].GaragePos.y, Config.Zones.Garages[i].GaragePos.z, true) < Config.Marker.x then + if distance < Config.DrawDistance then + DrawMarker(Config.MarkerType, Config.Zones.Garages[i].GaragePos, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, Config.Marker.x, Config.Marker.y, Config.Marker.z, Config.Marker.r, Config.Marker.g, Config.Marker.b, 100, false, true, 2, false, nil, nil, false) + letSleep = false + end + + if distance < Config.Marker.x then isInMarker = true currentZone = 'garage_out' currentZoneNum = i end - if GetDistanceBetweenCoords(coords, Config.Zones.Garages[i].StorePos.x, Config.Zones.Garages[i].StorePos.y, Config.Zones.Garages[i].StorePos.z, true) < Config.StoreMarker.x then + distance = GetDistanceBetweenCoords(coords, Config.Zones.Garages[i].StorePos, true) + + if distance < Config.DrawDistance then + DrawMarker(Config.MarkerType, Config.Zones.Garages[i].StorePos, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, Config.StoreMarker.x, Config.StoreMarker.y, Config.StoreMarker.z, Config.StoreMarker.r, Config.StoreMarker.g, Config.StoreMarker.b, 100, false, true, 2, false, nil, nil, false) + letSleep = false + end + + if distance < Config.StoreMarker.x then isInMarker = true currentZone = 'garage_in' currentZoneNum = i end - end - local hasExited = false - - if isInMarker and not HasAlreadyEnteredMarker or (isInMarker and (LastZone ~= currentZone or LastZoneNum ~= currentZoneNum) ) then - + if isInMarker and not HasAlreadyEnteredMarker or (isInMarker and (LastZone ~= currentZone or LastZoneNum ~= currentZoneNum)) then if (LastZone ~= nil and LastZoneNum ~= nil) and (LastZone ~= currentZone or LastZoneNum ~= currentZoneNum) @@ -165,18 +142,21 @@ Citizen.CreateThread(function() end HasAlreadyEnteredMarker = true - LastZone = currentZone - LastZoneNum = currentZoneNum + LastZone = currentZone + LastZoneNum = currentZoneNum TriggerEvent('esx_boat:hasEnteredMarker', currentZone, currentZoneNum) end if not hasExited and not isInMarker and HasAlreadyEnteredMarker then - HasAlreadyEnteredMarker = false TriggerEvent('esx_boat:hasExitedMarker') end + if letSleep then + Citizen.Wait(500) + end + end end) @@ -187,7 +167,7 @@ Citizen.CreateThread(function() for i=1, #Config.Zones.Garages, 1 do table.insert(blipList, { - coords = { Config.Zones.Garages[i].GaragePos.x, Config.Zones.Garages[i].GaragePos.y }, + coords = Config.Zones.Garages[i].GaragePos, text = _U('blip_garage'), sprite = 356, color = 3, @@ -197,7 +177,7 @@ Citizen.CreateThread(function() for i=1, #Config.Zones.BoatShops, 1 do table.insert(blipList, { - coords = { Config.Zones.BoatShops[i].Outside.x, Config.Zones.BoatShops[i].Outside.y }, + coords = Config.Zones.BoatShops[i].Outside, text = _U('blip_shop'), sprite = 427, color = 3, @@ -212,7 +192,7 @@ Citizen.CreateThread(function() end) function CreateBlip(coords, text, sprite, color, scale) - local blip = AddBlipForCoord( table.unpack(coords) ) + local blip = AddBlipForCoord(coords.x, coords.y) SetBlipSprite(blip, sprite) SetBlipScale(blip, scale) diff --git a/config.lua b/config.lua index 87312264..46aac300 100644 --- a/config.lua +++ b/config.lua @@ -23,45 +23,45 @@ Config.Zones = { Garages = { { -- Shank St, nearby campaign boat garage - GaragePos = { x = -772.42, y = -1430.90, z = 0.55 }, - SpawnPoint = { x = -785.39, y = -1426.30, z = 0.00, h = 146.00 }, - StorePos = { x = -798.45, y = -1456.03, z = 0.00 }, - StoreTP = { x = -791.41, y = -1452.57, z = 1.59, h = 318.96 } + GaragePos = vector3(-772.4, -1430.9, 0.5), + SpawnPoint = vector4(-785.39, -1426.3, 0.0, 146.0), + StorePos = vector3(-798.4, -1456.0, 0.0), + StoreTP = vector4(-791.4, -1452.5, 1.5, 318.9) }, { -- Catfish View - GaragePos = { x = 3864.93, y = 4463.98, z = 1.65 }, - SpawnPoint = { x = 3854.40, y = 4477.28, z = 0.00, h = 273.00 }, - StorePos = { x = 3857.04, y = 4446.94, z = 0.00 }, - StoreTP = { x = 3854.73, y = 4458.66, z = 1.85, h = 355.35 } + GaragePos = vector3(3864.9, 4463.9, 1.6), + SpawnPoint = vector4(3854.4, 4477.2, 0.0, 273.0), + StorePos = vector3(3857.0, 4446.9, 0.0), + StoreTP = vector4(3854.7, 4458.6, 1.8, 355.3) }, { -- Great Ocean Highway - GaragePos = { x = -1614.03, y = 5260.10, z = 2.80 }, - SpawnPoint = { x = -1622.52, y = 5247.12, z = 0.00, h = 21.00 }, - StorePos = { x = -1600.37, y = 5261.91, z = 0.00 }, - StoreTP = { x = -1605.77, y = 5259.00, z = 2.09, h = 25.00 } + GaragePos = vector3(-1614.0, 5260.1, 2.8), + SpawnPoint = vector4(-1622.5, 5247.1, 0.0, 21.0), + StorePos = vector3(-1600.3, 5261.9, 0.0), + StoreTP = vector4(-1605.7, 5259.0, 2.0, 25.0) }, { -- North Calafia Way - GaragePos = { x = 712.67, y = 4093.31, z = 33.70 }, - SpawnPoint = { x = 712.89, y = 4080.20, z = 29.35, h = 181.00 }, - StorePos = { x = 705.16, y = 4110.16, z = 30.20 }, - StoreTP = { x = 711.97, y = 4110.55, z = 31.30, h = 180.00 } + GaragePos = vector3(712.6, 4093.3, 33.7), + SpawnPoint = vector4(712.8, 4080.2, 29.3, 181.0), + StorePos = vector3(705.1, 4110.1, 30.2), + StoreTP = vector4(711.9, 4110.5, 31.3, 180.0) }, { -- Elysian Fields, nearby the airport - GaragePos = { x = 23.87, y = -2806.82, z = 4.80 }, - SpawnPoint = { x = 23.35, y = -2828.69, z = 0.81, h = 181.0 }, - StorePos = { x = -1.03, y = -2799.20, z = 0.50 }, - StoreTP = { x = 12.67, y = -2793.87, z = 2.52, h = 355.26 } + GaragePos = vector3(23.8, -2806.8, 4.8), + SpawnPoint = vector4(23.3, -2828.6, 0.8, 181.0), + StorePos = vector3(-1.0, -2799.2, 0.5), + StoreTP = vector4(12.6, -2793.8, 2.5, 355.2) }, { -- Barbareno Rd - GaragePos = { x = -3427.36, y = 956.94, z = 7.35 }, - SpawnPoint = { x = -3448.97, y = 953.80, z = 0.00, h = 75.00 }, - StorePos = { x = -3436.55, y = 946.67, z = 0.30 }, - StoreTP = { x = -3427.08, y = 952.62, z = 8.34, h = 0.00 } + GaragePos = vector3(-3427.3, 956.9, 7.3), + SpawnPoint = vector4(-3448.9, 953.8, 0.0, 75.0), + StorePos = vector3(-3436.5, 946.6, 0.3), + StoreTP = vector4(-3427.0, 952.6, 8.3, 0.0) }, }, @@ -69,8 +69,8 @@ Config.Zones = { BoatShops = { { -- Shank St, nearby campaign boat garage - Outside = { x = -773.76, y = -1495.25, z = 1.60 }, - Inside = { x = -798.59, y = -1503.12, z = -0.47, h = 120.00 }, + Outside = vector3(-773.7, -1495.2, 1.6), + Inside = vector4(-798.5, -1503.1, -0.4, 120.0) } } diff --git a/locales/en.lua b/locales/en.lua index 6b14703c..fd1f44ac 100644 --- a/locales/en.lua +++ b/locales/en.lua @@ -1,31 +1,31 @@ Locales['en'] = { - -- shop - ['boat_shop'] = 'boat shop', - ['boat_shop_open'] = 'press ~INPUT_CONTEXT~ to access the ~y~boat shop~s~.', - ['boat_shop_confirm'] = 'buy %s for $%s?', - ['boat_shop_bought'] = 'you have ~y~bought~s~ a ~b~%s~s~ for ~g~$%s~s~', - ['boat_shop_nomoney'] = 'you cannot ~r~afford~s~ this boat!', - ['confirm_no'] = 'no', - ['confirm_yes'] = 'yes', + -- shop + ['boat_shop'] = 'boat shop', + ['boat_shop_open'] = 'press ~INPUT_CONTEXT~ to access the ~y~boat shop~s~.', + ['boat_shop_confirm'] = 'buy %s for $%s?', + ['boat_shop_bought'] = 'you have ~y~bought~s~ a ~b~%s~s~ for ~g~$%s~s~', + ['boat_shop_nomoney'] = 'you cannot ~r~afford~s~ this boat!', + ['confirm_no'] = 'no', + ['confirm_yes'] = 'yes', - -- garage - ['garage'] = 'boat garage', - ['garage_open'] = 'press ~INPUT_CONTEXT~ to access your ~y~boat garage~s~.', - ['garage_store'] = 'press ~INPUT_CONTEXT~ to ~y~store~s~ the boat in your garage.', - ['garage_taken'] = 'the boat has been taken out!', - ['garage_stored'] = 'the boat has been safely stored in your garage!', - ['garage_noboats'] = 'you don\'t have any stored boats! Visit the ~y~boat shop~s~ to buy one.', - ['garage_blocked'] = 'the boat cannot be taken out because another vehicle is blocking the spawn point!', - ['garage_notowner'] = 'you don\'t own this boat!', + -- garage + ['garage'] = 'boat garage', + ['garage_open'] = 'press ~INPUT_CONTEXT~ to access your ~y~boat garage~s~.', + ['garage_store'] = 'press ~INPUT_CONTEXT~ to ~y~store~s~ the boat in your garage.', + ['garage_taken'] = 'the boat has been taken out!', + ['garage_stored'] = 'the boat has been safely stored in your garage!', + ['garage_noboats'] = 'you don\'t have any stored boats! Visit the ~y~boat shop~s~ to buy one.', + ['garage_blocked'] = 'the boat cannot be taken out because another vehicle is blocking the spawn point!', + ['garage_notowner'] = 'you don\'t own this boat!', - -- license - ['license_menu'] = 'buy Boat License?', - ['license_buy_no'] = 'no', - ['license_buy_yes'] = 'buy Boat License $%s', - ['license_bought'] = 'you have bought the ~y~Boat License~s~ for ~g~$%s~s~', - ['license_nomoney'] = 'you cannot ~r~afford~s~ the ~y~Boat License~s~!', + -- license + ['license_menu'] = 'buy Boat License?', + ['license_buy_no'] = 'no', + ['license_buy_yes'] = 'buy Boat License $%s', + ['license_bought'] = 'you have bought the ~y~Boat License~s~ for ~g~$%s~s~', + ['license_nomoney'] = 'you cannot ~r~afford~s~ the ~y~Boat License~s~!', - -- blips - ['blip_garage'] = 'boat Garage', - ['blip_shop'] = 'boat Shop', + -- blips + ['blip_garage'] = 'boat Garage', + ['blip_shop'] = 'boat Shop', } \ No newline at end of file diff --git a/locales/sv.lua b/locales/sv.lua index 7f5dd0fa..c4803dcc 100644 --- a/locales/sv.lua +++ b/locales/sv.lua @@ -1,31 +1,31 @@ Locales['sv'] = { - -- shop - ['boat_shop'] = 'båtaffär', - ['boat_shop_open'] = 'tryck ~INPUT_CONTEXT~ för att öppna ~y~båtaffären~s~.', - ['boat_shop_confirm'] = 'köp %s för %s SEK?', - ['boat_shop_bought'] = 'du har ~y~köpt~s~ en ~b~%s~s~ för ~g~%s SEK~s~', - ['boat_shop_nomoney'] = 'du har ~r~inte råd~s~ för denna båt!', - ['confirm_no'] = 'nej', - ['confirm_yes'] = 'ja', + -- shop + ['boat_shop'] = 'båtaffär', + ['boat_shop_open'] = 'tryck ~INPUT_CONTEXT~ för att öppna ~y~båtaffären~s~.', + ['boat_shop_confirm'] = 'köp %s för %s SEK?', + ['boat_shop_bought'] = 'du har ~y~köpt~s~ en ~b~%s~s~ för ~g~%s SEK~s~', + ['boat_shop_nomoney'] = 'du har ~r~inte råd~s~ för denna båt!', + ['confirm_no'] = 'nej', + ['confirm_yes'] = 'ja', - -- garage - ['garage'] = 'båtgarage', - ['garage_open'] = 'tryck ~INPUT_CONTEXT~ för att öppna ~y~båtgaraget~s~.', - ['garage_store'] = 'tryck ~INPUT_CONTEXT~ för att ~y~lagra~s~ båten i ditt garage.', - ['garage_taken'] = 'båten har släppts från garaget!', - ['garage_stored'] = 'båten har lagrats i garaget!', - ['garage_noboats'] = 'du har inga lagrade båtar! Besök ~y~båtaffären~s~ för att köpa båtar.', - ['garage_blocked'] = 'båten kan inte tas ur på grund av att en annan båt blokerar spawnpointen!', - ['garage_notowner'] = 'du äger inte denna båt!', + -- garage + ['garage'] = 'båtgarage', + ['garage_open'] = 'tryck ~INPUT_CONTEXT~ för att öppna ~y~båtgaraget~s~.', + ['garage_store'] = 'tryck ~INPUT_CONTEXT~ för att ~y~lagra~s~ båten i ditt garage.', + ['garage_taken'] = 'båten har släppts från garaget!', + ['garage_stored'] = 'båten har lagrats i garaget!', + ['garage_noboats'] = 'du har inga lagrade båtar! Besök ~y~båtaffären~s~ för att köpa båtar.', + ['garage_blocked'] = 'båten kan inte tas ur på grund av att en annan båt blokerar spawnpointen!', + ['garage_notowner'] = 'du äger inte denna båt!', - -- license - ['license_menu'] = 'köpa båtlicens?', - ['license_buy_no'] = 'nej', - ['license_buy_yes'] = 'köp båtlicens %s SEK', - ['license_bought'] = 'du köpte ~y~båtlicensen~s~ för ~g~%s SEK~s~', - ['license_nomoney'] = 'du har ~r~inte råd~s~ för ~y~båtlicensen~s~!', + -- license + ['license_menu'] = 'köpa båtlicens?', + ['license_buy_no'] = 'nej', + ['license_buy_yes'] = 'köp båtlicens %s SEK', + ['license_bought'] = 'du köpte ~y~båtlicensen~s~ för ~g~%s SEK~s~', + ['license_nomoney'] = 'du har ~r~inte råd~s~ för ~y~båtlicensen~s~!', - -- blips - ['blip_garage'] = 'båtgarage', - ['blip_shop'] = 'båtaffär', + -- blips + ['blip_garage'] = 'båtgarage', + ['blip_shop'] = 'båtaffär', } \ No newline at end of file diff --git a/server/main.lua b/server/main.lua index f1bbb580..20adc92b 100644 --- a/server/main.lua +++ b/server/main.lua @@ -31,8 +31,7 @@ ESX.RegisterServerCallback('esx_boat:buyBoat', function(source, cb, vehicleProps if xPlayer.getMoney() >= price then xPlayer.removeMoney(price) - MySQL.Async.execute('INSERT INTO owned_vehicles (owner, plate, vehicle, type) VALUES (@owner, @plate, @vehicle, @type)', - { + MySQL.Async.execute('INSERT INTO owned_vehicles (owner, plate, vehicle, type) VALUES (@owner, @plate, @vehicle, @type)', { ['@owner'] = xPlayer.identifier, ['@plate'] = vehicleProps.plate, ['@vehicle'] = json.encode(vehicleProps), @@ -81,8 +80,7 @@ ESX.RegisterServerCallback('esx_boat:getGarage', function(source, cb) local vehicles = {} for i=1, #result, 1 do - local vehicleProps = json.decode(result[i].vehicle) - table.insert(vehicles, vehicleProps) + table.insert(vehicles, result[i].vehicle) end cb(vehicles)