From 84762eb0cf7f08a9bcdc928970dbac20153014c7 Mon Sep 17 00:00:00 2001 From: ElPumpo Date: Thu, 5 Apr 2018 12:07:18 +0200 Subject: [PATCH] Fixed unremovable neon, prices, hardcoded strings --- client/main.lua | 73 +++++++++++++++++++--------------- config.lua | 102 ++++++++++++++++++++++++------------------------ locales/en.lua | 30 ++++++++++++-- 3 files changed, 119 insertions(+), 86 deletions(-) diff --git a/client/main.lua b/client/main.lua index 59d2ed35..5ff1533c 100644 --- a/client/main.lua +++ b/client/main.lua @@ -1,6 +1,21 @@ -ESX = nil -local Vehicles = {} -local PlayerData = {} +local Keys = { + ["ESC"] = 322, ["F1"] = 288, ["F2"] = 289, ["F3"] = 170, ["F5"] = 166, ["F6"] = 167, ["F7"] = 168, ["F8"] = 169, ["F9"] = 56, ["F10"] = 57, + ["~"] = 243, ["1"] = 157, ["2"] = 158, ["3"] = 160, ["4"] = 164, ["5"] = 165, ["6"] = 159, ["7"] = 161, ["8"] = 162, ["9"] = 163, ["-"] = 84, ["="] = 83, ["BACKSPACE"] = 177, + ["TAB"] = 37, ["Q"] = 44, ["W"] = 32, ["E"] = 38, ["R"] = 45, ["T"] = 245, ["Y"] = 246, ["U"] = 303, ["P"] = 199, ["["] = 39, ["]"] = 40, ["ENTER"] = 18, + ["CAPS"] = 137, ["A"] = 34, ["S"] = 8, ["D"] = 9, ["F"] = 23, ["G"] = 47, ["H"] = 74, ["K"] = 311, ["L"] = 182, + ["LEFTSHIFT"] = 21, ["Z"] = 20, ["X"] = 73, ["C"] = 26, ["V"] = 0, ["B"] = 29, ["N"] = 249, ["M"] = 244, [","] = 82, ["."] = 81, + ["LEFTCTRL"] = 36, ["LEFTALT"] = 19, ["SPACE"] = 22, ["RIGHTCTRL"] = 70, + ["HOME"] = 213, ["PAGEUP"] = 10, ["PAGEDOWN"] = 11, ["DELETE"] = 178, + ["LEFT"] = 174, ["RIGHT"] = 175, ["TOP"] = 27, ["DOWN"] = 173, + ["NENTER"] = 201, ["N4"] = 108, ["N5"] = 60, ["N6"] = 107, ["N+"] = 96, ["N-"] = 97, ["N7"] = 117, ["N8"] = 61, ["N9"] = 118 +} + +ESX = nil +local Vehicles = {} +local PlayerData = {} +local lsMenuIsShowed = false +local isInLSMarker = false +local myCar = {} Citizen.CreateThread(function() while ESX == nil do @@ -9,27 +24,21 @@ Citizen.CreateThread(function() end end) -local lsMenuIsShowed = false -local isInLSMarker = false -local myCar = {} - RegisterNetEvent('esx:playerLoaded') AddEventHandler('esx:playerLoaded', function(xPlayer) - PlayerData = xPlayer + PlayerData = xPlayer ESX.TriggerServerCallback('esx_lscustom:getVehiclesPrices', function(vehicles) Vehicles = vehicles end) end) - RegisterNetEvent('esx:setJob') AddEventHandler('esx:setJob', function(job) - PlayerData.job = job + PlayerData.job = job end) RegisterNetEvent('esx_lscustom:installMod') AddEventHandler('esx_lscustom:installMod', function() - --Citizen.Trace('installMod') local vehicle = GetVehiclePedIsIn(GetPlayerPed(-1), false) myCar = ESX.Game.GetVehicleProperties(vehicle) TriggerServerEvent('esx_lscustom:refreshOwnedVehicle', myCar) @@ -37,9 +46,6 @@ end) RegisterNetEvent('esx_lscustom:cancelInstallMod') AddEventHandler('esx_lscustom:cancelInstallMod', function() - --Citizen.Trace('cancelInstallMod') - --Citizen.Trace('myCar: ' .. json.encode(myCar)) - local vehicle = GetVehiclePedIsIn(GetPlayerPed(-1), false) ESX.Game.SetVehicleProperties(vehicle, myCar) end) @@ -58,7 +64,7 @@ function OpenLSMenu(elems, menuname, menutitle, parent) if data.current.modType == "modFrontWheels" then isRimMod = true end - local vehicle = GetVehiclePedIsIn(GetPlayerPed(-1), false) + local vehicle = GetVehiclePedIsIn(GetPlayerPed(-1), false) local found = false for k,v in pairs(Config.Menus) do if k == data.current.modType or isRimMod then @@ -66,7 +72,7 @@ function OpenLSMenu(elems, menuname, menutitle, parent) ESX.ShowNotification(_U('already_own') .. data.current.label) TriggerEvent('esx_lscustom:installMod') else - local vehiclePrice = 0 + local vehiclePrice = 50000 for i=1, #Vehicles, 1 do if GetEntityModel(vehicle) == GetHashKey(Vehicles[i].model) then @@ -125,18 +131,19 @@ function UpdateMods(data) local vehicle = GetVehiclePedIsIn(GetPlayerPed(-1), false) - if data.modType ~= nil then - local props = {} - - --Citizen.Trace('modType: ' .. data.modType) - --Citizen.Trace('modNum: ' .. json.encode(data.modNum)) - + if data.modType ~= nil then + local props = {} + if data.wheelType ~= nil then props['wheels'] = data.wheelType ESX.Game.SetVehicleProperties(vehicle, props) props = {} elseif data.modType == 'neonColor' then - props['neonEnabled'] = {true, true, true, true} + if data.modNum[1] == 0 and data.modNum[2] == 0 and data.modNum[3] == 0 then + props['neonEnabled'] = {false, false, false, false} + else + props['neonEnabled'] = {true, true, true, true} + end ESX.Game.SetVehicleProperties(vehicle, props) props = {} elseif data.modType == 'tyreSmokeColor' then @@ -177,7 +184,7 @@ function GetAction(data) SetVehicleDoorsShut(vehicle, false) end - local vehiclePrice = 0 + local vehiclePrice = 50000 for i=1, #Vehicles, 1 do if GetEntityModel(vehicle) == GetHashKey(Vehicles[i].model) then @@ -198,6 +205,8 @@ function GetAction(data) if v.modType == 22 then table.insert(elements, {label = " " .. _U('by_default'), modType = k, modNum = false}) + elseif v.modType == 'neonColor' or v.modType == 'tyreSmokeColor' then -- disable neon + table.insert(elements, {label = " " .. _U('by_default'), modType = k, modNum = {0, 0, 0}}) elseif v.modType == 'color1' or v.modType == 'color2' or v.modType == 'pearlescentColor' or v.modType == 'wheelColor' then local num = myCar[v.modType] table.insert(elements, {label = " " .. _U('by_default'), modType = k, modNum = num}) @@ -229,17 +238,17 @@ function GetAction(data) end table.insert(elements, {label = _label, modType = k, modNum = j}) end - elseif v.modType == 22 then -- XENON + elseif v.modType == 22 then -- NEON local _label = '' if currentMods.modXenon then - _label = 'Xénon - '.. _U('installed') ..'' + _label = _U('neon') .. ' - '.. _U('installed') ..'' else price = math.floor(vehiclePrice * v.price / 100) - _label = 'Xénon - $' .. price .. ' ' + _label = _U('neon') .. ' - $' .. price .. ' ' end table.insert(elements, {label = _label, modType = k, modNum = true}) elseif v.modType == 'neonColor' or v.modType == 'tyreSmokeColor' then -- NEON & SMOKE COLOR - local neons = GetNeons() + local neons = GetNeons() price = math.floor(vehiclePrice * v.price / 100) for i=1, #neons, 1 do table.insert(elements, @@ -294,10 +303,10 @@ function GetAction(data) for j = 0, modCount, 1 do local _label = '' if j == currentMods[k] then - _label = 'Niveau ' .. j+1 .. ' - '.. _U('installed') ..'' + _label = _U('level') .. j+1 .. ' - '.. _U('installed') ..'' else price = math.floor(vehiclePrice * v.price[j+1] / 100) - _label = 'Niveau ' .. j+1 .. ' - $' .. price .. ' ' + _label = _U('level') .. j+1 .. ' - $' .. price .. ' ' end table.insert(elements, {label = _label, modType = k, modNum = j}) if j == modCount-1 then @@ -377,7 +386,7 @@ end) -- Activate menu when player is inside marker Citizen.CreateThread(function() while true do - Wait(0) + Citizen.Wait(10) local playerPed = GetPlayerPed(-1) if IsPedInAnyVehicle(playerPed, false) then local coords = GetEntityCoords(GetPlayerPed(-1)) @@ -400,7 +409,7 @@ Citizen.CreateThread(function() end end - if IsControlJustReleased(0, 38) and not lsMenuIsShowed and isInLSMarker then + if IsControlJustReleased(0, Keys['E']) and not lsMenuIsShowed and isInLSMarker then lsMenuIsShowed = true local vehicle = GetVehiclePedIsIn(playerPed, false) diff --git a/config.lua b/config.lua index 20f17a09..f0ee3e20 100644 --- a/config.lua +++ b/config.lua @@ -1,6 +1,6 @@ -Config = {} -Config.DrawDistance = 100.0 -Config.Locale = 'fr' +Config = {} +Config.DrawDistance = 100.0 +Config.Locale = 'en' Config.IsMecanoJobOnly = false Config.Zones = { @@ -477,7 +477,7 @@ Config.Menus = { label = _U('armor'), parent = 'upgrades', modType = 16, - price = {69.77, 116.28, 6666666.6, 6666666.6, 6666666.6, 6666666.6} + price = {69.77, 116.28, 130.00, 150.00, 180.00, 190.00} }, modTurbo = { label = _U('turbo'), @@ -496,165 +496,165 @@ Config.Menus = { modXenon = _U('headlights'), plateIndex = _U('licenseplates'), wheels = _U('wheels'), - modPlateHolder = 'Plaque - Contour', - modVanityPlate = 'Plaque - Avant', - modTrimA = 'Intérieur', - modOrnaments = 'Ornements', - modDashboard = 'Tableau de bord', - modDial = 'Compteur de vitesse', - modDoorSpeaker = 'Sono portière', - modSeats = 'Sièges', - modSteeringWheel = 'Volant', - modShifterLeavers = 'Levier de vitesse', - modAPlate = 'Plage arrière', - modSpeakers = 'Sono', - modTrunk = 'Coffre', - modHydrolic = 'Hydrolique', - modEngineBlock = 'Bloc moteur', - modAirFilter = 'Filtre à air', - modStruts = 'Struts', - modArchCover = 'Cache-roues', - modAerials = 'Antennes', - modTrimB = 'Ailes', - modTank = 'Réservoir', - modWindows = 'Fenêtres', - modLivery = 'Stickers' + modPlateHolder = _U('modplateholder'), + modVanityPlate = _U('modvanityplate'), + modTrimA = _U('interior'), + modOrnaments = _U('trim'), + modDashboard = _U('dashboard'), + modDial = _U('speedometer'), + modDoorSpeaker = _U('door_speakers'), + modSeats = _U('seats'), + modSteeringWheel = _U('steering_wheel'), + modShifterLeavers = _U('gear_lever'), + modAPlate = _U('quarter_deck'), + modSpeakers = _U('speakers'), + modTrunk = _U('trunk'), + modHydrolic = _U('hydraulic'), + modEngineBlock = _U('engine_block'), + modAirFilter = _U('air_filter'), + modStruts = _U('struts'), + modArchCover = _U('arch_cover'), + modAerials = _U('aerials'), + modTrimB = _U('wings'), + modTank = _U('fuel_tank'), + modWindows = _U('windows'), + modLivery = _U('stickers') }, modPlateHolder = { - label = 'Plaque - Contour', + label = _U('modplateholder'), parent = 'cosmetics', modType = 25, price = 3.49 }, modVanityPlate = { - label = 'Plaque - Avant', + label = _U('modvanityplate'), parent = 'cosmetics', modType = 26, price = 1.1 }, modTrimA = { - label = 'Intérieur', + label = _U('interior'), parent = 'cosmetics', modType = 27, price = 6.98 }, modOrnaments = { - label = 'Ornements', + label = _U('trim'), parent = 'cosmetics', modType = 28, price = 0.9 }, modDashboard = { - label = 'Tableau de bord', + label = _U('dashboard'), parent = 'cosmetics', modType = 29, price = 4.65 }, modDial = { - label = 'Compteur de vitesse', + label = _U('speedometer'), parent = 'cosmetics', modType = 30, price = 4.19 }, modDoorSpeaker = { - label = 'Sono portière', + label = _U('door_speakers'), parent = 'cosmetics', modType = 31, price = 5.58 }, modSeats = { - label = 'Siège', + label = _U('seats'), parent = 'cosmetics', modType = 32, price = 4.65 }, modSteeringWheel = { - label = 'Volant', + label = _U('steering_wheel'), parent = 'cosmetics', modType = 33, price = 4.19 }, modShifterLeavers = { - label = 'Levier de vitesse', + label = _U('gear_lever'), parent = 'cosmetics', modType = 34, price = 3.26 }, modAPlate = { - label = 'Plage arrière', + label = _U('quarter_deck'), parent = 'cosmetics', modType = 35, price = 4.19 }, modSpeakers = { - label = 'Sono', + label = _U('speakers'), parent = 'cosmetics', modType = 36, price = 6.98 }, modTrunk = { - label = 'Coffre', + label = _U('trunk'), parent = 'cosmetics', modType = 37, price = 5.58 }, modHydrolic = { - label = 'Hydrolique', + label = _U('hydraulic'), parent = 'cosmetics', modType = 38, price = 5.12 }, modEngineBlock = { - label = 'Bloc moteur', + label = _U('engine_block'), parent = 'cosmetics', modType = 39, price = 5.12 }, modAirFilter = { - label = 'Filtre a air', + label = _U('air_filter'), parent = 'cosmetics', modType = 40, price = 3.72 }, modStruts = { - label = 'Struts', + label = _U('struts'), parent = 'cosmetics', modType = 41, price = 6.51 }, modArchCover = { - label = 'Cache-roues', + label = _U('arch_cover'), parent = 'cosmetics', modType = 42, price = 4.19 }, modAerials = { - label = 'Antennes', + label = _U('aerials'), parent = 'cosmetics', modType = 43, price = 1.12 }, modTrimB = { - label = 'Ailes', + label = _U('wings'), parent = 'cosmetics', modType = 44, price = 6.05 }, modTank = { - label = 'Réservoir', + label = _U('fuel_tank'), parent = 'cosmetics', modType = 45, price = 4.19 }, modWindows = { - label = 'Fenêtres', + label = _U('windows'), parent = 'cosmetics', modType = 46, price = 4.19 }, modLivery = { - label = 'Stickers', + label = _U('stickers'), parent = 'cosmetics', modType = 48, price = 9.3 @@ -900,4 +900,4 @@ Config.Menus = { price = 1.12 } -} +} \ No newline at end of file diff --git a/locales/en.lua b/locales/en.lua index 565f928e..1d779354 100644 --- a/locales/en.lua +++ b/locales/en.lua @@ -1,12 +1,12 @@ Locales['en'] = { - ['by_default'] = 'default', ['installed'] = 'installed', ['already_own'] = 'you already own: ~b~', ['not_enough_money'] = 'you do not have enough money!', - ['purchased'] = 'purchased!', + ['purchased'] = 'you have purchased the mod!', ['press_custom'] = 'press ~INPUT_PICKUP~ to personalize your vehicle.', ['level'] = 'level ', + ['neon'] = 'neon', -- Paint Colors -- Black ['black'] = 'black', @@ -236,9 +236,33 @@ Locales['en'] = { ['sport'] = 'sport', ['muscle'] = 'muscle', ['lowrider'] = 'lowrider', - ['suv'] = 'sUV', + ['suv'] = 'SUV', ['allterrain'] = 'all terrain', ['tuning'] = 'tuning', ['motorcycle'] = 'motorcycle', ['highend'] = 'high end', + + ['modplateholder'] = 'plate - Back', + ['modvanityplate'] = 'plate - Front', + ['interior'] = 'interior', + ['trim'] = 'trim', + ['dashboard'] = 'dashboard', + ['speedometer'] = 'speedometer', + ['door_speakers'] = 'door speakers', + ['seats'] = 'seats', + ['steering_wheel'] = 'steering wheel', + ['gear_lever'] = 'gear lever', + ['quarter_deck'] = 'quarter-deck', + ['speakers'] = 'speakers', + ['trunk'] = 'trunk', + ['hydraulic'] = 'hydraulic', + ['engine_block'] = 'engine block', + ['air_filter'] = 'air filter', + ['struts'] = 'struts', + ['arch_cover'] = 'arch cover', + ['aerials'] = 'aerials', + ['wings'] = 'wings', + ['fuel_tank'] = 'fuel tank', + ['windows'] = 'windows', + ['stickers'] = 'stickers', } \ No newline at end of file