-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathclient.lua
More file actions
59 lines (43 loc) · 1.61 KB
/
client.lua
File metadata and controls
59 lines (43 loc) · 1.61 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
local function parse_visual_settings(file_content)
-- split the file content into lines
local lines = {}
for line in file_content:gmatch("[^\r\n]+") do
table.insert(lines, line)
end
-- parse each line and store the settings in a table
local settings = {}
--local count = 0
for _, line in ipairs(lines) do
-- ignore comments and empty lines
if not line:match("^%s*$") and not line:match("^%s*#") and not line:match("^%s*//") then
local key, value = line:match("^%s*(%S+)%s+(%S+)")
if key and value then
value = value:gsub("[fF]$", "")
settings[key] = value
--count = count + 1
end
end
end
--print("Parsed " .. count .. " lines")
return settings
end
local function load_visual_settings(file_path)
-- load the specified file into memory
local visual_settings_file = LoadResourceFile(GetCurrentResourceName(), file_path)
-- check if the file was loaded successfully
if not visual_settings_file then
print("Failed to load visual settings file: " .. file_path)
end
-- parse the visual settings
local visual_settings = parse_visual_settings(visual_settings_file)
--local count = 0
-- apply the visual settings
for setting, value in pairs(visual_settings) do
SetVisualSettingFloat(setting, value * 1.0)
--count = count + 1
end
--print("Applied " .. count .. " visual settings from " .. file_path)
end
Citizen.CreateThread(function()
load_visual_settings("data/test_visualsettings.dat")
end)