mirror of
https://github.com/Michatec/wk_wars2x.git
synced 2026-04-01 00:16:27 +02:00
UI settings now get saved and loaded
This commit is contained in:
26
cl_radar.lua
26
cl_radar.lua
@@ -30,6 +30,23 @@ Citizen.SetTimeout( 1000, function()
|
||||
end )
|
||||
|
||||
|
||||
--[[----------------------------------------------------------------------------------
|
||||
UI loading trigger
|
||||
----------------------------------------------------------------------------------]]--
|
||||
local spawned = false
|
||||
|
||||
AddEventHandler( "playerSpawned", function()
|
||||
if ( not spawned ) then
|
||||
TriggerServerEvent( "wk:getUiData" )
|
||||
spawned = true
|
||||
end
|
||||
end )
|
||||
|
||||
RegisterNetEvent( "wk:loadUiData" )
|
||||
AddEventHandler( "wk:loadUiData", function( data )
|
||||
SendNUIMessage( { _type = "loadUiSettings", data = data } )
|
||||
end )
|
||||
|
||||
--[[----------------------------------------------------------------------------------
|
||||
Player info variables
|
||||
----------------------------------------------------------------------------------]]--
|
||||
@@ -1325,6 +1342,11 @@ RegisterNUICallback( "menu", function()
|
||||
SendNUIMessage( { _type = "audio", name = "beep", vol = RADAR:GetSettingValue( "beep" ) } )
|
||||
end )
|
||||
|
||||
-- Runs when the JavaScript side sends the UI data for saving
|
||||
RegisterNUICallback( "saveUiData", function( data, cb )
|
||||
TriggerServerEvent( "wk:saveUiData", data )
|
||||
end )
|
||||
|
||||
|
||||
--[[----------------------------------------------------------------------------------
|
||||
Main threads
|
||||
@@ -1587,9 +1609,9 @@ function RADAR:RunControlManager()
|
||||
end
|
||||
|
||||
-- Shortcut to restart the resource
|
||||
--[[if ( IsDisabledControlJustPressed( 1, 167 ) ) then
|
||||
if ( IsDisabledControlJustPressed( 1, 167 ) ) then
|
||||
ExecuteCommand( "restart wk_wars2x" )
|
||||
end]]
|
||||
end
|
||||
end
|
||||
|
||||
-- Control manager
|
||||
|
||||
Reference in New Issue
Block a user