From acb264c0270d69f50fdb5c3648dad52e5fe2ad0c Mon Sep 17 00:00:00 2001 From: Linden <65407488+thelindat@users.noreply.github.com> Date: Mon, 7 Jun 2021 11:14:54 +1000 Subject: [PATCH 1/2] revert(client/main): Go back to table.insert for GetStatusData Not even sure why I did it as size+1 and not i; but doesn't seem to work with index anyway. Fixes nil value after dying --- client/main.lua | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/client/main.lua b/client/main.lua index afe7498e..b6776f64 100644 --- a/client/main.lua +++ b/client/main.lua @@ -13,19 +13,19 @@ function GetStatusData(minimal) for i=1, #Status, 1 do if minimal then - status[#status+1] = { + table.insert(status, { name = Status[i].name, val = Status[i].val, percent = (Status[i].val / Config.StatusMax) * 100 - } + }) else - status[#status+1] { + table.insert(status, { name = Status[i].name, val = Status[i].val, color = Status[i].color, visible = Status[i].visible(Status[i]), percent = (Status[i].val / Config.StatusMax) * 100 - } + }) end end From 4aa9525fcf0b6f8105076f5667453dfca200bb7c Mon Sep 17 00:00:00 2001 From: Linden <65407488+thelindat@users.noreply.github.com> Date: Mon, 14 Jun 2021 17:49:00 +1000 Subject: [PATCH 2/2] fix(client/main): Remove update triggerserverevent when modifying statuses (it only needed to trigger with the interval) --- client/main.lua | 3 --- 1 file changed, 3 deletions(-) diff --git a/client/main.lua b/client/main.lua index b6776f64..d9beefd7 100644 --- a/client/main.lua +++ b/client/main.lua @@ -109,7 +109,6 @@ AddEventHandler('esx_status:set', function(name, val) status = GetStatusData() }) end - TriggerServerEvent('esx_status:update', GetStatusData(true)) end) RegisterNetEvent('esx_status:add') @@ -126,7 +125,6 @@ AddEventHandler('esx_status:add', function(name, val) status = GetStatusData() }) end - TriggerServerEvent('esx_status:update', GetStatusData(true)) end) RegisterNetEvent('esx_status:remove') @@ -143,7 +141,6 @@ AddEventHandler('esx_status:remove', function(name, val) status = GetStatusData() }) end - TriggerServerEvent('esx_status:update', GetStatusData(true)) end) AddEventHandler('esx_status:getStatus', function(name, cb)