├── html
└── src
│ ├── images
│ ├── template.png
│ ├── Ellipse 687.png
│ ├── policelogo.png
│ ├── Ellipse 3.svg
│ └── Ellipse 687.svg
│ ├── fonts
│ ├── Gilroy-Bold.ttf
│ ├── Gilroy-Medium.ttf
│ ├── Gilroy-Regular.ttf
│ ├── Gilroy-Semibold.ttf
│ └── Gilroy-Extrabold.ttf
│ ├── style
│ ├── Heading-Pro-Wide-Heavy-Italic-trial.ttf
│ └── style.css
│ └── scripts
│ ├── main.js
│ └── vuex.global.js
├── fxmanifest.lua
├── server
├── functions.lua
├── mode.lua
├── main.lua
└── presets.lua
├── tuning.sql
├── client
├── presets.lua
├── main.lua
├── mode.lua
└── functions.lua
├── README.md
└── shared
├── locales.lua
└── config.lua
/html/src/images/template.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Lod-Resources/ld-tunertablet/HEAD/html/src/images/template.png
--------------------------------------------------------------------------------
/html/src/fonts/Gilroy-Bold.ttf:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Lod-Resources/ld-tunertablet/HEAD/html/src/fonts/Gilroy-Bold.ttf
--------------------------------------------------------------------------------
/html/src/fonts/Gilroy-Medium.ttf:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Lod-Resources/ld-tunertablet/HEAD/html/src/fonts/Gilroy-Medium.ttf
--------------------------------------------------------------------------------
/html/src/images/Ellipse 687.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Lod-Resources/ld-tunertablet/HEAD/html/src/images/Ellipse 687.png
--------------------------------------------------------------------------------
/html/src/images/policelogo.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Lod-Resources/ld-tunertablet/HEAD/html/src/images/policelogo.png
--------------------------------------------------------------------------------
/html/src/fonts/Gilroy-Regular.ttf:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Lod-Resources/ld-tunertablet/HEAD/html/src/fonts/Gilroy-Regular.ttf
--------------------------------------------------------------------------------
/html/src/fonts/Gilroy-Semibold.ttf:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Lod-Resources/ld-tunertablet/HEAD/html/src/fonts/Gilroy-Semibold.ttf
--------------------------------------------------------------------------------
/html/src/fonts/Gilroy-Extrabold.ttf:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Lod-Resources/ld-tunertablet/HEAD/html/src/fonts/Gilroy-Extrabold.ttf
--------------------------------------------------------------------------------
/html/src/style/Heading-Pro-Wide-Heavy-Italic-trial.ttf:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Lod-Resources/ld-tunertablet/HEAD/html/src/style/Heading-Pro-Wide-Heavy-Italic-trial.ttf
--------------------------------------------------------------------------------
/html/src/images/Ellipse 3.svg:
--------------------------------------------------------------------------------
1 |
4 |
--------------------------------------------------------------------------------
/html/src/images/Ellipse 687.svg:
--------------------------------------------------------------------------------
1 |
4 |
--------------------------------------------------------------------------------
/fxmanifest.lua:
--------------------------------------------------------------------------------
1 | fx_version 'cerulean'
2 | game 'gta5'
3 | Version '1.1.5'
4 | author 'l0d.'
5 |
6 | shared_scripts {
7 | 'shared/config.lua',
8 | 'shared/locales.lua',
9 | '@ox_lib/init.lua',
10 | }
11 |
12 | client_scripts {
13 | 'client/*.*',
14 | 'shared/config.lua',
15 | }
16 |
17 | server_scripts {
18 | '@oxmysql/lib/MySQL.lua',
19 | 'server/*.*',
20 | 'shared/config.lua',
21 | }
22 |
23 | ui_page "html/index.html"
24 |
25 | files {
26 | 'html/index.html',
27 | 'html/src/fonts/*.*',
28 | 'html/src/images/*.*',
29 | 'html/src/scripts/*.*',
30 | 'html/src/style/*.*',
31 | }
32 |
33 | escrow_ignore {
34 | 'shared/config.lua',
35 | 'shared/locales.lua'
36 | }
37 |
38 |
39 | lua54 'yes'
40 |
41 |
--------------------------------------------------------------------------------
/server/functions.lua:
--------------------------------------------------------------------------------
1 |
2 |
3 | function _L(key, ...)
4 | local lang = Config.Language or "en"
5 | local result = Locales.Languages[lang][key] or Locales.Languages["en"][key] or key
6 |
7 |
8 | local args = {...}
9 | if #args > 0 then
10 | for i, v in ipairs(args) do
11 | result = result:gsub("{" .. (i-1) .. "}", tostring(v))
12 | end
13 | end
14 |
15 | return result
16 | end
17 |
18 |
19 | function ExecuteSQL(query, params)
20 | local IsBusy = true
21 | local result = nil
22 | exports.oxmysql:execute(query, params, function(data)
23 | result = data
24 | IsBusy = false
25 | end)
26 | while IsBusy do
27 | Citizen.Wait(0)
28 | end
29 | return result
30 | end
31 |
32 |
33 |
--------------------------------------------------------------------------------
/tuning.sql:
--------------------------------------------------------------------------------
1 | -- --------------------------------------------------------
2 | -- Sunucu: 127.0.0.1
3 | -- Sunucu sürümü: 10.4.28-MariaDB - mariadb.org binary distribution
4 | -- Sunucu İşletim Sistemi: Win64
5 | -- HeidiSQL Sürüm: 11.3.0.6295
6 | -- --------------------------------------------------------
7 |
8 | /*!40101 SET @OLD_CHARACTER_SET_CLIENT=@@CHARACTER_SET_CLIENT */;
9 | /*!40101 SET NAMES utf8 */;
10 | /*!50503 SET NAMES utf8mb4 */;
11 | /*!40014 SET @OLD_FOREIGN_KEY_CHECKS=@@FOREIGN_KEY_CHECKS, FOREIGN_KEY_CHECKS=0 */;
12 | /*!40101 SET @OLD_SQL_MODE=@@SQL_MODE, SQL_MODE='NO_AUTO_VALUE_ON_ZERO' */;
13 | /*!40111 SET @OLD_SQL_NOTES=@@SQL_NOTES, SQL_NOTES=0 */;
14 |
15 | -- tablo yapısı dökülüyor qbcoreframework_c53310.ld_tuning
16 | CREATE TABLE IF NOT EXISTS `ld_tuning` (
17 | `id` int(11) NOT NULL AUTO_INCREMENT,
18 | `plate` varchar(50) DEFAULT NULL,
19 | `defaultData` longtext DEFAULT NULL,
20 | `currentData` longtext DEFAULT NULL,
21 | `activeData` longtext DEFAULT NULL,
22 | `tunerChip` int(11) DEFAULT 0,
23 | KEY `id` (`id`)
24 | ) ENGINE=InnoDB AUTO_INCREMENT=165 DEFAULT CHARSET=utf8 COLLATE=utf8_general_ci;
25 |
26 | -- qbcoreframework_c53310.ld_tuning: ~0 rows (yaklaşık) tablosu için veriler indiriliyor
27 | /*!40000 ALTER TABLE `ld_tuning` DISABLE KEYS */;
28 | /*!40000 ALTER TABLE `ld_tuning` ENABLE KEYS */;
29 |
30 | /*!40101 SET SQL_MODE=IFNULL(@OLD_SQL_MODE, '') */;
31 | /*!40014 SET FOREIGN_KEY_CHECKS=IFNULL(@OLD_FOREIGN_KEY_CHECKS, 1) */;
32 | /*!40101 SET CHARACTER_SET_CLIENT=@OLD_CHARACTER_SET_CLIENT */;
33 | /*!40111 SET SQL_NOTES=IFNULL(@OLD_SQL_NOTES, 1) */;
34 |
--------------------------------------------------------------------------------
/server/mode.lua:
--------------------------------------------------------------------------------
1 | RegisterServerEvent('ld-tunertablet:CreateTableData', function(plate, data, dataName)
2 | if dataName == "IsSportModOn" then
3 | IsSportModOn[plate] = true
4 | oldSportModData[plate] = data
5 | elseif dataName == "DriftMode" then
6 | DriftMode[plate] = data
7 | elseif dataName == "TuningData" then
8 | TuningData[plate] = data
9 | elseif dataName == "CurrentVehicleData" then
10 | CurrentVehicleData[plate] = data
11 | elseif dataName == "CloseSportMod" then
12 | IsSportModOn[plate] = false
13 | elseif dataName == "NormalMod" then
14 | IsSportModOn[plate] = false
15 | DriftMode[plate] = false
16 | end
17 | end)
18 |
19 | RegisterServerEvent('ld-tunertablet:OpenNormalMod')
20 | AddEventHandler('ld-tunertablet:OpenNormalMod', function(plate)
21 | IsSportModOn[plate] = false
22 | DriftMode[plate] = false
23 | end)
24 |
25 | Citizen.CreateThread(function()
26 | lib.callback.register('ld-tunertablet:GetData', function(source, cb, plate, dataName)
27 | if dataName == "TuningData" then
28 | cb(TuningData[plate])
29 | elseif dataName == "CurrentVehicleData" then
30 | while not (CurrentVehicleData[plate]) do
31 | Citizen.Wait(0)
32 | end
33 | cb(CurrentVehicleData[plate])
34 | elseif dataName == "IsSportModOn" then
35 | cb(IsSportModOn[plate])
36 | elseif dataName == "DriftMode" then
37 | cb(DriftMode[plate])
38 | elseif dataName == "exOldData" then
39 | cb(IsSportModOn[plate], oldSportModData[plate])
40 | elseif dataName == "ActiveData" then
41 | while not (ActiveMode[plate]) do
42 | Citizen.Wait(0)
43 | end
44 | cb(ActiveMode[plate])
45 | end
46 | end)
47 | end)
48 |
49 |
50 |
--------------------------------------------------------------------------------
/client/presets.lua:
--------------------------------------------------------------------------------
1 | -- Presets
2 |
3 | RegisterNUICallback("GET_CUSTOMS_DATA", function(data)
4 | local ped = PlayerPedId()
5 | local vehicle = GetVehiclePedIsUsing(ped)
6 | if vehicle == 0 then
7 | lib.notify({title = _L("error"), description = _L("no_vehicle_found"), type = 'error'})
8 | return
9 | end
10 | local plate = GetVehicleNumberPlateText(vehicle)
11 | local dataName = "currentData"
12 | lib.callback('ld-tunertablet:sqlDta', false, function(Datalar)
13 | SendNUIMessage({
14 | action = "GET_CURRENT_DATA",
15 | GetCurrentData = Datalar or {},
16 | })
17 | end, plate, dataName)
18 | end)
19 |
20 | RegisterNUICallback("DELETE_PRESET", function(data)
21 | local ped = PlayerPedId()
22 | local vehicle = GetVehiclePedIsUsing(ped)
23 | local plate = GetVehicleNumberPlateText(vehicle)
24 |
25 | TriggerServerEvent("ld-tunertablet:deleteCurrentData", data, plate)
26 | lib.notify({title = _L("success"), description = _L("preset_deleted"), type = 'success'})
27 | end)
28 |
29 |
30 | RegisterNUICallback("GET_XML_DATA", function(data)
31 | local ped = PlayerPedId()
32 | local vehicle = GetVehiclePedIsUsing(ped)
33 | local plate = GetVehicleNumberPlateText(vehicle)
34 | if not data or not data.vehicleData then
35 | lib.notify({title = _L("xml_error"), description = _L("invalid_vehicle_data"), type = 'error'})
36 | return
37 | end
38 | if not data.vehicleData.AdvancedConfigurationData then
39 | lib.notify({title = _L("xml_data"), description = _L("loaded_config"), type = 'success'})
40 | return
41 | end
42 | setAdvancedData(vehicle, data, true, nil)
43 |
44 | TriggerServerEvent("ld-tunertablet:ActiveModeData", plate, data.vehicleData.AdvancedConfigurationData, false)
45 | lib.notify({title = _L("success"), description = _L("xml_data"), type = 'success'})
46 | end)
47 |
48 |
49 |
50 |
--------------------------------------------------------------------------------
/html/src/style/style.css:
--------------------------------------------------------------------------------
1 | @font-face {
2 | font-family: "Gilroy-Light";
3 | src: url("../fonts/Gilroy-Light.ttf") format("opentype");
4 | }
5 | @font-face {
6 | font-family: "Gilroy-Regular";
7 | src: url("../fonts/Gilroy-Regular.ttf") format("opentype");
8 | }
9 | @font-face {
10 | font-family: "Gilroy-Medium";
11 | src: url("../fonts/Gilroy-Medium.ttf") format("opentype");
12 | }
13 | @font-face {
14 | font-family: "Gilroy-Bold";
15 | src: url("../fonts/Gilroy-Bold.ttf") format("opentype");
16 | }
17 |
18 | @font-face {
19 | font-family: "Gilroy-Semibold";
20 | src: url("../fonts/Gilroy-Semibold.ttf") format("opentype");
21 | }
22 | @font-face {
23 | font-family: "Gilroy-Thin";
24 | src: url("../fonts/Gilroy-Thin.otf") format("opentype");
25 | }
26 |
27 | *{
28 | transition: all 0.3s ease;
29 | }
30 |
31 | body {
32 | overflow: hidden;
33 | }
34 | ::-webkit-scrollbar-track { border-radius: 0px; } ::-webkit-scrollbar { width: 0px; height: 0px; } ::-webkit-scrollbar-thumb { border-radius: 0px; background-color: transparent; }
35 |
36 |
37 |
38 | .group:hover .svg-menu path {
39 | fill-opacity: 50;
40 | animation: bounce-right 1s infinite;
41 | }
42 | @keyframes bounce-right {
43 | 0%, 100% {
44 | transform: translateX(-3px);
45 | }
46 | 50% {
47 | transform: translateX(3px);
48 | }
49 | }
50 | @keyframes bounce-right {
51 | 0%, 100% {
52 | transform: translateX(-3px);
53 | }
54 | 50% {
55 | transform: translateX(3px);
56 | }
57 | }
58 |
59 | .range {
60 |
61 | -webkit-appearance: none;
62 | background: rgba(255,255,255,0.02);
63 | overflow: hidden;
64 | }
65 |
66 |
67 | ::-webkit-slider-thumb {
68 | -webkit-appearance: none;
69 | width: .9208vw;
70 | height: 2vh;
71 | border-radius: .1042vw;
72 | background: linear-gradient(90deg, #FFF 0%, #1C202E 100%);
73 | box-shadow: -2000px 0 0 2000px #fff;
74 | }
75 |
76 | .stt {
77 | stroke-dasharray: 0 200;
78 | }
--------------------------------------------------------------------------------
/server/main.lua:
--------------------------------------------------------------------------------
1 |
2 | IsSportModOn, oldSportModData, DriftMode, TuningData, CurrentVehicleData, ActiveMode, Core = {}, {}, {}, {}, {}, {}, nil
3 |
4 | AddEventHandler('onResourceStart', function(resourceName)
5 | if (GetCurrentResourceName() ~= resourceName) then
6 | return
7 | end
8 | Wait(2000)
9 | print(("[^9LD-TUNERTABLET^7] ^3For support if you have any problems^7: https://discord.gg/P92aXCShVP "))
10 | end)
11 |
12 |
13 | RegisterNetEvent("ld-tunertablet:createData:NewSave", function(newData, plate)
14 | local data = ExecuteSQL('SELECT * FROM `ld_tuning` WHERE plate = @plate', {["@plate"] = plate})
15 | if next(data) == nil or next(data) == "[]" then
16 | return
17 | else
18 | local currentData = json.decode(data[1].currentData)
19 |
20 | if currentData == nil then
21 | currentData = {}
22 | end
23 | local newDataName = newData["dataname"]
24 |
25 | local newDataEntry = {
26 | Data = newData,
27 | name = newDataName
28 | }
29 | local newDataIndex = nil
30 | for index, entry in ipairs(currentData) do
31 | if entry.name == newDataName then
32 | newDataIndex = index
33 | break
34 | end
35 | end
36 |
37 | if newDataIndex then
38 |
39 | table.remove(currentData, newDataIndex)
40 | else
41 |
42 | table.insert(currentData, newDataEntry)
43 | end
44 |
45 | ExecuteSQL('UPDATE `ld_tuning` SET currentData = @currentData WHERE plate = @plate', {
46 | ["@currentData"] = json.encode(currentData),
47 | ["@plate"] = plate
48 | }, function(rowsChanged)
49 | if newDataIndex then
50 | TriggerClientEvent('ox_lib:notify', source, {title = _L('success'),description = _L('preset_removed'),type = 'success'})
51 | else
52 | TriggerClientEvent('ox_lib:notify', source, {title = _L('success'),description = _L('preset_saved'),type = 'success'})
53 | end
54 | end)
55 | end
56 | end)
57 |
58 |
59 |
60 | RegisterNetEvent("ld-tunertablet:createData", function(plate, vehdata)
61 | GetData = ExecuteSQL('SELECT * FROM `ld_tuning` WHERE plate = @plate', {["@plate"] = plate})
62 | ActiveMode[plate] = vehdata
63 | if next(GetData) == nil or next(GetData) == "[]" then
64 | ExecuteSQL("INSERT INTO ld_tuning (plate, defaultData) VALUES (@plate, @defaultData)", {
65 | ['@plate'] = plate,
66 | ['@defaultData'] = json.encode(vehdata)
67 | })
68 |
69 | ExecuteSQL("UPDATE ld_tuning SET tunerChip = @tunerChip, plate = @plate WHERE plate = @plate", {
70 | ['@plate'] = plate,
71 | ['@tunerChip'] = 1
72 | })
73 | end
74 | end)
75 |
76 |
--------------------------------------------------------------------------------
/README.md:
--------------------------------------------------------------------------------
1 | # ld-tunertablet
2 | ## Introduction
3 | Tuner Pro is a comprehensive vehicle customization system for FiveM servers that brings real-world tuning mechanics to your roleplay experience. This powerful script allows players to fine-tune every aspect of their vehicle’s performance, from engine output to suspension dynamics, creating truly personalized driving experiences.
4 |
5 | Whether you’re a casual driver looking to improve your vehicle’s everyday performance or a professional racer seeking that competitive edge, our Tuner Chip provides the tools you need in an intuitive, tablet-based interface.
6 |
7 | Developed with both realism and user-friendliness in mind, this script brings authentic automotive tuning to your FiveM server.
8 |
9 | https://youtu.be/h-7TRwZKgJ8
10 |
11 | ## Key Features
12 | ### :rocket: Comprehensive Customization
13 | **Engine Tuning: **Adjust power output, throttle response, and maximum speed
14 | **Transmission Configuration: **Modify gear ratios, shift speeds, and power distribution
15 | **Suspension Setup: **Fine-tune ride height, compression, and rebound for optimal handling
16 | **Brake Balance:** Perfect your braking performance with adjustable brake bias and force
17 | **Traction Control:** Dial in the perfect grip for any driving style or surface condition
18 | ### :floppy_disk: Preset System
19 | **Save & Load:** Create unlimited custom presets for different driving scenarios
20 | **Ready-Made Options:** Quick-select from pre-configured setups like Drift Mode, Sport Mode, and Eco Mode
21 | **Share Configurations:** Export and import tuning setups as XML files to share with friends
22 | ### :video_game: User-Friendly Interface
23 | **Tablet-Based Menu:** Intuitive interface accessible through a simple command (/tunertablet)
24 | **Simple & Advanced Modes:** Choose between user-friendly basic options or detailed parameter control
25 | **Visual Feedback: **Real-time visual indicators of how your changes affect vehicle performance
26 | ### :wrench: Technical Excellence
27 | **Real Handling Physics:** Modifications directly affect GTA’s native handling system for authentic results
28 | **Performance Testing:** Built-in test tool to measure and compare performance metrics
29 | **Minimal Resource Usage:** Optimized code ensures minimal impact on server performance
30 | **Compatibility:** Works with all standard GTA vehicles and most custom vehicle add-ons
31 |
32 | ## Driving Modes
33 | ### Drift Mode
34 | Transform any vehicle into a drift machine with specialized handling characteristics that make sliding around corners easy and controllable.
35 |
36 | ### Sport Mode
37 | Enhance performance with optimized power delivery, responsive throttle, and tightened handling for an aggressive driving experience.
38 |
39 | ### Eco Mode
40 | Reset your vehicle to factory settings with balanced performance characteristics for everyday driving.
41 |
42 | ## Advanced Tuning Categories
43 | The Advanced Configuration menu provides granular control over 8 distinct vehicle systems:
44 |
45 | **Aero: **Manage aerodynamic properties affecting high-speed stability
46 | **Chassis: **Adjust fundamental vehicle characteristics like weight and center of mass
47 | **Engine: **Fine-tune power delivery and response characteristics
48 | **Transmission**: Configure gear ratios and shifting behavior
49 | **Brakes**: Perfect stopping power and distribution
50 | **Traction**: Dial in grip levels for different driving styles
51 | **Suspension**: Create the ideal ride height and damping setup
52 | **Anti-roll**: Minimize body roll for sharper cornering
53 |
54 | > With over 30 adjustable parameters, you’ll have unprecedented control over your vehicle’s behavior!
55 |
56 | **Download :** https://lod.tebex.io/category/2942031
57 |
58 | # Copyright
59 | Copyright © 2025 Lod Resources https://github.com/lod9
60 |
61 | This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
62 |
63 | This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.
64 |
65 | You should have received a copy of the GNU General Public License along with this program. If not, see https://www.gnu.org/licenses/.
66 |
--------------------------------------------------------------------------------
/shared/locales.lua:
--------------------------------------------------------------------------------
1 | Locales = {}
2 | Locales.Languages = {
3 | ["en"] = {
4 | -- Notification Titles
5 | ["default"] = "Default active mode applied for plate:",
6 | ["success"] = "Success",
7 | ["info"] = "Info",
8 | ["warning"] = "Warning",
9 | ["tuning_tablet"] = "Tuner Tablet",
10 | ["drift_mode"] = "Drift Mode",
11 | ["sport_mode"] = "Sport Mode",
12 | ["eco_mode"] = "Eco Mode",
13 | ["normal_mode"] = "Normal Mode",
14 | ["normal_mode_error"] = "Normal Mode Error",
15 | ["settings_saved"] = "Settings Saved",
16 | ["advanced_settings"] = "Advanced Settings",
17 | ["default_settings"] = "Default Settings",
18 | ["test_tool"] = "Test Tool",
19 | ["test_tool_error"] = "Test Tool Error",
20 | ["test_started"] = "Test Started",
21 | ["test_milestone"] = "Test Milestone",
22 | ["test_complete"] = "Test Complete",
23 | ["test_reset"] = "Test Reset",
24 | ["preset_deleted"] = "Preset Deleted",
25 | ["xml_error"] = "XML Error",
26 | ["xml_data"] = "XML Data Applied",
27 | ["error"] = "Error",
28 | ["need_vehicle"] = "You need to be in a vehicle",
29 | ["need_driver_seat"] = "You must be in the driver's seat",
30 | ["mode_enabled"] = "Activated",
31 | ["mode_disabled"] = "Deactivated",
32 | ["settings_applied"] = "Settings applied successfully",
33 | ["no_previous_data"] = "No previous data found",
34 | ["restored_factory"] = "Restored factory settings",
35 | ["press_g_start"] = "Press G to start the test",
36 | ["vehicle_stationary"] = "Vehicle must be stationary",
37 | ["test_in_progress"] = "Performance test in progress",
38 | ["zero_to_sixty"] = "0-60 km/h: {0}s",
39 | ["zero_to_hundred"] = "0-100 km/h: {0}s",
40 | ["quarter_mile"] = "Quarter Mile: {0}s",
41 | ["half_mile"] = "Half Mile: {0}s",
42 | ["press_delete"] = "Press DELETE to reset the test",
43 | ["press_g_restart"] = "Press G to start a new test",
44 | ["preset_removed"] = "Successfully removed preset",
45 | ["no_vehicle_found"] = "No vehicle found!",
46 | ["invalid_vehicle_data"] = "Invalid vehicle data",
47 | ["missing_advanced_config"] = "Missing advanced configuration data",
48 | ["loaded_config"] = "Successfully loaded configuration",
49 | ["simple_settings_applied"] = "Simple settings applied successfully",
50 | ["drift_mode_on"] = "Drift Mode Activated",
51 | ["drift_mode_off"] = "Drift Mode Deactivated",
52 | ["sport_mode_on"] = "Sport Mode Activated",
53 | ["sport_mode_off"] = "Sport Mode Deactivated",
54 | ["eco_mode_on"] = "Eco Mode Activated",
55 | ["eco_mode_off"] = "Eco Mode Deactivated",
56 | ["tuning_restore"] = "Tuning Restored",
57 | ["factory_settings"] = "Factory settings restored",
58 | ["preset_saved"] = "Preset Saved",
59 | ["preset_applied"] = "Preset Applied",
60 | ["advanced_tuning"] = "Advanced Tuning",
61 | ["measure_complete"] = "Measurement Complete",
62 | ["invalid_preset"] = "Invalid Preset",
63 | ["missing_data"] = "Missing Configuration Data",
64 | ["welcome"] = "Welcome",
65 | ["ucreatedpresets"] = "Your Created Presets",
66 | ["vehiclestats"] = "Vehicle Stats",
67 | ["acceleration"] = "Acceleration",
68 | ["speed"] = "Speed",
69 | ["handling"] = "Traction",
70 | ["braking"] = "Braking",
71 | ["oiltemp"] = "Fuel Level",
72 | ["dashtemp"] = "Engine Health",
73 | ["watertemp"] = "Oil Level",
74 | ["enginetemp"] = "Engine Temp",
75 | ["confirmtext"] = "You are responsible for any modifications to your vehicle, please do not do this if you are not sure.",
76 | ["metrics"] = "Metrics",
77 | ["metricsdescription"] = "This editor makes an effort of translating some handling items to real world measurements, depicted in red on them. For transparency and ease of fact-checking, this section documents and details the math used to get the Ingame metrics.",
78 | ["ucreatedpresetsdesc"] = "You can easily access or delete the settings you have edited and saved from the specially developed configuration page."
79 |
80 |
81 | },
82 |
83 | }
--------------------------------------------------------------------------------
/server/presets.lua:
--------------------------------------------------------------------------------
1 | Citizen.CreateThread(function()
2 |
3 | lib.callback.register('ld-tunertablet:sqlDta', function(source, plate, dataName)
4 | if not dataName then
5 | -- print("dataName is nil!")
6 | return nil
7 | end
8 |
9 | local data = ExecuteSQL('SELECT * FROM `ld_tuning` WHERE plate = @plate', {["@plate"] = plate})
10 |
11 | if data and #data > 0 then
12 | -- print("SQL Data Exists:", json.encode(data[1]))
13 | else
14 | -- print("No Data Found for plate:", plate)
15 | return nil
16 | end
17 |
18 | if dataName == "DefaultData" then
19 | return data[1].defaultData and json.decode(data[1].defaultData) or nil
20 | elseif dataName == "currentData" then
21 | return data[1].currentData and json.decode(data[1].currentData) or nil
22 | else
23 | TriggerClientEvent('ox_lib:notify', source, {title = _L('warning'),description = _L('invalid_preset'),type = 'warning'})
24 | -- print(" Invalid dataName received:", dataName)
25 | return nil
26 | end
27 | end)
28 | end)
29 |
30 | RegisterNetEvent("ld-tunertablet:deleteCurrentData", function(jsdata, plate)
31 | local data = ExecuteSQL('SELECT * FROM `ld_tuning` WHERE plate = @plate', {["@plate"] = plate})
32 |
33 | if not data or #data == 0 then
34 | -- TriggerClientEvent('ox_lib:notify', source, {title = _L('warning'),description = _L('invalid_preset'),type = 'warning'})
35 | return
36 | end
37 |
38 | local currentData = data[1].currentData
39 | local jsonData = json.decode(currentData)
40 |
41 | if not jsonData or #jsonData == 0 then
42 | -- print("No presets found in currentData")
43 | return
44 | end
45 |
46 | local targetIndex = nil
47 |
48 | for idx, entry in ipairs(jsonData) do
49 | if entry.Data.dataname == jsdata.vehicleData.title then
50 | targetIndex = idx
51 | break
52 | end
53 | end
54 |
55 | if targetIndex then
56 | table.remove(jsonData, targetIndex)
57 | local newJsonData = json.encode(jsonData)
58 |
59 | ExecuteSQL('UPDATE `ld_tuning` SET currentData = @newData WHERE plate = @plate', {
60 | ["@newData"] = newJsonData,
61 | ["@plate"] = plate
62 | }, function(rowsChanged)
63 | if rowsChanged > 0 then
64 | TriggerClientEvent('ox_lib:notify', source, {title = _L('success'),description = _L('preset_deleted'),type = 'sucess'})
65 | else
66 | print("Error updating ld_tuning.")
67 | end
68 | end)
69 | else
70 | -- print("No matching preset found for: " .. jsdata.vehicleData.title)
71 | TriggerClientEvent('ox_lib:notify', source, {title = _L('warning'),description = _L('invalid_preset'),type = 'warning'})
72 | end
73 | end)
74 |
75 |
76 | RegisterNetEvent("ld-tunertablet:ActiveModeData", function(plate, activedata, bool)
77 | if activedata ~= nil then
78 | local activeDataToSave
79 |
80 | if bool then
81 | activeDataToSave = activedata["vehicleData"]
82 | else
83 | activeDataToSave = activedata
84 | end
85 |
86 | ExecuteSQL('UPDATE `ld_tuning` SET activeData = @activeData WHERE plate = @plate', {
87 | ['@plate'] = plate,
88 | ['@activeData'] = json.encode(activeDataToSave)
89 | })
90 | ActiveMode[plate] = activeDataToSave
91 | else
92 | local data = ExecuteSQL('SELECT * FROM `ld_tuning` WHERE plate = @plate', {["@plate"] = plate})
93 | if data and data[1] and data[1].defaultData then
94 | local newdata = json.decode(data[1].defaultData)
95 | ExecuteSQL('UPDATE `ld_tuning` SET activeData = @activeData WHERE plate = @plate', {
96 | ['@plate'] = plate,
97 | ['@activeData'] = json.encode(newdata)
98 | })
99 |
100 | ActiveMode[plate] = newdata
101 |
102 | TriggerClientEvent('ox_lib:notify', source, {title = _L('success'),description = _L('default'),type = 'success'})
103 | else
104 | print("❌ No default data found for plate:", plate)
105 | TriggerClientEvent('ox_lib:notify', source, {title = _L('warning'),description = _L('invalid_preset'),type = 'warning'})
106 | end
107 | end
108 | end)
109 |
--------------------------------------------------------------------------------
/client/main.lua:
--------------------------------------------------------------------------------
1 |
2 | driftMod, oldSportMod, SportModOn, Core = {}, {}, {}, nil
3 |
4 |
5 | function _L(key, ...)
6 | local lang = Config.Language or "en"
7 | local result = Locales.Languages[lang][key] or Locales.Languages["en"][key] or key
8 |
9 |
10 | local args = {...}
11 | if #args > 0 then
12 | for i, v in ipairs(args) do
13 | result = result:gsub("{" .. (i-1) .. "}", tostring(v))
14 | end
15 | end
16 |
17 | return result
18 | end
19 |
20 |
21 | RegisterCommand("tunertablet", function()
22 | local ped = PlayerPedId()
23 | local vehicle = GetVehiclePedIsIn(ped, false)
24 |
25 | if vehicle == 0 then
26 | lib.notify({title = _L("tuning_tablet"), description = _L("need_vehicle"), type = 'error'})
27 | return
28 | end
29 |
30 |
31 | if GetPedInVehicleSeat(vehicle, -1) ~= ped then
32 | lib.notify({title = _L("tuning_tablet"), description = _L("need_driver_seat"), type = 'error'})
33 | return
34 | end
35 |
36 | OpenUI()
37 | end, false)
38 |
39 |
40 | function OpenUI()
41 | local ped = PlayerPedId()
42 | local vehicle = GetVehiclePedIsUsing(ped)
43 | local vehicleDatas = {
44 | currentVehicleName = GetDisplayNameFromVehicleModel(GetEntityModel(vehicle)),
45 | vehicleHash = GetEntityModel(vehicle),
46 | currentVehiclePlate = GetVehicleNumberPlateText(vehicle),
47 | currentVehicleAcceleration = GetVehicleHandlingFloat(vehicle, 'CHandlingData', 'fInitialDriveForce') * 10,
48 | currentVehicleBraking = GetVehicleHandlingFloat(vehicle, 'CHandlingData', 'fBrakeForce') * 10,
49 | currentVehicleTraction = GetVehicleHandlingFloat(vehicle, 'CHandlingData', 'fTractionCurveMax') * 10,
50 | currentVehicleTopSpeed = GetVehicleMaxSpeed(vehicle),
51 | currentVehicleEngineTemp = GetVehicleEngineTemperature(vehicle),
52 | currentVehicleFuelLevel = GetVehicleFuelLevel(vehicle),
53 | currentVehicleOilLevel = GetVehicleOilLevel(vehicle),
54 | currentVehicleHealth = GetVehicleEngineHealth(vehicle),
55 | }
56 |
57 | if IsPedInAnyVehicle(ped) then
58 | local getData = GetVehData(vehicle)
59 | TriggerServerEvent("ld-tunertablet:createData", GetVehicleNumberPlateText(vehicle), getData)
60 | SetNuiFocus(true, true)
61 | SendNUIMessage({
62 | action = "SHOW_INTERFACE",
63 | vehicleDatas = vehicleDatas,
64 | handlingData = GetVehData(vehicle),
65 | Locales = Locales.Languages[Config.Language],
66 | AdvancedConfiguration = Config.Configurables["Advanced"],
67 | SimpleConfiguration = Config.Configurables["Simple"],
68 | readyPresets = Config.ReadyPresets,
69 | Pages = Config.Pages["Main_Pages"],
70 | subPages = Config.Pages["Sub_Pages"],
71 | })
72 | else
73 | lib.notify({title = _L("tuning_tablet"), description = _L("need_vehicle"), type = 'error'})
74 | end
75 | end
76 |
77 |
78 | exports('OpenUI', OpenUI)
79 |
80 |
81 | RegisterNUICallback('exit', function()
82 | SetNuiFocus(false, false)
83 | end)
84 |
85 |
86 | RegisterNUICallback("GET_ADVANCED_DATA",function()
87 | local ped = PlayerPedId()
88 | local veh = GetVehiclePedIsUsing(ped)
89 | SendNUIMessage({
90 | action = "GET_VEHICLE_DATA",
91 | vehicleData = GetVehData(veh),
92 | })
93 | end)
94 |
95 | RegisterNUICallback("SAVE_SIMPLE_SETTINGS", function(data)
96 | local ped = PlayerPedId()
97 | local veh = GetVehiclePedIsUsing(ped)
98 | setVehData(veh, data)
99 | TriggerServerEvent("ld-tunertablet:CreateTableData", GetVehicleNumberPlateText(veh), data, "TuningData")
100 | lib.notify({title = _L("settings_saved"), description = _L("simple_settings_applied"), type = 'success'})
101 | end)
102 |
103 | RegisterNUICallback("SAVE_ADVANCED_SETTINGS", function(data)
104 | local ped = PlayerPedId()
105 | local veh = GetVehiclePedIsUsing(ped)
106 | local plate = GetVehicleNumberPlateText(veh)
107 | TriggerServerEvent("ld-tunertablet:createData:NewSave", data, plate, data.dataname)
108 | setAdvancedData(veh, data, false, nil)
109 | TriggerServerEvent("ld-tunertablet:ActiveModeData", plate, data, true)
110 | lib.notify({title = _L("advanced_settings"), description = _L("settings_applied"), type = 'success'})
111 | end)
112 |
113 | RegisterNUICallback("DEFAULT_BACK", function ()
114 | local ped = PlayerPedId()
115 | local veh = GetVehiclePedIsUsing(ped)
116 | local plate = GetVehicleNumberPlateText(veh)
117 | DefaultAdvancedData(veh, plate)
118 | TriggerServerEvent("ld-tunertablet:ActiveModeData", plate)
119 | lib.notify({title = _L("default_settings"), description = _L("restored_factory"), type = 'info'})
120 | end)
121 |
122 | RegisterNUICallback("TEST_TOOL", function()
123 | while true do
124 | local playerPed = PlayerPedId()
125 | local vehicle = GetVehiclePedIsIn(playerPed, false)
126 |
127 | if vehicle == 0 then
128 | lib.notify({title = _L("test_tool_error"), description = _L("need_vehicle"), type = 'error'})
129 | return
130 | end
131 | SetNuiFocus(false, false)
132 |
133 | lib.notify({title = _L("test_tool"), description = _L("press_g_start"), type = 'info'})
134 |
135 | while true do
136 | Wait(0)
137 |
138 | if IsControlJustReleased(0, 194) then
139 |
140 | SendNUIMessage({
141 | action = "TIMER",
142 | status = 2
143 | })
144 | OpenUI()
145 | return
146 | end
147 |
148 | if GetEntitySpeed(vehicle) * 3.6 > 1 then
149 | if IsControlJustReleased(0, 47) then
150 | lib.notify({title = _L("test_tool_error"), description = _L("vehicle_stationary"), type = 'error'})
151 |
152 | end
153 | else
154 | if IsControlJustReleased(0, 47) then
155 | break
156 | end
157 | end
158 | end
159 |
160 | local startTime = GetGameTimer()
161 | local startCoords = GetEntityCoords(vehicle)
162 | local quarterMile = 402.336 --
163 | local halfMile = 804.672
164 | local reached100, reached60, reachedQuarter, reachedHalf = false, false, false, false
165 | local zeroToHundredTime, zeroToSixtyTime, quarterMileTime, halfMileTime
166 | SendNUIMessage({
167 | action = "TIMER",
168 | status = 1
169 | })
170 | lib.notify({title = _L("test_started"), description = _L("test_in_progress"), type = 'success'})
171 |
172 | local testActive = true
173 | while testActive do
174 | Wait(0)
175 | if IsControlJustReleased(0, 194) then
176 | SendNUIMessage({
177 | action = "TIMER",
178 | status = 2
179 | })
180 | OpenUI()
181 | return
182 | end
183 | if IsControlJustReleased(0, 20) then
184 | SendNUIMessage({
185 | action = "TIMER",
186 | status = 2
187 | })
188 | lib.notify({title = _L("test_reset"), description = _L("press_g_restart"), type = 'info'})
189 | break
190 | end
191 | local currentSpeed = GetEntitySpeed(vehicle) * 3.6
192 | local currentTime = GetGameTimer() - startTime
193 | local currentCoords = GetEntityCoords(vehicle)
194 | local distance = #(currentCoords - startCoords)
195 |
196 | local updated = false
197 |
198 | if not reached100 and currentSpeed >= 100 then
199 | zeroToHundredTime = currentTime / 1000
200 | reached100 = true
201 | updated = true
202 | lib.notify({title = _L("test_milestone"), description = _L("zero_to_hundred", zeroToHundredTime), type = 'info'})
203 | end
204 |
205 | if not reached60 and currentSpeed >= 60 then
206 | zeroToSixtyTime = currentTime / 1000
207 | reached60 = true
208 | updated = true
209 | lib.notify({title = _L("test_milestone"), description = _L("zero_to_sixty", zeroToSixtyTime), type = 'info'})
210 | end
211 |
212 | if not reachedQuarter and distance >= quarterMile then
213 | quarterMileTime = currentTime / 1000
214 | reachedQuarter = true
215 | updated = true
216 | lib.notify({title = _L("test_milestone"), description = _L("quarter_mile", quarterMileTime), type = 'info'})
217 | end
218 |
219 | if not reachedHalf and distance >= halfMile then
220 | halfMileTime = currentTime / 1000
221 | reachedHalf = true
222 | updated = true
223 | lib.notify({title = _L("test_milestone"), description = _L("half_mile", halfMileTime), type = 'info'})
224 | end
225 |
226 | if updated then
227 | SendNUIMessage({
228 | action = "GET_TOOL",
229 | reach100 = zeroToHundredTime or "N/A",
230 | reach60 = zeroToSixtyTime or "N/A",
231 | reachquart = quarterMileTime or "N/A",
232 | reachhalf = halfMileTime or "N/A"
233 | })
234 | end
235 |
236 | if reached100 and reached60 and reachedQuarter and reachedHalf then
237 | testActive = false
238 | end
239 | end
240 |
241 | SendNUIMessage({
242 | action = "GET_TOOL",
243 | reach100 = zeroToHundredTime or "N/A",
244 | reach60 = zeroToSixtyTime or "N/A",
245 | reachquart = quarterMileTime or "N/A",
246 | reachhalf = halfMileTime or "N/A"
247 | })
248 | SendNUIMessage({
249 | action = "TIMER",
250 | status = 0
251 | })
252 | lib.notify({title = _L("test_complete"), description = _L("press_delete"), type = 'success'})
253 |
254 |
255 | end
256 | end)
257 |
258 |
259 |
260 |
261 |
262 |
--------------------------------------------------------------------------------
/client/mode.lua:
--------------------------------------------------------------------------------
1 |
2 |
3 | RegisterNuiCallback("CHANGE_MODE", function(data)
4 | mode = data.mode
5 | local vehicle = GetVehiclePedIsIn(PlayerPedId(), false)
6 |
7 | if IsPedInAnyVehicle(PlayerPedId()) and GetPedInVehicleSeat(vehicle, -1) == PlayerPedId() then
8 | local plate = GetVehicleNumberPlateText(vehicle)
9 |
10 | if mode == "Drift Mode" then
11 | TriggerServerEvent("ld-tunertablet:CreateTableData", plate, false, "NormalMod")
12 | SportModOn[plate] = false
13 | if not driftMod[plate] then
14 | driftMod[plate] = true
15 | TriggerServerEvent("ld-tunertablet:CreateTableData", plate, true, "DriftMode")
16 | lib.notify({title = _L("drift_mode"), description = _L("mode_enabled"), type = 'success'})
17 | else
18 | driftMod[plate] = false
19 | TriggerServerEvent("ld-tunertablet:CreateTableData", plate, false, "DriftMode")
20 | lib.notify({title = _L("drift_mode"), description = _L("mode_disabled"), type = 'error'})
21 | end
22 | elseif mode == "Sport Mode" then
23 | TriggerServerEvent("ld-tunertablet:CreateTableData", plate, false, "NormalMod")
24 | driftMod[plate] = false
25 | if not SportModOn[plate] then
26 | SportModOn[plate] = true
27 | SportModOnFunction(vehicle, plate)
28 | lib.notify({title = _L("sport_mode"), description = _L("mode_enabled"), type = 'success'})
29 | else
30 | SportModOn[plate] = false
31 | lib.callback('ld-tunertablet:GetData',false, function(dataone)
32 | if dataone == nil or dataone == false then
33 | SportModOnFunction(vehicle, plate)
34 | else
35 | NormalMode(vehicle, plate, oldSportMod[plate])
36 | end
37 | end, plate, "exOldData")
38 | lib.notify({title = _L("sport_mode"), description = _L("mode_disabled"), type = 'error'})
39 | end
40 | elseif mode == "Eco Mode" then
41 | driftMod[plate] = false
42 | SportModOn[plate] = false
43 | TriggerServerEvent("ld-tunertablet:CreateTableData", plate, false, "NormalMod")
44 | NormalMode(vehicle, plate, oldSportMod[plate])
45 | lib.notify({title = _L("eco_mode"), description = _L("mode_enabled"), type = 'success'})
46 |
47 | end
48 | end
49 | end)
50 |
51 |
52 | function SportModOnFunction(vehicle, plate)
53 | local oldfInitialDriveMaxFlatVelData = GetVehicleHandlingFloat(vehicle, "CHandlingData", "fInitialDriveMaxFlatVel")
54 | local oldffDriveInertiaData = GetVehicleHandlingFloat(vehicle, "CHandlingData", "fDriveInertia")
55 | local oldfClutchChangeRateScaleUpShiftData = GetVehicleHandlingFloat(vehicle, "CHandlingData", "fClutchChangeRateScaleUpShift")
56 | local oldfClutchChangeRateScaleDownShiftData = GetVehicleHandlingFloat(vehicle, "CHandlingData", "fClutchChangeRateScaleDownShift")
57 | oldSportMod[plate] = {
58 | oldfInitialDriveMaxFlatVel = oldfInitialDriveMaxFlatVelData,
59 | oldffDriveInertia = oldfInitialDriveMaxFlatVelData,
60 | oldfClutchChangeRateScaleUpShift = oldfInitialDriveMaxFlatVelData,
61 | oldfClutchChangeRateScaleDownShift = oldfInitialDriveMaxFlatVelData,
62 | }
63 |
64 | SetVehicleHandlingField(vehicle, 'CHandlingData', 'fInitialDriveMaxFlatVel', oldfInitialDriveMaxFlatVelData + (oldfInitialDriveMaxFlatVelData / Config.Modes["SportModeSettings"]["fInitialDriveMaxFlatVel"]))
65 | SetVehicleHandlingField(vehicle, 'CHandlingData', 'fDriveInertia', Config.Modes["SportModeSettings"]["fDriveInertia"])
66 | SetVehicleHandlingField(vehicle, 'CHandlingData', 'fClutchChangeRateScaleUpShift', oldfClutchChangeRateScaleUpShiftData * Config.Modes["SportModeSettings"]["fClutchChangeRateScaleUpShift"])
67 | SetVehicleHandlingField(vehicle, 'CHandlingData', 'fClutchChangeRateScaleDownShift', oldfClutchChangeRateScaleDownShiftData * Config.Modes["SportModeSettings"]["fClutchChangeRateScaleDownShift"])
68 | TriggerServerEvent("ld-tunertablet:CreateTableData", plate, oldSportMod[plate], "IsSportModOn")
69 | lib.notify({title = _L("sport_mode"), description = _L("settings_applied"), type = 'success'})
70 | end
71 |
72 | function NormalMode(vehicle, plate, olddata)
73 | if olddata == nil then
74 | lib.notify({title = _L("normal_mode_error"), description = _L("no_previous_data"), type = 'error'})
75 | return
76 | else
77 | SetVehicleHandlingField(vehicle, 'CHandlingData', 'fInitialDriveMaxFlatVel', olddata.oldfInitialDriveMaxFlatVel)
78 | SetVehicleHandlingField(vehicle, 'CHandlingData', 'fDriveInertia', olddata.oldffDriveInertia)
79 | SetVehicleHandlingField(vehicle, 'CHandlingData', 'fClutchChangeRateScaleUpShift', olddata.oldfClutchChangeRateScaleUpShift)
80 | SetVehicleHandlingField(vehicle, 'CHandlingData', 'fClutchChangeRateScaleDownShift', olddata.oldfClutchChangeRateScaleDownShift)
81 | end
82 | TriggerServerEvent("ld-tunertablet:CreateTableData", plate , false, "CloseSportMod")
83 | lib.notify({title = _L("normal_mode"), description = _L("settings_applied"), type = 'success'})
84 | end
85 |
86 | local lastVehicle = nil
87 | Citizen.CreateThread(function()
88 | Citizen.Wait(1000)
89 |
90 | while true do
91 | Citizen.Wait(1000)
92 |
93 | local vehicle = GetVehiclePedIsIn(PlayerPedId(), false)
94 |
95 | if IsPedInAnyVehicle(PlayerPedId()) and GetPedInVehicleSeat(vehicle, -1) == PlayerPedId() then
96 | local plate = GetVehicleNumberPlateText(vehicle)
97 |
98 | if vehicle ~= lastVehicle then
99 | lastVehicle = vehicle
100 | Wait(200)
101 | local activebool = false
102 | lib.callback('ld-tunertablet:GetData',false, function(activedata)
103 | Wait(1000)
104 | if activedata ~= nil then
105 | local ped = PlayerPedId()
106 | local veh = GetVehiclePedIsUsing(ped)
107 | activebool = true
108 | setAdvancedData(veh, activedata, nil, true)
109 | end
110 | end, plate, "ActiveData")
111 | Wait(200)
112 |
113 | lib.callback('ld-tunertablet:GetData',false, function(driftModData)
114 | Wait(1000)
115 | if driftModData == true then
116 | if driftMod[plate] == false or driftMod[plate] == nil then
117 | driftMod[plate] = true
118 | end
119 | elseif driftModData == false then
120 | if driftMod[plate] == true or driftMod[plate] == nil then
121 | driftMod[plate] = false
122 | end
123 | end
124 | end, plate, "DriftMode")
125 |
126 | Wait(200)
127 | lib.callback('ld-tunertablet:GetData',false, function(SportModOnData)
128 | Wait(1000)
129 | if SportModOnData == true then
130 | if SportModOn[plate] == false or SportModOn[plate] == nil then
131 | SportModOn[plate] = true
132 | end
133 | elseif SportModOnData == false then
134 | if SportModOn[plate] == true then
135 | lib.callback('ld-tunertablet:GetData',false, function(SportModeBool, olddata)
136 | if SportModeBool == nil or SportModeBool == true then
137 | if oldSportMod[plate] == nil or oldSportMod[plate] == false then
138 | olddata = olddata
139 | else
140 | olddata = oldSportMod[plate]
141 | end
142 | SetVehicleHandlingField(vehicle, 'CHandlingData', 'fInitialDriveMaxFlatVel', olddata.oldfInitialDriveMaxFlatVel)
143 | SetVehicleHandlingField(vehicle, 'CHandlingData', 'fDriveInertia', olddata.oldffDriveInertia)
144 | SetVehicleHandlingField(vehicle, 'CHandlingData', 'fClutchChangeRateScaleUpShift', olddata.oldfClutchChangeRateScaleUpShift)
145 | SetVehicleHandlingField(vehicle, 'CHandlingData', 'fClutchChangeRateScaleDownShift', olddata.oldfClutchChangeRateScaleDownShift)
146 | TriggerServerEvent("ld-tunertablet:CreateTableData", plate , false, "CloseSportMod")
147 | end
148 |
149 | end, plate, "exOldData")
150 | SportModOn[plate] = false
151 | end
152 | end
153 | end, plate, "IsSportModOn")
154 |
155 | Wait(200)
156 | lib.callback('ld-tunertablet:GetData',false, function(tuningdata)
157 | Wait(1000)
158 | if tuningdata ~= nil then
159 | setVehData(vehicle, tuningdata)
160 | end
161 | end, plate, "TuningData")
162 | Wait(200)
163 | lib.callback('ld-tunertablet:GetData',false, function(currentdata)
164 | Wait(1000)
165 | if currentdata ~= nil then
166 | if not activebool then
167 | local ped = PlayerPedId()
168 | local veh = GetVehiclePedIsUsing(ped)
169 | setAdvancedData(veh, currentdata, nil, true)
170 | end
171 |
172 | end
173 | end, plate, "CurrentVehicleData")
174 |
175 | end
176 | else
177 | lastVehicle = nil
178 | end
179 | end
180 | end)
181 |
182 | Citizen.CreateThread(function ()
183 | while true do
184 | Citizen.Wait(sleep)
185 | sleep = 3000
186 | local vehicle = GetVehiclePedIsIn(PlayerPedId(), false)
187 |
188 | if IsPedInAnyVehicle(PlayerPedId()) and GetPedInVehicleSeat(vehicle, -1) == PlayerPedId() then
189 | sleep = 1500
190 | local plate = GetVehicleNumberPlateText(vehicle)
191 | if Config.Modes["SpeedType"] then
192 | speed = math.ceil(GetEntitySpeed(vehicle) * 2.236936)
193 | else
194 | speed = math.ceil(GetEntitySpeed(vehicle) * 3.6)
195 | end
196 | if driftMod[plate] then
197 | sleep = 0
198 | if IsControlPressed(1, 21) then
199 | if speed <= tonumber(Config.Modes["DriftModeSpeedLimit"]) then
200 | SetVehicleReduceGrip(vehicle, true)
201 | end
202 | elseif IsControlJustReleased(1, 21) then
203 | SetVehicleReduceGrip(vehicle, false)
204 | end
205 |
206 | end
207 | end
208 |
209 | end
210 | end)
211 |
212 | Citizen.CreateThread(function ()
213 | while true do
214 | Citizen.Wait(0)
215 | local vehicle = GetVehiclePedIsIn(PlayerPedId(), false)
216 |
217 | if IsPedInAnyVehicle(PlayerPedId()) and GetPedInVehicleSeat(vehicle, -1) == PlayerPedId() then
218 | local plate = GetVehicleNumberPlateText(vehicle)
219 | Wait(1000)
220 | if SportModOn[plate] then
221 | local oldfInitialDriveMaxFlatVelData = GetVehicleHandlingFloat(vehicle, "CHandlingData", "fInitialDriveMaxFlatVel")
222 | local oldfClutchChangeRateScaleUpShiftData = GetVehicleHandlingFloat(vehicle, "CHandlingData", "fClutchChangeRateScaleUpShift")
223 | local oldfClutchChangeRateScaleDownShiftData = GetVehicleHandlingFloat(vehicle, "CHandlingData", "fClutchChangeRateScaleDownShift")
224 |
225 | oldSportMod[plate] = {
226 | oldfInitialDriveMaxFlatVel = oldfInitialDriveMaxFlatVelData,
227 | oldffDriveInertia = oldfInitialDriveMaxFlatVelData,
228 | oldfClutchChangeRateScaleUpShift = oldfInitialDriveMaxFlatVelData,
229 | oldfClutchChangeRateScaleDownShift = oldfInitialDriveMaxFlatVelData,
230 | }
231 |
232 | SetVehicleHandlingField(vehicle, 'CHandlingData', 'fInitialDriveMaxFlatVel', oldfInitialDriveMaxFlatVelData + (oldfInitialDriveMaxFlatVelData / 100 * 20))
233 | SetVehicleHandlingField(vehicle, 'CHandlingData', 'fDriveInertia', 2.000000)
234 | SetVehicleHandlingField(vehicle, 'CHandlingData', 'fClutchChangeRateScaleUpShift', oldfClutchChangeRateScaleUpShiftData * 8)
235 | SetVehicleHandlingField(vehicle, 'CHandlingData', 'fClutchChangeRateScaleDownShift', oldfClutchChangeRateScaleDownShiftData * 8)
236 | break
237 | else
238 | lib.callback('ld-tunertablet:GetData',false, function(dataone, olddata)
239 | if dataone == nil or dataone == false then
240 | return
241 | else
242 | olddata = oldSportMod[plate]
243 | if olddata == nil then return end
244 | SetVehicleHandlingField(vehicle, 'CHandlingData', 'fInitialDriveMaxFlatVel', olddata.oldfInitialDriveMaxFlatVel)
245 | SetVehicleHandlingField(vehicle, 'CHandlingData', 'fDriveInertia', olddata.oldffDriveInertia)
246 | SetVehicleHandlingField(vehicle, 'CHandlingData', 'fClutchChangeRateScaleUpShift', olddata.oldfClutchChangeRateScaleUpShift)
247 | SetVehicleHandlingField(vehicle, 'CHandlingData', 'fClutchChangeRateScaleDownShift', olddata.oldfClutchChangeRateScaleDownShift)
248 | TriggerServerEvent("ld-tunertablet:CreateTableData", plate , false, "CloseSportMod")
249 | end
250 |
251 | end, plate, "exOldData")
252 | SportModOn[plate] = false
253 | end
254 | end
255 |
256 | end
257 | end)
258 |
259 |
--------------------------------------------------------------------------------
/shared/config.lua:
--------------------------------------------------------------------------------
1 | Config = {}
2 |
3 | Config.Language = "en" -- just en if u want add more lang from locales.lua
4 |
5 | Config.Menu = {
6 | ["Commands"] = {
7 | ["Tuner"] = "tunertablet",
8 | },
9 | }
10 |
11 | Config.Modes = {
12 | ["SpeedType"] = "KMH",
13 | ["DriftModeSpeedLimit"] = 50,
14 | ["SportModeSettings"] = {
15 | ["fInitialDriveMaxFlatVel"] = 100 * 20,
16 | ["fDriveInertia"] = 2.000000,
17 | ["fClutchChangeRateScaleUpShift"] = 8,
18 | ["fClutchChangeRateScaleDownShift"] = 8,
19 | }
20 | }
21 |
22 | Config.Pages = {
23 | ["Main_Pages"] = {
24 | { title = 'Home', description = 'Start screen with quick access to your tunerchip settings. You can start tuning your vehicle here.' },
25 | { title = 'Presets', description = 'Load or create new presets for your vehicle. Customize and save configurations for quick access.' },
26 | { title = 'Simple Configuration', description = 'Easily configure basic settings for your vehicle. A user-friendly and quick editing interface.' },
27 | { title = 'Advanced Configuration', description = 'Fine-tune advanced settings like engine performance and suspension for optimal results.' },
28 | { title = 'Test Tool', description = 'One-to-one to measure your vehicles performance' },
29 | { title = 'XML', description = 'Export or import your vehicle settings as XML files for easy sharing or backup purposes.' }
30 | },
31 | ["Sub_Pages"] = {
32 | { title = 'Aero', description = 'This set of values represent the vehicle body shape, and mostly affect top speed behavior.' },
33 | { title = 'Chassis', description = 'This set of values represent the vehicle body itself, and will play a big role on how the vehicle behaves overall.' },
34 | { title = 'Engine', description = 'The moving force of your vehicle, this set of values govern details about how different bits of the engine will behave. Works in close relationswhip with Transmission.' },
35 | { title = 'Transmission', description = 'Together with the Engine, the transmission settings define the power output of your vehicle.' },
36 | { title = 'Brakes', description = 'Brakes are one of the main defining factors of the performance of your vehicle. This value should complement both the vehicles power and traction, so as to keep a coherent balance. Unless you have reasons for it not to.' },
37 | { title = 'Traction', description = 'Traction is the main limiter of power and braking ability, and has to be able to handle both; otherwise your vehicle may suffer wheelspin/wheel lock. However, these can also be treated as features and not defects, being part of the vehicles personality.' },
38 | { title = 'Suspension', description = 'Stiffer, softer, loose, tight. This section governs how your car floats above its wheels.' },
39 | { title = 'Anti-roll', description = 'The main goal of the Anti-roll Bars is to prevent the car from leaning too much when taking a corner. Do keep in mind that the wheels the cars leans into, receive more grip from the pressure, while the wheels on the other side lose traction.' }
40 | }
41 | }
42 |
43 | Config.ReadyPresets = {
44 | { title = 'Drift Mode', description = 'In Drift mode, you can drift by pressing the support button you set.' },
45 | { title = 'Eco Mode', description = 'Eco Mode has your cars standard settings and you can select this mode if you want to return it back.' },
46 | { title = 'Sport Mode', description = 'Sport Mode sophisticatedly indexes your vehicle to the ideal speed mode' }
47 | }
48 |
49 | Config.Configurables = {
50 | ["Simple"] = {
51 | {title = 'Boost', description = 'Also called engine power, it dictates the target acceleration the engine is aiming for, measured in G-Forces. Wheel grip may not be able to cope with it, however.', minValue = 0, maxValue = 0.5, step = 0.005, modal = 'fInitialDriveForce', fInitialDriveForce = 0},
52 | {title = 'Acceleration', description = 'How responsive the engine revs will be to throttle control. It is measured in Higher values will result in faster RPM acceleration and deceleration, while lower values will result in more sluggish RPMs.', minValue = 0, maxValue = 3, step = 0.001, modal = 'fDriveInertia', fDriveInertia = 0},
53 | {title = 'Gear Change', description = 'The vehicle will take 0.5s to shift from gear to gear.', minValue = 0, maxValue = 10, step = 0.25, modal = 'fClutchChangeRateScaleUpShift', fClutchChangeRateScaleUpShift = 0},
54 | {title = 'Breaking', description = 'Usually, the best balance is between 0.55 and 0.7 for best braking capabilities, as it accounts for the weight transfer that ensues when braking. (60% Front - 40% Rear)', minValue = 0, maxValue = 1, step = 0.025, modal = 'fBrakeBiasFront', fBrakeBiasFront = 0},
55 | {title = 'Drivetrain', description = 'Defines how the power from fInitialDriveForce is distributed between the axles. 0.0 implies a fully RWD setup, with will only deliver power to the rear wheels.', minValue = 0, maxValue = 1, step = 0.05, modal = 'fDriveBiasFront', fDriveBiasFront = 0},
56 | },
57 | ["Advanced"] = {
58 | {subCategory = "Aero", title = 'Downforce', description = 'Downforce is a way to gain grip at speed, and can be increased by Spoilers. This car will generate 0.14Gs of additional grip at 60mph.', minValue = 0, maxValue = 5, step = 0.05, modal = 'fDownforceModifier', fDownforceModifier = 0},
59 | {subCategory = "Aero", title = 'Air Resistance', description = 'Higher resistance means an eariler perceived loss of power at higher speed, resulting in a lower top speed, as the engine cannot overpower this force. Lower air resistance allows the vehicle to travel faster on the same power.', minValue = 0, maxValue = 20, step = 0.5, modal = 'fInitialDragCoeff', fInitialDragCoeff = 0},
60 |
61 | -- Chassis
62 | {subCategory = "Chassis", title = 'Mass', description = 'Measured in Kg, mass is only responsible for the interaction between entities. Lets say its the vehicles pushing force.', minValue = 0, maxValue = 15000, step = 1, modal = 'fMass', fMass = 0},
63 | {subCategory = "Chassis", title = 'Center of Mass', description = 'This editor is not able to edit the Center Of Mass offsets yet.', minValue = -2, maxValue = 2, step = 1, modal = 'vecCentreOfMassOffset', vecCentreOfMassOffset = 0},
64 | {subCategory = "Chassis", title = 'Rotational Inertia', description = 'This editor is not able to edit the Rotational Inertia offsets yet.', minValue = -2, maxValue = 2, step = 1, modal = 'vecInertiaMultiplier', vecInertiaMultiplier = 0},
65 |
66 | -- Engine
67 | {subCategory = "Engine", title = 'Engine/Acceleration', description = 'Also called engine power, it dictates the target acceleration the engine is aiming for, measured in G-Forces. Wheel grip may not be able to cope with it, however.', minValue = 0, maxValue = 0.5, step = 0.005, modal = 'fInitialDriveForce', fInitialDriveForce = 0},
68 | {subCategory = "Engine", title = 'Drive inertia', description = 'How responsive the engine revs will be to throttle control. It is measured in Higher values will result in faster RPM acceleration and deceleration, while lower values will result in more sluggish RPMs.', minValue = 0, maxValue = 3, step = 0.001, modal = 'fDriveInertia', fDriveInertia = 0},
69 | {subCategory = "Engine", title = 'Top Speed', description = 'Maximum engine top speed. Over this speed, the engine power will degrade greatly. Keep in mind that gearing will stretch over this length.', minValue = 0, maxValue = 200, step = 1, modal = 'fInitialDriveMaxFlatVel', fInitialDriveMaxFlatVel = 0},
70 |
71 | -- Transmission
72 | {subCategory = "Transmission", title = 'Nº of Gears', description = 'As gears modulate the fInitialDriveForce up until fInitialDriveMaxFlatVel, keepin a reasonably number of gears for your top speed is reccomended. Remember Transmission upgrades add one gear total.', minValue = 0, maxValue = 6, step = 1, modal = 'nInitialDriveGears', nInitialDriveGears = 0},
73 | {subCategory = "Transmission", title = 'Up Shift times', description = '', minValue = 0, maxValue = 10, step = 0.25, modal = 'fClutchChangeRateScaleUpShift', fClutchChangeRateScaleUpShift = 0},
74 | {subCategory = "Transmission", title = 'Down Shift times', description = '', minValue = 0, maxValue = 10, step = 0.25, modal = 'fClutchChangeRateScaleDownShift', fClutchChangeRateScaleDownShift = 0},
75 | {subCategory = "Transmission", title = 'Power Bias', description = '', minValue = 0, maxValue = 1, step = 0.05, modal = 'fDriveBiasFront', fDriveBiasFront = 0},
76 |
77 | -- Brakes
78 | {subCategory = "Brakes", title = 'Brake Strength', description = 'How many Gs of deceleration are applied to each wheel. fTractionCurveMax and fBrakeForce are closely related. Assuming perfect balance, a fourth of brake is enough to make each wheel lockup.', minValue = 0.1, maxValue = 1, step = 0.001, modal = 'fBrakeForce', fBrakeForce = 0},
79 | {subCategory = "Brakes", title = 'Brake Bias', description = 'Distribution of the brake strength between the axles. Usually, the best balance is between 0.55 and 0.7 for best braking capabilities, as it accounts for the weight transfer that ensues when braking.', minValue = 0, maxValue = 1, step = 0.025, modal = 'fBrakeBiasFront', fBrakeBiasFront = 0},
80 | {subCategory = "Brakes", title = 'Handbrake Strength', description = 'Similar to fBrakeForce, but is only applied to the rear axle(s).', minValue = 0, maxValue = 1, step = 0.05, modal = 'fHandBrakeForce', fHandBrakeForce = 0},
81 |
82 | -- Traction
83 | {subCategory = "Traction", title = 'Tire Grip Curve Max', description = 'In V, grip is represented as how much the vehicles tires are able to accelerate or decelerate the cars body, as a whole.', minValue = 0, maxValue = 3, step = 0.05, modal = 'fTractionCurveMax', fTractionCurveMax = 0},
84 | {subCategory = "Traction", title = 'Tire Grip Curve Min', description = 'Similar to fBrakeForce, but is only applied to the rear axle(s).', minValue = 0, maxValue = 3, step = 0.05, modal = 'fTractionCurveMin', fTractionCurveMin = 0},
85 | {subCategory = "Traction", title = 'Traction Curve', description = 'Slide angle at which the car will enjoy the best grip available. The vehicle will tend to stay below half of this value. It is reccomended to keep it at default 22.5 on most vehicles, though Sports and Supercars can have it as low as 18º if you so desire, making them stay more straight. Over 24º is not reccomended save for the slidiest cars, like old muscles.', minValue = 10, maxValue = 30, step = 0.5, modal = 'fTractionCurveLateral', fTractionCurveLateral = 0},
86 | {subCategory = "Traction", title = 'Tire Grip Bias', description = 'This value perfectly describes situations where the front and rear axles have different kinds of wheels, be it the compounds are different, or the tire width is different. Very useful for dragsters and high performance cars who come with changes like these.', minValue = 0, maxValue = 1, step = 0.005, modal = 'fTractionBiasFront', fTractionBiasFront = 0},
87 | {subCategory = "Traction", title = 'Offroad Traction Loss', description = 'How exaggerated the traction loss is for this vehicle. A value of 1.0 makes the car lose grip on each surface as expected by the game. Below 1.0 you lose less grip than normal, over 1.0 you lose more grip than normal.', minValue = 0, maxValue = 1.5, step = 0.001, modal = 'fTractionLossMult', fTractionLossMult = 0},
88 | {subCategory = "Traction", title = 'Low Speed Burnout Mult', description = 'How exaggerated the fake burnout griploss is for this vehicle.', minValue = 0, maxValue = 2, step = 0.05, modal = 'fLowSpeedTractionLossMult', fLowSpeedTractionLossMult = 0},
89 | {subCategory = "Traction", title = 'Max Steer Angle', description = 'Maximum steering angle for the vehicle.', minValue = 0, maxValue = 50, step = 0.05, modal = 'fSteeringLock', fSteeringLock = 0},
90 |
91 | -- Suspension
92 | {subCategory = "Suspension", title = 'Spring Strength', description = 'Spring strength.', minValue = 0, maxValue = 5, step = 0.001, modal = 'fSuspensionForce', fSuspensionForce = 0},
93 | {subCategory = "Suspension", title = 'Spring Comp Dampen Strength', description = '', minValue = 0, maxValue = 3, step = 0.05, modal = 'fSuspensionCompDamp', fSuspensionCompDamp = 0},
94 | {subCategory = "Suspension", title = 'Spring Rebound Dampen Strength', description = 'How strongly the spring strength is dampened when compressing or decompressing.', minValue = 0, maxValue = 3, step = 0.05, modal = 'fSuspensionReboundDamp', fSuspensionReboundDamp = 0},
95 | {subCategory = "Suspension", title = 'Compression/Decompression Upper Limits', description = '', minValue = 0, maxValue = 1, step = 0.005, modal = 'fSuspensionUpperLimit', fSuspensionUpperLimit = 0},
96 | {subCategory = "Suspension", title = 'Compression/Decompression Lower Limits', description = 'Compression upper and lower limits, in meters. Yeah, use centimeters.', minValue = -1, maxValue = 0, step = 0.005, modal = 'fSuspensionLowerLimit', fSuspensionLowerLimit = 0},
97 | {subCategory = "Suspension", title = 'Suspension Raise', description = 'In meters, this raises or lowers the natural stance of the vehicle.', minValue = -1, maxValue = 1, step = 0.05, modal = 'fSuspensionRaise', fSuspensionRaise = 0},
98 | {subCategory = "Suspension", title = 'Strength Bias', description = 'Spring strength distribution between the axles of the vehicle.', minValue = 0, maxValue = 1, step = 0.005, modal = 'fSuspensionBiasFront', fSuspensionBiasFront = 0},
99 |
100 | -- Anti-roll
101 | {subCategory = "Anti-roll", title = 'Antiroll Strength', description = 'How strongly the antiroll bars try to keep the vehicle from leaning.', minValue = 0, maxValue = 2, step = 0.001, modal = 'fAntiRollBarForce', fAntiRollBarForce = 0},
102 | {subCategory = "Anti-roll", title = 'Strength Bias', description = 'Distribution of the antiroll bar strength between the car axles.', minValue = 0, maxValue = 1, step = 0.05, modal = 'fAntiRollBarBiasFront', fAntiRollBarBiasFront = 0},
103 | {subCategory = "Anti-roll", title = 'Rollcentre - Front', description = 'Relative to the model bottom, defines where the pivot point is. This is used for leaning.', minValue = 0, maxValue = 1, step = 0.001, modal = 'fRollCentreHeightFront', fRollCentreHeightFront = 0},
104 | {subCategory = "Anti-roll", title = 'Rollcentre - Back', description = 'Relative to the model bottom, defines where the pivot point is. This is used for leaning.', minValue = 0, maxValue = 1, step = 0.05, modal = 'fRollCentreHeightRear', fRollCentreHeightRear = 0}
105 | }
106 | }
--------------------------------------------------------------------------------
/client/functions.lua:
--------------------------------------------------------------------------------
1 |
2 |
3 | LastEngineMultiplier = 1.0
4 | function setVehData(veh, data)
5 | if not DoesEntityExist(veh) or not data then return nil end
6 |
7 |
8 | local settings = {}
9 | if data.SimpleConfiguration then
10 | for _, config in ipairs(data.SimpleConfiguration) do
11 | settings[config.modal] = config[config.modal]
12 | end
13 | end
14 |
15 |
16 | if settings.fInitialDriveForce then
17 | SetVehicleHandlingFloat(veh, "CHandlingData", "fInitialDriveForce", tonumber(settings.fInitialDriveForce) + 0.0)
18 | end
19 |
20 | if settings.fDriveInertia then
21 | SetVehicleHandlingFloat(veh, "CHandlingData", "fDriveInertia", tonumber(settings.fDriveInertia) + 0.0)
22 | end
23 |
24 | if settings.fClutchChangeRateScaleUpShift then
25 | SetVehicleHandlingFloat(veh, "CHandlingData", "fClutchChangeRateScaleUpShift", tonumber(settings.fClutchChangeRateScaleUpShift) + 0.0)
26 | end
27 |
28 | if settings.fDriveBiasFront then
29 | SetVehicleHandlingFloat(veh, "CHandlingData", "fDriveBiasFront", tonumber(settings.fDriveBiasFront) + 0.0)
30 | end
31 |
32 | if settings.fBrakeBiasFront then
33 | SetVehicleHandlingFloat(veh, "CHandlingData", "fBrakeBiasFront", tonumber(settings.fBrakeBiasFront) + 0.0)
34 | end
35 | end
36 |
37 | function setAdvancedData(veh, data, bool, three)
38 | local newdata = {}
39 |
40 |
41 | if three then
42 | if data.vehicleData ~= nil then
43 | newdata = data.vehicleData
44 | else
45 | DefaultAdvancedData(veh, GetVehicleNumberPlateText(veh), data)
46 | return
47 | end
48 | else
49 | if bool then
50 | newdata = data.vehicleData.AdvancedConfigurationData
51 | else
52 | newdata = data.AdvancedConfigurationData
53 | end
54 | end
55 |
56 |
57 | if not DoesEntityExist(veh) or not newdata then return nil end
58 |
59 |
60 | local vehicleData = {}
61 |
62 | for _, v in ipairs(newdata) do
63 | vehicleData[v.modal] = v[v.modal] or v.value or v.fMass or v.fInitialDriveForce or v.fBrakeForce
64 | end
65 |
66 |
67 | TriggerServerEvent("ld-tunertablet:CreateTableData", GetVehicleNumberPlateText(veh), vehicleData, "CurrentVehicleData")
68 |
69 |
70 | SetVehicleHandlingFloat(veh, "CHandlingData", "fDownforceModifier", tonumber(vehicleData.fDownforceModifier) + 0.0)
71 | SetVehicleHandlingFloat(veh, "CHandlingData", "fInitialDragCoeff", tonumber(vehicleData.fInitialDragCoeff) + 0.0)
72 | SetVehicleHandlingFloat(veh, "CHandlingData", "fMass", tonumber(vehicleData.fMass) + 0.0)
73 | SetVehicleHandlingFloat(veh, "CHandlingData", "fInitialDriveForce", tonumber(vehicleData.fInitialDriveForce) + 0.0)
74 | SetVehicleHandlingFloat(veh, "CHandlingData", "fDriveInertia", tonumber(vehicleData.fDriveInertia) + 0.0)
75 | SetVehicleHandlingFloat(veh, "CHandlingData", "fInitialDriveMaxFlatVel", tonumber(vehicleData.fInitialDriveMaxFlatVel) + 0.0)
76 | SetVehicleHandlingInt(veh, "CHandlingData", "nInitialDriveGears", tonumber(vehicleData.nInitialDriveGears))
77 | SetVehicleHandlingFloat(veh, "CHandlingData", "fClutchChangeRateScaleUpShift", tonumber(vehicleData.fClutchChangeRateScaleUpShift) + 0.0)
78 | SetVehicleHandlingFloat(veh, "CHandlingData", "fClutchChangeRateScaleDownShift", tonumber(vehicleData.fClutchChangeRateScaleDownShift) + 0.0)
79 | SetVehicleHandlingFloat(veh, "CHandlingData", "fDriveBiasFront", tonumber(vehicleData.fDriveBiasFront) + 0.0)
80 | SetVehicleHandlingFloat(veh, "CHandlingData", "fBrakeForce", tonumber(vehicleData.fBrakeForce) + 0.0)
81 | SetVehicleHandlingFloat(veh, "CHandlingData", "fBrakeBiasFront", tonumber(vehicleData.fBrakeBiasFront) + 0.0)
82 | SetVehicleHandlingFloat(veh, "CHandlingData", "fHandBrakeForce", tonumber(vehicleData.fHandBrakeForce) + 0.0)
83 | SetVehicleHandlingFloat(veh, "CHandlingData", "fTractionCurveMax", tonumber(vehicleData.fTractionCurveMax) + 0.0)
84 | SetVehicleHandlingFloat(veh, "CHandlingData", "fTractionCurveMin", tonumber(vehicleData.fTractionCurveMin) + 0.0)
85 | SetVehicleHandlingFloat(veh, "CHandlingData", "fTractionCurveLateral", tonumber(vehicleData.fTractionCurveLateral) + 0.0)
86 | SetVehicleHandlingFloat(veh, "CHandlingData", "fTractionBiasFront", tonumber(vehicleData.fTractionBiasFront) + 0.0)
87 | SetVehicleHandlingFloat(veh, "CHandlingData", "fTractionLossMult", tonumber(vehicleData.fTractionLossMult) + 0.0)
88 | SetVehicleHandlingFloat(veh, "CHandlingData", "fLowSpeedTractionLossMult", tonumber(vehicleData.fLowSpeedTractionLossMult) + 0.0)
89 | SetVehicleHandlingFloat(veh, "CHandlingData", "fSteeringLock", tonumber(vehicleData.fSteeringLock) + 0.0)
90 | SetVehicleHandlingFloat(veh, "CHandlingData", "fSuspensionForce", tonumber(vehicleData.fSuspensionForce))
91 | SetVehicleHandlingFloat(veh, "CHandlingData", "fSuspensionCompDamp", tonumber(vehicleData.fSuspensionCompDamp) + 0.0)
92 | SetVehicleHandlingFloat(veh, "CHandlingData", "fSuspensionReboundDamp", tonumber(vehicleData.fSuspensionReboundDamp) + 0.0)
93 | SetVehicleHandlingFloat(veh, "CHandlingData", "fSuspensionUpperLimit", tonumber(vehicleData.fSuspensionUpperLimit) + 0.0)
94 | SetVehicleHandlingFloat(veh, "CHandlingData", "fSuspensionLowerLimit", tonumber(vehicleData.fSuspensionLowerLimit) + 0.0)
95 | SetVehicleHandlingFloat(veh, "CHandlingData", "fSuspensionRaise", tonumber(vehicleData.fSuspensionRaise) + 0.0)
96 | SetVehicleHandlingFloat(veh, "CHandlingData", "fSuspensionBiasFront", tonumber(vehicleData.fSuspensionBiasFront) + 0.0)
97 | SetVehicleHandlingFloat(veh, "CHandlingData", "fAntiRollBarForce", tonumber(vehicleData.fAntiRollBarForce) + 0.0)
98 | SetVehicleHandlingFloat(veh, "CHandlingData", "fAntiRollBarBiasFront", tonumber(vehicleData.fAntiRollBarBiasFront) + 0.0)
99 | SetVehicleHandlingFloat(veh, "CHandlingData", "fRollCentreHeightFront", tonumber(vehicleData.fRollCentreHeightFront) + 0.0)
100 | SetVehicleHandlingFloat(veh, "CHandlingData", "fRollCentreHeightRear", tonumber(vehicleData.fRollCentreHeightRear) + 0.0)
101 | end
102 |
103 |
104 |
105 | function DefaultAdvancedData(veh,plate, GelenData)
106 | if GelenData ~= nil then
107 | data = GelenData
108 | if data ~= nil then
109 | local tonum = tonumber(data.nInitialDriveGears)
110 | if not DoesEntityExist(veh) or not data then return nil end
111 | SetVehicleHandlingFloat(veh, "CHandlingData", "fDownforceModifier", tonumber(data.fDownforceModifier) + 0.0 )
112 | SetVehicleHandlingFloat(veh, "CHandlingData", "fInitialDragCoeff", tonumber(data.fInitialDragCoeff) + 0.0 )
113 | -- CHASIS
114 | SetVehicleHandlingFloat(veh, "CHandlingData", "fMass", tonumber(data.fMass) + 0.0 )
115 | -- ENGINE
116 | SetVehicleHandlingFloat(veh, "CHandlingData", "fInitialDriveForce", tonumber(data.fInitialDriveForce) + 0.0 )
117 | SetVehicleHandlingFloat(veh, "CHandlingData", "fDriveInertia", tonumber(data.fDriveInertia) + 0.0 )
118 | SetVehicleHandlingFloat(veh, "CHandlingData", "fInitialDriveMaxFlatVel", tonumber(data.fInitialDriveMaxFlatVel) + 0.0 )
119 | -- TRANSMISSION
120 | SetVehicleHandlingInt(veh, "CHandlingData", "nInitialDriveGears", math.floor(tonum)) -- İnteger
121 | SetVehicleHandlingFloat(veh, "CHandlingData", "fClutchChangeRateScaleUpShift", tonumber(data.fClutchChangeRateScaleUpShift) + 0.0 )
122 | SetVehicleHandlingFloat(veh, "CHandlingData", "fClutchChangeRateScaleDownShift", tonumber(data.fClutchChangeRateScaleDownShift) + 0.0 )
123 | SetVehicleHandlingFloat(veh, "CHandlingData", "fDriveBiasFront", tonumber(data.fDriveBiasFront))
124 | -- BRAKE
125 | SetVehicleHandlingFloat(veh, "CHandlingData", "fBrakeForce", tonumber(data.fBrakeForce) + 0.0 )
126 | SetVehicleHandlingFloat(veh, "CHandlingData", "fBrakeBiasFront", tonumber(data.fBrakeBiasFront) + 0.0 )
127 | SetVehicleHandlingFloat(veh, "CHandlingData", "fHandBrakeForce", tonumber(data.fHandBrakeForce) + 0.0 )
128 | -- TRACTION
129 | SetVehicleHandlingFloat(veh, "CHandlingData", "fTractionCurveMax", tonumber(data.fTractionCurveMax) + 0.0 )
130 | SetVehicleHandlingFloat(veh, "CHandlingData", "fTractionCurveMin", tonumber(data.fTractionCurveMin) + 0.0 )
131 | SetVehicleHandlingFloat(veh, "CHandlingData", "fTractionCurveLateral", tonumber(data.fTractionCurveLateral) + 0.0 )
132 | SetVehicleHandlingFloat(veh, "CHandlingData", "fTractionBiasFront", tonumber(data.fTractionBiasFront) + 0.0 )
133 | SetVehicleHandlingFloat(veh, "CHandlingData", "fTractionLossMult", tonumber(data.fTractionLossMult) + 0.0 )
134 | SetVehicleHandlingFloat(veh, "CHandlingData", "fLowSpeedTractionLossMult", tonumber(data.fLowSpeedTractionLossMult) + 0.0 )
135 | SetVehicleHandlingFloat(veh, "CHandlingData", "fSteeringLock", tonumber(data.fSteeringLock) + 0.0 )
136 | -- SUSPENSION
137 | SetVehicleHandlingFloat(veh, "CHandlingData", "fSuspensionForce", tonumber(data.fSuspensionForce))
138 | SetVehicleHandlingFloat(veh, "CHandlingData", "fSuspensionCompDamp", tonumber(data.fSuspensionCompDamp) + 0.0 )
139 | SetVehicleHandlingFloat(veh, "CHandlingData", "fSuspensionReboundDamp", tonumber(data.fSuspensionReboundDamp) + 0.0 )
140 | SetVehicleHandlingFloat(veh, "CHandlingData", "fSuspensionUpperLimit", tonumber(data.fSuspensionUpperLimit) + 0.0 )
141 | SetVehicleHandlingFloat(veh, "CHandlingData", "fSuspensionLowerLimit", tonumber(data.fSuspensionLowerLimit) + 0.0 )
142 | SetVehicleHandlingFloat(veh, "CHandlingData", "fSuspensionRaise", tonumber(data.fSuspensionRaise) + 0.0 )
143 | SetVehicleHandlingFloat(veh, "CHandlingData", "fSuspensionBiasFront", tonumber(data.fSuspensionBiasFront) + 0.0 )
144 | -- ANTIROLL
145 | SetVehicleHandlingFloat(veh, "CHandlingData", "fAntiRollBarForce", tonumber(data.fAntiRollBarForce) + 0.0 )
146 | SetVehicleHandlingFloat(veh, "CHandlingData", "fAntiRollBarBiasFront", tonumber(data.fAntiRollBarBiasFront) + 0.0 )
147 | SetVehicleHandlingFloat(veh, "CHandlingData", "fRollCentreHeightFront", tonumber(data.fRollCentreHeightFront) + 0.0 )
148 | SetVehicleHandlingFloat(veh, "CHandlingData", "fRollCentreHeightRear", tonumber(data.fRollCentreHeightRear) + 0.0 )
149 | TriggerServerEvent("ld-tunertablet:CreateTableData", plate, data, "CurrentVehicleData")
150 | end
151 | else
152 | lib.callback('ld-tunertablet:sqlDta', false, function(data)
153 |
154 | if data ~= nil then
155 | local tonum = tonumber(data.nInitialDriveGears)
156 | if not DoesEntityExist(veh) or not data then return nil end
157 | SetVehicleHandlingFloat(veh, "CHandlingData", "fDownforceModifier", tonumber(data.fDownforceModifier) + 0.0 )
158 | SetVehicleHandlingFloat(veh, "CHandlingData", "fInitialDragCoeff", tonumber(data.fInitialDragCoeff) + 0.0 )
159 | -- CHASIS
160 | SetVehicleHandlingFloat(veh, "CHandlingData", "fMass", tonumber(data.fMass) + 0.0 )
161 | -- ENGINE
162 | SetVehicleHandlingFloat(veh, "CHandlingData", "fInitialDriveForce", tonumber(data.fInitialDriveForce) + 0.0 )
163 | SetVehicleHandlingFloat(veh, "CHandlingData", "fDriveInertia", tonumber(data.fDriveInertia) + 0.0 )
164 | SetVehicleHandlingFloat(veh, "CHandlingData", "fInitialDriveMaxFlatVel", tonumber(data.fInitialDriveMaxFlatVel) + 0.0 )
165 | -- TRANSMISSION
166 | SetVehicleHandlingInt(veh, "CHandlingData", "nInitialDriveGears", math.floor(tonum)) -- İnteger
167 | SetVehicleHandlingFloat(veh, "CHandlingData", "fClutchChangeRateScaleUpShift", tonumber(data.fClutchChangeRateScaleUpShift) + 0.0 )
168 | SetVehicleHandlingFloat(veh, "CHandlingData", "fClutchChangeRateScaleDownShift", tonumber(data.fClutchChangeRateScaleDownShift) + 0.0 )
169 | SetVehicleHandlingFloat(veh, "CHandlingData", "fDriveBiasFront", tonumber(data.fDriveBiasFront))
170 | -- BRAKE
171 | SetVehicleHandlingFloat(veh, "CHandlingData", "fBrakeForce", tonumber(data.fBrakeForce) + 0.0 )
172 | SetVehicleHandlingFloat(veh, "CHandlingData", "fBrakeBiasFront", tonumber(data.fBrakeBiasFront) + 0.0 )
173 | SetVehicleHandlingFloat(veh, "CHandlingData", "fHandBrakeForce", tonumber(data.fHandBrakeForce) + 0.0 )
174 | -- TRACTION
175 | SetVehicleHandlingFloat(veh, "CHandlingData", "fTractionCurveMax", tonumber(data.fTractionCurveMax) + 0.0 )
176 | SetVehicleHandlingFloat(veh, "CHandlingData", "fTractionCurveMin", tonumber(data.fTractionCurveMin) + 0.0 )
177 | SetVehicleHandlingFloat(veh, "CHandlingData", "fTractionCurveLateral", tonumber(data.fTractionCurveLateral) + 0.0 )
178 | SetVehicleHandlingFloat(veh, "CHandlingData", "fTractionBiasFront", tonumber(data.fTractionBiasFront) + 0.0 )
179 | SetVehicleHandlingFloat(veh, "CHandlingData", "fTractionLossMult", tonumber(data.fTractionLossMult) + 0.0 )
180 | SetVehicleHandlingFloat(veh, "CHandlingData", "fLowSpeedTractionLossMult", tonumber(data.fLowSpeedTractionLossMult) + 0.0 )
181 | SetVehicleHandlingFloat(veh, "CHandlingData", "fSteeringLock", tonumber(data.fSteeringLock) + 0.0 )
182 | -- SUSPENSION
183 | SetVehicleHandlingFloat(veh, "CHandlingData", "fSuspensionForce", tonumber(data.fSuspensionForce))
184 | SetVehicleHandlingFloat(veh, "CHandlingData", "fSuspensionCompDamp", tonumber(data.fSuspensionCompDamp) + 0.0 )
185 | SetVehicleHandlingFloat(veh, "CHandlingData", "fSuspensionReboundDamp", tonumber(data.fSuspensionReboundDamp) + 0.0 )
186 | SetVehicleHandlingFloat(veh, "CHandlingData", "fSuspensionUpperLimit", tonumber(data.fSuspensionUpperLimit) + 0.0 )
187 | SetVehicleHandlingFloat(veh, "CHandlingData", "fSuspensionLowerLimit", tonumber(data.fSuspensionLowerLimit) + 0.0 )
188 | SetVehicleHandlingFloat(veh, "CHandlingData", "fSuspensionRaise", tonumber(data.fSuspensionRaise) + 0.0 )
189 | SetVehicleHandlingFloat(veh, "CHandlingData", "fSuspensionBiasFront", tonumber(data.fSuspensionBiasFront) + 0.0 )
190 | -- ANTIROLL
191 | SetVehicleHandlingFloat(veh, "CHandlingData", "fAntiRollBarForce", tonumber(data.fAntiRollBarForce) + 0.0 )
192 | SetVehicleHandlingFloat(veh, "CHandlingData", "fAntiRollBarBiasFront", tonumber(data.fAntiRollBarBiasFront) + 0.0 )
193 | SetVehicleHandlingFloat(veh, "CHandlingData", "fRollCentreHeightFront", tonumber(data.fRollCentreHeightFront) + 0.0 )
194 | SetVehicleHandlingFloat(veh, "CHandlingData", "fRollCentreHeightRear", tonumber(data.fRollCentreHeightRear) + 0.0 )
195 | TriggerServerEvent("ld-tunertablet:CreateTableData", plate, data, "CurrentVehicleData")
196 | end
197 | end, plate, "DefaultData")
198 | end
199 |
200 | end
201 |
202 |
203 | local VehicleDefaultData = {}
204 |
205 | function GetVehData(veh)
206 | VehicleDefaultData = {}
207 | VehicleDefaultData.fDownforceModifier = GetVehicleHandlingFloat(veh, "CHandlingData", "fDownforceModifier")
208 | VehicleDefaultData.fInitialDragCoeff = GetVehicleHandlingFloat(veh, "CHandlingData", "fInitialDragCoeff")
209 | -- CHASIS
210 | VehicleDefaultData.fMass = GetVehicleHandlingFloat(veh, "CHandlingData", "fMass")
211 | VehicleDefaultData.vecCentreOfMassOffset = GetVehicleHandlingVector(veh, "CHandlingData", "vecCentreOfMassOffset") -- Vector
212 | VehicleDefaultData.vecInertiaMultiplier = GetVehicleHandlingVector(veh, "CHandlingData", "vecInertiaMultiplier") -- Vector
213 | -- ENGINE
214 | VehicleDefaultData.fInitialDriveForce = GetVehicleHandlingFloat(veh, "CHandlingData", "fInitialDriveForce")
215 | VehicleDefaultData.fDriveInertia = GetVehicleHandlingFloat(veh, "CHandlingData", "fDriveInertia")
216 | VehicleDefaultData.fInitialDriveMaxFlatVel = GetVehicleHandlingFloat(veh, "CHandlingData", "fInitialDriveMaxFlatVel")
217 | -- TRANSMISSION
218 | VehicleDefaultData.nInitialDriveGears = GetVehicleHandlingInt(veh, "CHandlingData", "nInitialDriveGears") -- İnteger
219 | VehicleDefaultData.fClutchChangeRateScaleUpShift = GetVehicleHandlingFloat(veh, "CHandlingData", "fClutchChangeRateScaleUpShift")
220 | VehicleDefaultData.fClutchChangeRateScaleDownShift = GetVehicleHandlingFloat(veh, "CHandlingData", "fClutchChangeRateScaleDownShift")
221 | VehicleDefaultData.fDriveBiasFront = GetVehicleHandlingFloat(veh, "CHandlingData", "fDriveBiasFront")
222 | -- BRAKE
223 | VehicleDefaultData.fBrakeForce = GetVehicleHandlingFloat(veh, "CHandlingData", "fBrakeForce")
224 | VehicleDefaultData.fBrakeBiasFront = GetVehicleHandlingFloat(veh, "CHandlingData", "fBrakeBiasFront")
225 | VehicleDefaultData.fHandBrakeForce = GetVehicleHandlingFloat(veh, "CHandlingData", "fHandBrakeForce")
226 | -- TRACTION
227 | VehicleDefaultData.fTractionCurveMax = GetVehicleHandlingFloat(veh, "CHandlingData", "fTractionCurveMax")
228 | VehicleDefaultData.fTractionCurveMin = GetVehicleHandlingFloat(veh, "CHandlingData", "fTractionCurveMin")
229 | VehicleDefaultData.fTractionCurveLateral = GetVehicleHandlingFloat(veh, "CHandlingData", "fTractionCurveLateral")
230 | VehicleDefaultData.fTractionBiasFront= GetVehicleHandlingFloat(veh, "CHandlingData", "fTractionBiasFront")
231 | VehicleDefaultData.fTractionLossMult = GetVehicleHandlingFloat(veh, "CHandlingData", "fTractionLossMult")
232 | VehicleDefaultData.fLowSpeedTractionLossMult = GetVehicleHandlingFloat(veh, "CHandlingData", "fLowSpeedTractionLossMult")
233 | VehicleDefaultData.fSteeringLock = GetVehicleHandlingFloat(veh, "CHandlingData", "fSteeringLock")
234 | -- SUSPENSION
235 | VehicleDefaultData.fSuspensionForce = GetVehicleHandlingFloat(veh, "CHandlingData", "fSuspensionForce")
236 | VehicleDefaultData.fSuspensionCompDamp = GetVehicleHandlingFloat(veh, "CHandlingData", "fSuspensionCompDamp")
237 | VehicleDefaultData.fSuspensionReboundDamp = GetVehicleHandlingFloat(veh, "CHandlingData", "fSuspensionReboundDamp")
238 | VehicleDefaultData.fSuspensionUpperLimit = GetVehicleHandlingFloat(veh, "CHandlingData", "fSuspensionUpperLimit")
239 | VehicleDefaultData.fSuspensionLowerLimit = GetVehicleHandlingFloat(veh, "CHandlingData", "fSuspensionLowerLimit")
240 | VehicleDefaultData.fSuspensionRaise = GetVehicleHandlingFloat(veh, "CHandlingData", "fSuspensionRaise")
241 | VehicleDefaultData.fSuspensionBiasFront = GetVehicleHandlingFloat(veh, "CHandlingData", "fSuspensionBiasFront")
242 | -- ANTIROLL
243 | VehicleDefaultData.fAntiRollBarForce = GetVehicleHandlingFloat(veh, "CHandlingData", "fAntiRollBarForce")
244 | VehicleDefaultData.fAntiRollBarBiasFront = GetVehicleHandlingFloat(veh, "CHandlingData", "fAntiRollBarBiasFront")
245 | VehicleDefaultData.fRollCentreHeightFront = GetVehicleHandlingFloat(veh, "CHandlingData", "fRollCentreHeightFront")
246 | VehicleDefaultData.fRollCentreHeightRear = GetVehicleHandlingFloat(veh, "CHandlingData", "fRollCentreHeightRear")
247 | return VehicleDefaultData
248 | end
249 |
--------------------------------------------------------------------------------
/html/src/scripts/main.js:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | const store = Vuex.createStore({
6 | state: {},
7 | mutations: {},
8 | actions: {}
9 | });
10 |
11 | const app = Vue.createApp({
12 | data: () => ({
13 | showUI: false,
14 | extrasUI: false,
15 | policeUI: false,
16 | recorderUI: false,
17 | presetInput: false,
18 | currentPage: "Home",
19 | currentPageDescription: "",
20 | currentSubPage: "Aero",
21 | currentSubPageDescription: "Fine-tune advanced settings like engine performance and suspension for optimal results.",
22 | currentVehicleName: "Annis Elegy",
23 | currentVehiclePlate: "CKN117X",
24 | currentVehicleAcceleration: 40,
25 | currentVehicleTopSpeed: 50,
26 | currentVehicleTraction: 20,
27 | currentVehicleBraking: 80,
28 | currentVehicleFuelLevel: 20,
29 | currentVehicleHealth: 20,
30 | currentVehicleOilLevel: 20,
31 | currentVehicleEngineTemp: 20,
32 | confirmChanges: false,
33 | currentTime: "12:00",
34 | showSubPages: false,
35 | XMLData: "",
36 | Pages: [
37 | // { title: 'Home', description: 'Start screen with quick access to your tunerchip settings. You can start tuning your vehicle here.' },
38 | // { title: 'Presets', description: 'Load or create new presets for your vehicle. Customize and save configurations for quick access.' },
39 | // { title: 'Simple Configuration', description: 'Easily configure basic settings for your vehicle. A user-friendly and quick editing interface.' },
40 | // { title: 'Advanced Configuration', description: 'Fine-tune advanced settings like engine performance and suspension for optimal results.' },
41 | // { title: 'Test Tool', description: 'One-to-one to measure your vehicles performance' },
42 | // { title: 'XML', description: 'Export or import your vehicle settings as XML files for easy sharing or backup purposes.' }
43 | ],
44 | subPages: [
45 | // { title: 'Aero', description: 'This set of values represent the vehicle body shape, and mostly affect top speed behavior.' },
46 | // { title: 'Chassis', description: 'This set of values represent the vehicle body itself, and will play a big role on how the vehicle behaves overall.' },
47 | // { title: 'Engine', description: 'The moving force of your vehicle, this set of values govern details about how different bits of the engine will behave. Works in close relationswhip with Transmission.' },
48 | // { title: 'Transmission', description: 'Together with the Engine, the transmission settings define the power output of your vehicle.' },
49 | // { title: 'Brakes', description: 'Brakes are one of the main defining factors of the performance of your vehicle. This value should complement both the vehicles power and traction, so as to keep a coherent balance. Unless you have reasons for it not to.' },
50 | // { title: 'Traction', description: 'Traction is the main limiter of power and braking ability, and has to be able to handle both; otherwise your vehicle may suffer wheelspin/wheel lock. However, these can also be treated as features and not defects, being part of the vehicles personality.' },
51 | // { title: 'Suspension', description: 'Stiffer, softer, loose, tight. This section governs how your car floats above its wheels.' },
52 | // { title: 'Anti-roll', description: 'The main goal of the Anti-roll Bars is to prevent the car from leaning too much when taking a corner. Do keep in mind that the wheels the cars leans into, receive more grip from the pressure, while the wheels on the other side lose traction.' },
53 | ],
54 | readyPresets: [
55 | // { title: 'Drift Mode', description: 'In Drift mode, you can drift by pressing the support button you set.' },
56 | // { title: 'Eco Mode', description: 'Eco Mode has your cars standard settings and you can select this mode if you want to return it back.' },
57 | // { title: 'Sport Mode', description: 'Sport Mode sophisticatedly indexes your vehicle to the ideal speed mode' },
58 | ],
59 | Presets: [
60 |
61 | ],
62 | SimpleConfiguration: [
63 | // {title: 'Boost', description: 'Also called engine power, it dictates the target acceleration the engine is aiming for, measured in G-Forces. Wheel grip may not be able to cope with it, however.', minValue: 0, maxValue: 0.5, step: 0.005, modal: 'fInitialDriveForce', fInitialDriveForce: 0},
64 | // {title: 'Acceleration', description: 'How responsive the engine revs will be to throttle control. It is measured in Higher values will result in faster RPM acceleration and deceleration, while lower values will result in more sluggish RPMs.', minValue: 0, maxValue: 3, step: 0.001 , modal: 'fDriveInertia', fDriveInertia: 0},
65 | // {title: 'Gear Change', description: 'The vehicle will take 0.5s to shift from gear to gear.', minValue: 0, maxValue: 10, step: 0.25 , modal: 'fClutchChangeRateScaleUpShift', fClutchChangeRateScaleUpShift: 0},
66 | // {title: 'Breaking', description: 'Usually, the best balance is between 0.55 and 0.7 for best braking capabilities, as it accounts for the weight transfer that ensues when braking. (60% Front - 40% Rear)', minValue: 0, maxValue: 1, step: 0.025 , modal: 'fBrakeBiasFront', fBrakeBiasFront: 0},
67 | // {title: 'Drivetrain', description: 'Defines how the power from fInitialDriveForce is distributed between the axles. 0.0 implies a fully RWD setup, with will only deliver power to the rear wheels.', minValue: 0, maxValue: 1, step: 0.05 , modal: 'fDriveBiasFront', fDriveBiasFront: 0},
68 | ],
69 |
70 | AdvancedConfiguration: [
71 | // Aero
72 | // {subCategory: "Aero", title: 'Downforce', description: 'Downforce is a way to gain grip at speed, and can be increased by Spoilers. This car will generate 0.14Gs of additional grip at 60mph.', minValue: 0, maxValue: 5, step: 0.05, modal: 'fDownforceModifier', fDownforceModifier: 0},
73 | // {subCategory: "Aero", title: 'Air Resistance', description: 'Higher resistance means an eariler perceived loss of power at higher speed, resulting in a lower top speed, as the engine cannot overpower this force. Lower air resistance allows the vehicle to travel faster on the same power.', minValue: 0, maxValue: 20, step: 0.5, modal: 'fInitialDragCoeff', fInitialDragCoeff: 0},
74 | // // Chassis
75 | // {subCategory: "Chassis", title: 'Mass', description: 'Measured in Kg, mass is only responsible for the interaction between entities. Lets say its the vehicles pushing force.', minValue: 0, maxValue: 15000, step: 1, modal: 'fMass', fMass: 0},
76 | // {subCategory: "Chassis", title: 'Center of Mass', description: 'This editor is not able to edit the Center Of Mass offsets yet.', minValue: -2, maxValue: 2, step: 1, modal: 'vecCentreOfMassOffset', vecCentreOfMassOffset: 0},
77 | // {subCategory: "Chassis", title: 'Rotational Inertia', description: 'This editor is not able to edit the Rotational Inertia offsets yet.', minValue: -2, maxValue: 2, step: 1, modal: 'vecInertiaMultiplier', vecInertiaMultiplier: 0},
78 | // // Engine
79 | // {subCategory: "Engine", title: 'Engine/Acceleration', description: 'Also called engine power, it dictates the target acceleration the engine is aiming for, measured in G-Forces. Wheel grip may not be able to cope with it, however.', minValue: 0, maxValue: 0.5, step: 0.005, modal: 'fInitialDriveForce', fInitialDriveForce: 0},
80 | // {subCategory: "Engine", title: 'Drive inertia', description: 'How responsive the engine revs will be to throttle control. It is measured in Higher values will result in faster RPM acceleration and deceleration, while lower values will result in more sluggish RPMs.', minValue: 0, maxValue: 3, step: 0.001, modal: 'fDriveInertia', fDriveInertia: 0},
81 | // {subCategory: "Engine", title: 'Top Speed', description: 'Maximum engine top speed. Over this speed, the engine power will degrade greatly. Keep in mind that gearing will stretch over this length.', minValue: 0, maxValue: 200, step: 1, modal: 'fInitialDriveMaxFlatVel', fInitialDriveMaxFlatVel: 0},
82 | // // Transmission
83 | // {subCategory: "Transmission", title: 'Nº of Gears', description: 'As gears modulate the fInitialDriveForce up until fInitialDriveMaxFlatVel, keepin a reasonably number of gears for your top speed is reccomended. Remember Transmission upgrades add one gear total.', minValue: 0, maxValue: 6, step: 1, modal: 'nInitialDriveGears', nInitialDriveGears: 0},
84 | // {subCategory: "Transmission", title: 'Up Shift times', description: '', minValue: 0, maxValue: 10, step: 0.25, modal: 'fClutchChangeRateScaleUpShift', fClutchChangeRateScaleUpShift: 0},
85 | // {subCategory: "Transmission", title: 'Down Shift times', description: '', minValue: 0, maxValue: 10, step: 0.25, modal: 'fClutchChangeRateScaleDownShift', fClutchChangeRateScaleDownShift: 0},
86 | // {subCategory: "Transmission", title: 'Power Bias', description: '', minValue: 0, maxValue: 1, step: 0.05, modal: 'fDriveBiasFront', fDriveBiasFront: 0},
87 |
88 | // // Brakes
89 | // {subCategory: "Brakes", title: 'Brake Strength', description: 'How many Gs of deceleration are applied to each wheel. fTractionCurveMax and fBrakeForce are closely related. Assuming perfect balance, a fourth of brake is enough to make each wheel lockup.', minValue: 0.1, maxValue: 1, step: 0.001, modal: 'fBrakeForce', fBrakeForce: 0},
90 | // {subCategory: "Brakes", title: 'Brake Bias', description: 'Distribution of the brake strength between the axles. Usually, the best balance is between 0.55 and 0.7 for best braking capabilities, as it accounts for the weight transfer that ensues when braking.', minValue: 0, maxValue: 1, step: 0.025, modal: 'fBrakeBiasFront', fBrakeBiasFront: 0},
91 | // {subCategory: "Brakes", title: 'Handbrake Strength', description: 'Similar to fBrakeForce, but is only applied to the rear axle(s).', minValue: 0, maxValue: 1, step: 0.05, modal: 'fHandBrakeForce', fHandBrakeForce: 0},
92 | // // Traction
93 | // {subCategory: "Traction", title: 'Tire Grip Curve Max', description: 'In V, grip is represented as how much the vehicles tires are able to accelerate or decelerate the cars body, as a whole.', minValue: 0, maxValue: 3, step: 0.05, modal: 'fTractionCurveMax', fTractionCurveMax: 0},
94 | // {subCategory: "Traction", title: 'Tire Grip Curve Min', description: 'Similar to fBrakeForce, but is only applied to the rear axle(s).', minValue: 0, maxValue: 3, step: 0.05, modal: 'fTractionCurveMin', fTractionCurveMin: 0},
95 | // {subCategory: "Traction", title: 'Traction Curve', description: 'Slide angle at which the car will enjoy the best grip available. The vehicle will tend to stay below half of this value. It is reccomended to keep it at default 22.5 on most vehicles, though Sports and Supercars can have it as low as 18º if you so desire, making them stay more straight. Over 24º is not reccomended save for the slidiest cars, like old muscles.', minValue: 10, maxValue: 30, step: 0.5, modal: 'fTractionCurveLateral', fTractionCurveLateral: 0},
96 | // {subCategory: "Traction", title: 'Tire Grip Bias', description: 'This value perfectly describes situations where the front and rear axles have different kinds of wheels, be it the compounds are different, or the tire width is different. Very useful for dragsters and high performance cars who come with changes like these.', minValue: 0, maxValue: 1, step: 0.005, modal: 'fTractionBiasFront', fTractionBiasFront: 0},
97 | // {subCategory: "Traction", title: 'Offroad Traction Loss', description: 'How exaggerated the traction loss is for this vehicle. A value of 1.0 makes the car lose grip on each surface as expected by the game. Below 1.0 you lose less grip than normal, over 1.0 you lose more grip than normal.', minValue: 0, maxValue: 1.5, step: 0.001, modal: 'fTractionLossMult', fTractionLossMult: 0},
98 | // {subCategory: "Traction", title: 'Low Speed Burnout Mult', description: 'How exaggerated the fake burnout griploss is for this vehicle.', minValue: 0, maxValue: 2, step: 0.05, modal: 'fLowSpeedTractionLossMult', fLowSpeedTractionLossMult: 0},
99 | // {subCategory: "Traction", title: 'Max Steer Angle', description: 'Maximum steering angle for the vehicle.', minValue: 0, maxValue: 50, step: 0.05, modal: 'fSteeringLock', fSteeringLock: 0},
100 | // // Suspension
101 | // {subCategory: "Suspension", title: 'Spring Strength', description: 'Spring strength.', minValue: 0, maxValue: 5, step: 0.001, modal: 'fSuspensionForce', fSuspensionForce: 0},
102 | // {subCategory: "Suspension", title: 'Spring Comp Dampen Strength', description: '', minValue: 0, maxValue: 3, step: 0.05, modal: 'fSuspensionCompDamp', fSuspensionCompDamp: 0},
103 | // {subCategory: "Suspension", title: 'Spring Rebound Dampen Strength', description: 'How strongly the spring strength is dampened when compressing or decompressing.', minValue: 0, maxValue: 3, step: 0.05, modal: 'fSuspensionReboundDamp', fSuspensionReboundDamp: 0},
104 | // {subCategory: "Suspension", title: 'Compression/Decompression Upper Limits', description: '', minValue: 0, maxValue: 1, step: 0.005, modal: 'fSuspensionUpperLimit', fSuspensionUpperLimit: 0},
105 | // {subCategory: "Suspension", title: 'Compression/Decompression Lower Limits', description: 'Compression upper and lower limits, in meters. Yeah, use centimeters.', minValue: -1, maxValue: 0, step: 0.005, modal: 'fSuspensionLowerLimit', fSuspensionLowerLimit: 0},
106 | // {subCategory: "Suspension", title: 'Suspension Raise', description: 'In meters, this raises or lowers the natural stance of the vehicle.', minValue: -1, maxValue: 1, step: 0.05, modal: 'fSuspensionRaise', fSuspensionRaise: 0},
107 | // {subCategory: "Suspension", title: 'Strength Bias', description: 'Spring strength distribution between the axles of the vehicle.', minValue: 0, maxValue: 1, step: 0.005, modal: 'fSuspensionBiasFront', fSuspensionBiasFront: 0},
108 | // // Anti-roll
109 | // {subCategory: "Anti-roll", title: 'Antiroll Strength', description: 'How strongly the antiroll bars try to keep the vehicle from leaning.', minValue: 0, maxValue: 2, step: 0.001, modal: 'fAntiRollBarForce', fAntiRollBarForce: 0},
110 | // {subCategory: "Anti-roll", title: 'Strength Bias', description: 'Distribution of the antiroll bar strength between the car axles.', minValue: 0, maxValue: 1, step: 0.05, modal: 'fAntiRollBarBiasFront', fAntiRollBarBiasFront: 0},
111 | // {subCategory: "Anti-roll", title: 'Rollcentre - Front', description: 'Relative to the model bottom, defines where the pivot point is. This is used for leaning.', minValue: 0, maxValue: 1, step: 0.001, modal: 'fRollCentreHeightFront', fRollCentreHeightFront: 0},
112 | // {subCategory: "Anti-roll", title: 'Rollcentre - Back', description: 'Relative to the model bottom, defines where the pivot point is. This is used for leaning.', minValue: 0, maxValue: 1, step: 0.05, modal: 'fRollCentreHeightRear', fRollCentreHeightRear: 0},
113 | ],
114 | Content: ``,
115 | Locales: {
116 | // welcome: "Welcome",
117 | // ucreatedpresets: "Your Created Presets",
118 | // vehiclestats: "Vehicle Stats",
119 | // acceleration: "Acceleration",
120 | // speed: "Speed",
121 | // handling: "Traction",
122 | // braking: "Braking",
123 | // oiltemp: "Fuel Level",
124 | // dashtemp: "Engine Health",
125 | // watertemp: "Oil Level",
126 | // enginetemp: "Engine Temp",
127 | // confirmtext: "You are responsible for any modifications to your vehicle, please do not do this if you are not sure.",
128 | // metrics: "Metrics",
129 | // metricsdescription: "This editor makes an effort of translating some handling items to real world measurements, depicted in red on them. For transparency and ease of fact-checking, this section documents and details the math used to get the Ingame metrics.",
130 | // ucreatedpresetsdesc: "You can easily access or delete the settings you have edited and saved from the specially developed configuration page."
131 | },
132 | currentData: [],
133 | customsPageData: [],
134 | presetName: "",
135 | reachHundred: 0,
136 | reachQuarterMile: 0,
137 | reachSixty: 0,
138 | reachHalfMile: 0,
139 | counter: 0,
140 | timer: null,
141 | }),
142 |
143 | methods: {
144 | resetSettings() {
145 | postNUI("DEFAULT_BACK")
146 | setTimeout(() => {
147 | this.tuningTablet = true
148 | postNUI('GET_ADVANCED_DATA',{})
149 | }, 300);
150 | },
151 | applySettingsSimple() {
152 | postNUI('SAVE_SIMPLE_SETTINGS',{
153 | SimpleConfiguration : this.SimpleConfiguration,
154 | }
155 | )
156 |
157 | },
158 | applySettingsAdvanced() {
159 | postNUI('SAVE_ADVANCED_SETTINGS',{
160 | AdvancedConfigurationData : this.AdvancedConfiguration,
161 | dataname : this.presetName
162 | }
163 | )
164 | this.extrasUI = false
165 | this.presetInput = false
166 | postNUI('GET_CUSTOMS_DATA', {});
167 | this.currentPage == "Presets"
168 | },
169 |
170 |
171 | openInput() {
172 | this.extrasUI = true
173 | this.presetInput = true
174 | },
175 | applySettingsPreview() {
176 | },
177 | selectReadyPreset(title) {
178 | postNUI('CHANGE_MODE',{
179 | mode : title,
180 | }
181 | )
182 | this.selectedCustomPreset = title;
183 | this.selectedReadyPreset = null;
184 | },
185 | deletePreset(title, index) {
186 | const selectedData = this.Presets.find(preset => preset.title === title);
187 | if (selectedData) {
188 | postNUI('DELETE_PRESET', {
189 | vehicleData: selectedData
190 | });
191 | }
192 | this.currentPage = "Presets";
193 |
194 | this.Presets.splice(index, 1);
195 | this.currentPage = "Presets";
196 | },
197 | InsertXML(title) {
198 | const selectedData = this.Presets.find(preset => preset.title === title);
199 |
200 | if (!selectedData) {
201 | console.error("❌ Selected preset not found for title:", title);
202 | return;
203 | }
204 | const vehicleData = {
205 | dataname: selectedData.title,
206 | AdvancedConfigurationData: selectedData.AdvancedConfigurationData || []
207 | };
208 | postNUI('GET_XML_DATA', {
209 | vehicleData: vehicleData
210 | });
211 | postNUI('GET_ADVANCED_DATA')
212 | postNUI('GET_CUSTOMS_DATA',{})
213 | this.currentPage = "Presets";
214 | },
215 | // Update Methods
216 | updateHandlingData(handlingData) {
217 | this.SimpleConfiguration.forEach((item) => {
218 | if (handlingData[item.modal] !== undefined) {
219 | item[item.modal] = handlingData[item.modal];
220 | }
221 | });
222 | this.AdvancedConfiguration.forEach((item) => {
223 | if (handlingData[item.modal] !== undefined) {
224 | item[item.modal] = handlingData[item.modal];
225 | }
226 | });
227 | },
228 | // UI Methods
229 | toggleConfirm() {
230 | this.confirmChanges = !this.confirmChanges;
231 | },
232 | increaseValue(item) {
233 | item[item.modal] = Math.min(item[item.modal] + item.step, item.maxValue);
234 | },
235 | decreaseValue(item) {
236 | item[item.modal] = Math.max(item[item.modal] - item.step, item.minValue);
237 | },
238 | onInputChange(item, modal) {
239 | item[modal] = parseFloat(item[modal]);
240 | },
241 | updateTime() {
242 | const now = new Date();
243 | const hours = now.getHours();
244 | const minutes = now.getMinutes().toString().padStart(2, '0');
245 | const seconds = now.getSeconds().toString().padStart(2, '0');
246 | const ampm = hours >= 12 ? 'PM' : 'AM';
247 | const formattedHours = hours % 12 || 12;
248 | this.currentTime = `${formattedHours}:${minutes}:${seconds} ${ampm}`;
249 | },
250 | updatePage(page) {
251 | this.currentPage = page.title;
252 | this.currentPageDescription = page.description;
253 | if (this.currentPage == "Presets") {
254 |
255 | postNUI('GET_CUSTOMS_DATA',{})
256 | } else if (this.currentPage == "Advanced Configuration") {
257 | postNUI('GET_ADVANCED_DATA',{})
258 | postNUI('GET_CUSTOMS_DATA',{})
259 | } else if (this.currentPage == "Test Tool") {
260 | this.extrasUI = true
261 | this.recorderUI = true
262 | this.policeUI = false
263 | this.presetInput= false
264 | this.showUI = false
265 | this.currentPage = "Home"
266 | postNUI('TEST_TOOL')
267 |
268 | }
269 | },
270 | updateSubPage(subpage) {
271 | this.currentPage = "Advanced Configuration";
272 | this.currentSubPage = subpage.title;
273 | this.currentSubPageDescription = subpage.description;
274 |
275 | },
276 | hideSubPages() {
277 | this.showSubPages = false;
278 | },
279 | copyHandling() {
280 | const textArea = document.createElement('textarea');
281 | textArea.value = this.generatedXML;
282 | document.body.appendChild(textArea);
283 | textArea.select();
284 | document.execCommand('copy');
285 | document.body.removeChild(textArea);
286 | },
287 | downloadHandling() {
288 | if (!this.generatedXML.trim()) {
289 |
290 | return;
291 | }
292 |
293 | const file = new Blob([this.generatedXML], { type: "text/xml" });
294 | const url = URL.createObjectURL(file);
295 |
296 | if (typeof window.invokeNative !== "undefined") {
297 | window.invokeNative("openUrl", url); // FiveM tarayıcısında URL aç
298 | } else {
299 |
300 | const a = document.createElement("a");
301 | a.href = url;
302 | a.download = "handling.xml"; // Dosya adı
303 | document.body.appendChild(a);
304 | a.click();
305 | document.body.removeChild(a);
306 | URL.revokeObjectURL(url);
307 | }
308 | },
309 | exitUI() {
310 | postNUI("exit");
311 | this.showUI = false
312 | },
313 | startTimer() {
314 | if (this.timer) return;
315 | this.counter = 0;
316 | this.timer = setInterval(() => {
317 | this.counter++;
318 | if (this.reachHalfMile > 0) {
319 | this.stopTimer();
320 | }
321 | }, 1000);
322 | },
323 | stopTimer() {
324 | if (this.timer) {
325 | clearInterval(this.timer);
326 | this.timer = null;
327 | }
328 | },
329 | resetTimer() {
330 | this.stopTimer();
331 | this.counter = 0;
332 | }
333 | },
334 |
335 |
336 | computed: {
337 | filteredConfiguration() {
338 | return this.AdvancedConfiguration.filter(
339 | (item) => item.subCategory === this.currentSubPage
340 | );
341 | },
342 | filteredConfigurations() {
343 | return this.AdvancedConfiguration.filter(item => item.subCategory === this.currentSubPage);
344 | },
345 | advancedConfigMap() {
346 | return this.AdvancedConfiguration.reduce((acc, item) => {
347 | acc[item.modal] = item[item.modal];
348 | return acc;
349 | }, {});
350 | },
351 | generatedXML() {
352 | return `
353 |
354 |
355 |
356 | -
357 | ${this.currentVehicleName}
358 |
359 |
360 |
361 |
362 |
363 |
364 |
365 |
366 |
367 |
368 |
369 |
370 |
371 |
372 |
373 |
374 |
375 |
376 |
377 |
378 |
379 |
380 |
381 |
382 |
383 |
384 |
385 |
386 |
387 |
388 |
389 |
390 |
391 |
392 |
393 |
394 |
395 |
396 |
397 |
398 |
399 |
400 |
401 |
402 |
403 |
404 | 440010
405 | 20000
406 | 0
407 | AVERAGE
408 |
409 |
410 |
411 |
412 |
413 |
414 |
415 |
416 | `;
417 | }
418 | },
419 |
420 | mounted() {
421 | this.updateTime();
422 | setInterval(this.updateTime, 1000);
423 | const defaultPage = this.Pages.find(page => page.title === this.currentPage);
424 | if (defaultPage) {
425 | this.currentPageDescription = defaultPage.description;
426 | }
427 | window.addEventListener("message", (event) => {
428 | if (event.data.action == "SHOW_INTERFACE") {
429 | this.showUI = true
430 | this.Locales = event.data.Locales
431 | this.AdvancedConfiguration = event.data.AdvancedConfiguration
432 | this.SimpleConfiguration = event.data.SimpleConfiguration
433 | this.readyPresets = event.data.readyPresets
434 | this.Pages = event.data.Pages
435 | this.subPages = event.data.subPages
436 | this.currentVehicleName = event.data.vehicleDatas.currentVehicleName
437 | this.currentVehiclePlate = event.data.vehicleDatas.currentVehiclePlate
438 | this.extrasUI = false
439 | this.recorderUI = false
440 | this.policeUI = false
441 | this.currentVehicleAcceleration = event.data.vehicleDatas.currentVehicleAcceleration
442 | this.currentVehicleTopSpeed = event.data.vehicleDatas.currentVehicleTopSpeed
443 | this.currentVehicleTraction = event.data.vehicleDatas.currentVehicleTraction
444 | this.currentVehicleBraking = event.data.vehicleDatas.currentVehicleBraking
445 | this.currentVehicleFuelLevel = event.data.vehicleDatas.currentVehicleFuelLevel
446 | this.currentVehicleHealth = event.data.vehicleDatas.currentVehicleHealth
447 | this.currentVehicleOilLevel = event.data.vehicleDatas.currentVehicleOilLevel
448 | this.currentVehicleEngineTemp = event.data.vehicleDatas.currentVehicleEngineTemp
449 | this.updateHandlingData(event.data.handlingData);
450 | postNUI('GET_CUSTOMS_DATA',{})
451 |
452 |
453 | } if (event.data.action == "GET_CURRENT_DATA") {
454 | const receivedData = event.data.GetCurrentData;
455 |
456 | this.Presets = receivedData.map(item => ({
457 | title: item.Data.dataname || "Unknown Preset",
458 | description: "Saved",
459 | AdvancedConfigurationData : item.Data.AdvancedConfigurationData
460 | }));
461 | } if (event.data.action == "GET_VEHICLE_DATA") {
462 | this.updateHandlingData(event.data.vehicleData);
463 | postNUI('GET_CUSTOMS_DATA',{})
464 | } if (event.data.action == "GET_TOOL") {
465 |
466 | this.extrasUI = true
467 | this.recorderUI = true
468 | this.policeUI = false
469 | this.presetInput= false
470 | this.showUI = false
471 | this.reachHundred = event.data.reach100
472 | this.reachSixty = event.data.reach60
473 | this.reachQuarterMile = event.data.reachquart
474 | this.reachHalfMile = event.data.reachhalf
475 | }
476 | if (event.data.action == "TIMER") {
477 | if (event.data.status == 0) {
478 | this.stopTimer();
479 | } else if (event.data.status == 1) {
480 | this.startTimer();
481 | } else if (event.data.status == 2) {
482 | this.resetTimer();
483 | }
484 | }
485 | document.onkeyup = (data) => {
486 | if (data.which == 27) {
487 | postNUI("exit");
488 | this.showUI = false;
489 | return;
490 | }
491 | };
492 | });
493 |
494 | },
495 |
496 | destroyed() {
497 |
498 | },
499 | created() {
500 |
501 | },
502 | beforeDestroy() {
503 | },
504 | });
505 |
506 | app.use(store).mount("#app");
507 |
508 |
509 | var resourceName = "ld-tunertablet";
510 |
511 | if (window.GetParentResourceName) {
512 | resourceName = window.GetParentResourceName();
513 | }
514 |
515 | window.postNUI = async (name, data) => {
516 | try {
517 | const response = await fetch(`https://${resourceName}/${name}`, {
518 | method: "POST",
519 | mode: "cors",
520 | cache: "no-cache",
521 | credentials: "same-origin",
522 | headers: {
523 | "Content-Type": "application/json"
524 | },
525 | redirect: "follow",
526 | referrerPolicy: "no-referrer",
527 | body: JSON.stringify(data)
528 | });
529 | return !response.ok ? null : response.json();
530 | } catch (error) {
531 | // console.log(error)
532 | }
533 | };
534 |
535 |
536 |
537 |
--------------------------------------------------------------------------------
/html/src/scripts/vuex.global.js:
--------------------------------------------------------------------------------
1 | /*!
2 | * vuex v4.1.0
3 | * (c) 2022 Evan You
4 | * @license MIT
5 | */
6 | var Vuex = (function (vue) {
7 | 'use strict';
8 |
9 | var storeKey = 'store';
10 |
11 | function useStore (key) {
12 | if ( key === void 0 ) key = null;
13 |
14 | return vue.inject(key !== null ? key : storeKey)
15 | }
16 |
17 | function getDevtoolsGlobalHook() {
18 | return getTarget().__VUE_DEVTOOLS_GLOBAL_HOOK__;
19 | }
20 | function getTarget() {
21 | // @ts-ignore
22 | return typeof navigator !== 'undefined'
23 | ? window
24 | : typeof global !== 'undefined'
25 | ? global
26 | : {};
27 | }
28 |
29 | var HOOK_SETUP = 'devtools-plugin:setup';
30 |
31 | function setupDevtoolsPlugin(pluginDescriptor, setupFn) {
32 | var hook = getDevtoolsGlobalHook();
33 | if (hook) {
34 | hook.emit(HOOK_SETUP, pluginDescriptor, setupFn);
35 | }
36 | else {
37 | var target = getTarget();
38 | var list = target.__VUE_DEVTOOLS_PLUGINS__ = target.__VUE_DEVTOOLS_PLUGINS__ || [];
39 | list.push({
40 | pluginDescriptor: pluginDescriptor,
41 | setupFn: setupFn
42 | });
43 | }
44 | }
45 |
46 | /**
47 | * Get the first item that pass the test
48 | * by second argument function
49 | *
50 | * @param {Array} list
51 | * @param {Function} f
52 | * @return {*}
53 | */
54 | function find (list, f) {
55 | return list.filter(f)[0]
56 | }
57 |
58 | /**
59 | * Deep copy the given object considering circular structure.
60 | * This function caches all nested objects and its copies.
61 | * If it detects circular structure, use cached copy to avoid infinite loop.
62 | *
63 | * @param {*} obj
64 | * @param {Array