mirror of
https://github.com/Michatec/wk_wars2x.git
synced 2026-04-01 00:16:27 +02:00
NUI callback response formatting
This commit is contained in:
@@ -185,14 +185,14 @@ end )
|
|||||||
RegisterNUICallback( "togglePlateReaderDisplay", function( data, cb )
|
RegisterNUICallback( "togglePlateReaderDisplay", function( data, cb )
|
||||||
-- Toggle the display state
|
-- Toggle the display state
|
||||||
READER:ToggleDisplayState()
|
READER:ToggleDisplayState()
|
||||||
cb('ok')
|
cb( "ok" )
|
||||||
end )
|
end )
|
||||||
|
|
||||||
-- Runs when the "Set BOLO Plate" button is pressed on the plate reader box
|
-- Runs when the "Set BOLO Plate" button is pressed on the plate reader box
|
||||||
RegisterNUICallback( "setBoloPlate", function( plate, cb )
|
RegisterNUICallback( "setBoloPlate", function( plate, cb )
|
||||||
-- Set the BOLO plate
|
-- Set the BOLO plate
|
||||||
READER:SetBoloPlate( plate )
|
READER:SetBoloPlate( plate )
|
||||||
cb('ok')
|
cb( "ok" )
|
||||||
end )
|
end )
|
||||||
|
|
||||||
-- Runs when the "Clear BOLO Plate" button is pressed on the plate reader box
|
-- Runs when the "Clear BOLO Plate" button is pressed on the plate reader box
|
||||||
|
|||||||
19
cl_radar.lua
19
cl_radar.lua
@@ -1436,21 +1436,21 @@ end
|
|||||||
RegisterNUICallback( "toggleRadarDisplay", function( data, cb )
|
RegisterNUICallback( "toggleRadarDisplay", function( data, cb )
|
||||||
-- Toggle the display state
|
-- Toggle the display state
|
||||||
RADAR:ToggleDisplayState()
|
RADAR:ToggleDisplayState()
|
||||||
cb('ok')
|
cb( "ok" )
|
||||||
end )
|
end )
|
||||||
|
|
||||||
-- Runs when the user presses the power button on the radar ui
|
-- Runs when the user presses the power button on the radar ui
|
||||||
RegisterNUICallback( "togglePower", function( data, cb )
|
RegisterNUICallback( "togglePower", function( data, cb )
|
||||||
-- Toggle the radar's power
|
-- Toggle the radar's power
|
||||||
RADAR:TogglePower()
|
RADAR:TogglePower()
|
||||||
cb('ok')
|
cb( "ok" )
|
||||||
end )
|
end )
|
||||||
|
|
||||||
-- Runs when the user presses the ESC or RMB when the remote is open
|
-- Runs when the user presses the ESC or RMB when the remote is open
|
||||||
RegisterNUICallback( "closeRemote", function( data, cb )
|
RegisterNUICallback( "closeRemote", function( data, cb )
|
||||||
-- Remove focus to the NUI side
|
-- Remove focus to the NUI side
|
||||||
SetNuiFocus( false, false )
|
SetNuiFocus( false, false )
|
||||||
cb('ok')
|
cb( "ok" )
|
||||||
end )
|
end )
|
||||||
|
|
||||||
-- Runs when the user presses any of the antenna mode buttons on the remote
|
-- Runs when the user presses any of the antenna mode buttons on the remote
|
||||||
@@ -1482,7 +1482,8 @@ RegisterNUICallback( "setAntennaMode", function( data, cb )
|
|||||||
end )
|
end )
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
cb('ok')
|
|
||||||
|
cb( "ok" )
|
||||||
end )
|
end )
|
||||||
|
|
||||||
-- Runs when the user presses either of the XMIT/HOLD buttons on the remote
|
-- Runs when the user presses either of the XMIT/HOLD buttons on the remote
|
||||||
@@ -1507,7 +1508,8 @@ RegisterNUICallback( "toggleAntenna", function( data, cb )
|
|||||||
end )
|
end )
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
cb('ok')
|
|
||||||
|
cb( "ok" )
|
||||||
end )
|
end )
|
||||||
|
|
||||||
-- Runs when the user presses the menu button on the remote control
|
-- Runs when the user presses the menu button on the remote control
|
||||||
@@ -1529,20 +1531,21 @@ RegisterNUICallback( "menu", function( data, cb )
|
|||||||
-- Play the standard audio beep
|
-- Play the standard audio beep
|
||||||
SendNUIMessage( { _type = "audio", name = "beep", vol = RADAR:GetSettingValue( "beep" ) } )
|
SendNUIMessage( { _type = "audio", name = "beep", vol = RADAR:GetSettingValue( "beep" ) } )
|
||||||
end
|
end
|
||||||
cb('ok')
|
|
||||||
|
cb( "ok" )
|
||||||
end )
|
end )
|
||||||
|
|
||||||
-- Runs when the JavaScript side sends the UI data for saving
|
-- Runs when the JavaScript side sends the UI data for saving
|
||||||
RegisterNUICallback( "saveUiData", function( data, cb )
|
RegisterNUICallback( "saveUiData", function( data, cb )
|
||||||
UTIL:Log( "Saving updated UI settings data." )
|
UTIL:Log( "Saving updated UI settings data." )
|
||||||
SetResourceKvp( "wk_wars2x_ui_data", json.encode( data ) )
|
SetResourceKvp( "wk_wars2x_ui_data", json.encode( data ) )
|
||||||
cb('ok')
|
cb( "ok" )
|
||||||
end )
|
end )
|
||||||
|
|
||||||
-- Runs when the JavaScript side sends the quick start video has been watched
|
-- Runs when the JavaScript side sends the quick start video has been watched
|
||||||
RegisterNUICallback( "qsvWatched", function( data, cb )
|
RegisterNUICallback( "qsvWatched", function( data, cb )
|
||||||
SetResourceKvpInt( "wk_wars2x_new_user", 1 )
|
SetResourceKvpInt( "wk_wars2x_new_user", 1 )
|
||||||
cb('ok')
|
cb( "ok" )
|
||||||
end )
|
end )
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user