Skip to content

Commit

Permalink
refactor(client/main): remove redundant AddEventHandler
Browse files Browse the repository at this point in the history
  • Loading branch information
Kenshiin13 committed Dec 22, 2024
1 parent d573090 commit 2d83d70
Showing 1 changed file with 5 additions and 10 deletions.
15 changes: 5 additions & 10 deletions client/main.lua
Original file line number Diff line number Diff line change
Expand Up @@ -45,8 +45,7 @@ AddEventHandler('esx_status:unregisterStatus', function(name)
end
end)

RegisterNetEvent('esx:onPlayerLogout')
AddEventHandler('esx:onPlayerLogout', function()
RegisterNetEvent('esx:onPlayerLogout', function()
ESX.PlayerLoaded = false
Status = {}
if Config.Display then
Expand All @@ -57,8 +56,7 @@ AddEventHandler('esx:onPlayerLogout', function()
end
end)

RegisterNetEvent('esx_status:load')
AddEventHandler('esx_status:load', function(status)
RegisterNetEvent('esx_status:load', function(status)
OriginalStatus = status
ESX.PlayerLoaded = true
TriggerEvent('esx_status:loaded')
Expand Down Expand Up @@ -96,8 +94,7 @@ AddEventHandler('esx_status:load', function(status)
end)
end)

RegisterNetEvent('esx_status:set')
AddEventHandler('esx_status:set', function(name, val)
RegisterNetEvent('esx_status:set', function(name, val)
for i=1, #Status, 1 do
if Status[i].name == name then
Status[i].set(val)
Expand All @@ -112,8 +109,7 @@ AddEventHandler('esx_status:set', function(name, val)
end
end)

RegisterNetEvent('esx_status:add')
AddEventHandler('esx_status:add', function(name, val)
RegisterNetEvent('esx_status:add', function(name, val)
for i=1, #Status, 1 do
if Status[i].name == name then
Status[i].add(val)
Expand All @@ -128,8 +124,7 @@ AddEventHandler('esx_status:add', function(name, val)
end
end)

RegisterNetEvent('esx_status:remove')
AddEventHandler('esx_status:remove', function(name, val)
RegisterNetEvent('esx_status:remove', function(name, val)
for i=1, #Status, 1 do
if Status[i].name == name then
Status[i].remove(val)
Expand Down

0 comments on commit 2d83d70

Please sign in to comment.