@@ -5,27 +5,33 @@ mapsettings.gamemodeSettings = {}
55local valueWidget
66local isHandled
77addEventHandler ( " doLoadEDF" , root ,
8- function (tableEDF , resource )
8+ function (tableEDF , resource , isMapLoading )
99 -- store all our data neatly under the resource
1010 edfSettings [resource ] = tableEDF [" settings" ]
1111 refreshGamemodeSettings ()
1212 -- send back the intepreted gui table so the server knows the settings !!Lazy, server could interpret this info or only one client could send it
13- mapsettings .gamemodeSettings = copyTable ( mapsettings .rowValues )
14- currentMapSettings .rowData = rowData
15- currentMapSettings .gamemodeSettings = mapsettings .gamemodeSettings
16- triggerServerEvent ( " doSaveMapSettings" , localPlayer , currentMapSettings , true )
13+ -- prevent edf from overwriting map settings while the map is being loaded
14+ if not isMapLoading then
15+ mapsettings .gamemodeSettings = copyTable ( mapsettings .rowValues )
16+ currentMapSettings .rowData = rowData
17+ currentMapSettings .gamemodeSettings = mapsettings .gamemodeSettings
18+ triggerServerEvent ( " doSaveMapSettings" , localPlayer , currentMapSettings , true )
19+ end
1720end )
1821
1922addEventHandler ( " doUnloadEDF" , root ,
20- function (resource )
23+ function (resource , isMapLoading )
2124 -- store all our data neatly under the resource
2225 edfSettings [resource ] = nil
2326 refreshGamemodeSettings ()
2427 -- send back the intepreted gui table so the server knows the settings !!Lazy, server could interpret this info or only one client could send it
25- mapsettings .gamemodeSettings = copyTable ( mapsettings .rowValues )
26- currentMapSettings .rowData = rowData
27- currentMapSettings .gamemodeSettings = mapsettings .gamemodeSettings
28- triggerServerEvent ( " doSaveMapSettings" , localPlayer , currentMapSettings , true )
28+ -- prevent edf from overwriting map settings while the map is being loaded
29+ if not isMapLoading then
30+ mapsettings .gamemodeSettings = copyTable ( mapsettings .rowValues )
31+ currentMapSettings .rowData = rowData
32+ currentMapSettings .gamemodeSettings = mapsettings .gamemodeSettings
33+ triggerServerEvent ( " doSaveMapSettings" , localPlayer , currentMapSettings , true )
34+ end
2935end )
3036
3137function refreshGamemodeSettings ()
0 commit comments