4
4
local function resourceStart ()
5
5
-- Load the clientside configuration file, or create a new one if it does not exist.
6
6
local rootNode = xmlLoadFile (client_config_file ) or xmlCreateFile (client_config_file , " config" )
7
-
7
+
8
8
-- Ensure all important setting nodes exist.
9
9
for settingKey , defaultValue in pairs (setting ) do
10
10
if not xmlFindChild (rootNode , settingKey , 0 ) then
11
11
local newNode = xmlCreateChild (rootNode , settingKey )
12
12
xmlNodeSetValue (newNode , tostring (defaultValue ))
13
13
end
14
14
end
15
-
15
+
16
16
-- Remove deprecated/unused setting nodes.
17
17
for _ , subNode in ipairs (xmlNodeGetChildren (rootNode )) do
18
18
local nodeName = xmlNodeGetName (subNode )
19
19
if not setting [nodeName ] then
20
20
xmlDestroyNode (subNode )
21
21
end
22
22
end
23
-
23
+
24
24
xmlSaveFile (rootNode )
25
25
xmlUnloadFile (rootNode )
26
26
@@ -29,7 +29,7 @@ local function resourceStart()
29
29
30
30
-- Query the server for admin rights.
31
31
triggerServerEvent (" requestRights" , root )
32
-
32
+
33
33
-- Build the GUI.
34
34
startBuilding ()
35
35
end
@@ -42,4 +42,4 @@ local function resourceStop()
42
42
-- Unload the clientside configuration file.
43
43
xmlUnloadFile (client_handling_file )
44
44
end
45
- addEventHandler (" onClientResourceStop" , resourceRoot , resourceStop )
45
+ addEventHandler (" onClientResourceStop" , resourceRoot , resourceStop )
0 commit comments