mirror of
https://github.com/esx-framework/esx_core.git
synced 2026-09-01 10:48:52 +00:00
Added back removed NUI chunking code
This commit is contained in:
+20
-54
@@ -11,45 +11,41 @@ Citizen.CreateThread(function()
|
||||
|
||||
local openMenu = function(namespace, name, data)
|
||||
SendNUIMessage({
|
||||
action = 'openMenu',
|
||||
action = 'openMenu',
|
||||
namespace = namespace,
|
||||
name = name,
|
||||
data = data
|
||||
name = name,
|
||||
data = data
|
||||
})
|
||||
end
|
||||
|
||||
local closeMenu = function(namespace, name)
|
||||
SendNUIMessage({
|
||||
action = 'closeMenu',
|
||||
action = 'closeMenu',
|
||||
namespace = namespace,
|
||||
name = name,
|
||||
data = data
|
||||
name = name,
|
||||
data = data
|
||||
})
|
||||
end
|
||||
|
||||
ESX.UI.Menu.RegisterType(MenuType, openMenu, closeMenu)
|
||||
|
||||
RegisterNUICallback('menu_submit', function(data, cb)
|
||||
AddEventHandler('esx_menu_default:message:menu_submit', function(data)
|
||||
local menu = ESX.UI.Menu.GetOpened(MenuType, data._namespace, data._name)
|
||||
|
||||
if menu.submit then
|
||||
|
||||
if menu.submit ~= nil then
|
||||
menu.submit(data, menu)
|
||||
end
|
||||
|
||||
cb('OK')
|
||||
end)
|
||||
|
||||
RegisterNUICallback('menu_cancel', function(data, cb)
|
||||
AddEventHandler('esx_menu_default:message:menu_cancel', function(data)
|
||||
local menu = ESX.UI.Menu.GetOpened(MenuType, data._namespace, data._name)
|
||||
|
||||
if menu.cancel then
|
||||
|
||||
if menu.cancel ~= nil then
|
||||
menu.cancel(data, menu)
|
||||
end
|
||||
|
||||
cb('OK')
|
||||
end)
|
||||
|
||||
RegisterNUICallback('menu_change', function(data, cb)
|
||||
AddEventHandler('esx_menu_default:message:menu_change', function(data)
|
||||
local menu = ESX.UI.Menu.GetOpened(MenuType, data._namespace, data._name)
|
||||
|
||||
for i=1, #data.elements, 1 do
|
||||
@@ -60,76 +56,46 @@ Citizen.CreateThread(function()
|
||||
else
|
||||
menu.setElement(i, 'selected', false)
|
||||
end
|
||||
|
||||
end
|
||||
|
||||
if menu.change then
|
||||
if menu.change ~= nil then
|
||||
menu.change(data, menu)
|
||||
end
|
||||
|
||||
cb('OK')
|
||||
end)
|
||||
|
||||
Citizen.CreateThread(function()
|
||||
while true do
|
||||
|
||||
Citizen.Wait(10)
|
||||
|
||||
if IsControlPressed(0, 18) and IsInputDisabled(0) and (GetGameTimer() - GUI.Time) > 150 then
|
||||
SendNUIMessage({
|
||||
action = 'controlPressed',
|
||||
control = 'ENTER'
|
||||
})
|
||||
|
||||
SendNUIMessage({action = 'controlPressed', control = 'ENTER'})
|
||||
GUI.Time = GetGameTimer()
|
||||
end
|
||||
|
||||
if IsControlPressed(0, 177) and IsInputDisabled(0) and (GetGameTimer() - GUI.Time) > 150 then
|
||||
SendNUIMessage({
|
||||
action = 'controlPressed',
|
||||
control = 'BACKSPACE'
|
||||
})
|
||||
|
||||
SendNUIMessage({action = 'controlPressed', control = 'BACKSPACE'})
|
||||
GUI.Time = GetGameTimer()
|
||||
end
|
||||
|
||||
if IsControlPressed(0, 27) and IsInputDisabled(0) and (GetGameTimer() - GUI.Time) > 200 then
|
||||
SendNUIMessage({
|
||||
action = 'controlPressed',
|
||||
control = 'TOP'
|
||||
})
|
||||
|
||||
SendNUIMessage({action = 'controlPressed', control = 'TOP'})
|
||||
GUI.Time = GetGameTimer()
|
||||
end
|
||||
|
||||
if IsControlPressed(0, 173) and IsInputDisabled(0) and (GetGameTimer() - GUI.Time) > 200 then
|
||||
SendNUIMessage({
|
||||
action = 'controlPressed',
|
||||
control = 'DOWN'
|
||||
})
|
||||
|
||||
SendNUIMessage({action = 'controlPressed', control = 'DOWN'})
|
||||
GUI.Time = GetGameTimer()
|
||||
end
|
||||
|
||||
if IsControlPressed(0, 174) and IsInputDisabled(0) and (GetGameTimer() - GUI.Time) > 150 then
|
||||
SendNUIMessage({
|
||||
action = 'controlPressed',
|
||||
control = 'LEFT'
|
||||
})
|
||||
|
||||
SendNUIMessage({action = 'controlPressed', control = 'LEFT'})
|
||||
GUI.Time = GetGameTimer()
|
||||
end
|
||||
|
||||
if IsControlPressed(0, 175) and IsInputDisabled(0) and (GetGameTimer() - GUI.Time) > 150 then
|
||||
SendNUIMessage({
|
||||
action = 'controlPressed',
|
||||
control = 'RIGHT'
|
||||
})
|
||||
|
||||
SendNUIMessage({action = 'controlPressed', control = 'RIGHT'})
|
||||
GUI.Time = GetGameTimer()
|
||||
end
|
||||
|
||||
end
|
||||
end)
|
||||
|
||||
end)
|
||||
|
||||
Reference in New Issue
Block a user