forked from Jarrrk/FiveM-VisualSettings
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathclient.lua
38 lines (29 loc) · 963 Bytes
/
client.lua
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
function stringsplit(inputstr, sep)
if sep == nil then
sep = "%s"
end
local t={} ; i=1
for str in string.gmatch(inputstr, "([^"..sep.."]+)") do
t[i] = str
i = i + 1
end
return t
end
local function starts_with(str, start)
return str:sub(1, #start) == start
end
Citizen.CreateThread(function()
local settingsFile = LoadResourceFile(GetCurrentResourceName(), "visualsettings.dat")
local lines = stringsplit(settingsFile, "\n")
for k,v in ipairs(lines) do
if not starts_with(v, '#') and not starts_with(v, '//') and (v ~= "" or v ~= " ") and #v > 1 then
v = v:gsub("%s+", " ")
local setting = stringsplit(v, " ")
if setting[1] ~= nil and setting[2] ~= nil and tonumber(setting[2]) ~= nil then
if setting[1] ~= 'weather.CycleDuration' then
Citizen.InvokeNative(GetHashKey('SET_VISUAL_SETTING_FLOAT') & 0xFFFFFFFF, setting[1], tonumber(setting[2])+.0)
end
end
end
end
end)