mirror of
https://github.com/esx-framework/esx_core.git
synced 2026-08-31 10:18:54 +00:00
improvement(client/hud): Setup a proper function for clearing the hud, instead of sending multiple NUI messages
This commit is contained in:
@@ -142,12 +142,9 @@ ESX.UI.HUD.RemoveElement = function(name)
|
||||
end
|
||||
|
||||
ESX.UI.HUD.Reset = function()
|
||||
for i=1, #ESX.UI.HUD.RegisteredElements, 1 do
|
||||
SendNUIMessage({
|
||||
action = 'deleteHUDElement',
|
||||
name = ESX.UI.HUD.RegisteredElements[i]
|
||||
})
|
||||
end
|
||||
SendNUIMessage({
|
||||
action = 'resetHUDElements'
|
||||
})
|
||||
ESX.UI.HUD.RegisteredElements = {}
|
||||
end
|
||||
|
||||
|
||||
@@ -41,6 +41,11 @@
|
||||
ESX.refreshHUD();
|
||||
};
|
||||
|
||||
ESX.resetHUDElements = function () {
|
||||
ESX.HUDElements = [];
|
||||
ESX.refreshHUD();
|
||||
};
|
||||
|
||||
ESX.refreshHUD = function () {
|
||||
$('#hud').html('');
|
||||
|
||||
@@ -95,6 +100,11 @@
|
||||
break;
|
||||
}
|
||||
|
||||
case 'resetHUDElements': {
|
||||
ESX.resetHUDElements();
|
||||
break;
|
||||
}
|
||||
|
||||
case 'inventoryNotification': {
|
||||
ESX.inventoryNotification(data.add, data.item, data.count);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user