diff --git a/server-data/resources/[bpt_addons]/bpt_fisherman/client/main.lua b/server-data/resources/[bpt_addons]/bpt_fisherman/client/main.lua index 3d3353d29..93f5efe38 100644 --- a/server-data/resources/[bpt_addons]/bpt_fisherman/client/main.lua +++ b/server-data/resources/[bpt_addons]/bpt_fisherman/client/main.lua @@ -2,20 +2,17 @@ local HasAlreadyEnteredMarker local CurrentAction, CurrentActionMsg, CurrentActionData = nil, "", {} local LastZone -RegisterNetEvent("esx:playerLoaded") -AddEventHandler("esx:playerLoaded", function(xPlayer) +RegisterNetEvent("esx:playerLoaded", function(xPlayer) ESX.PlayerData = xPlayer ESX.PlayerLoaded = true end) -RegisterNetEvent("esx:onPlayerLogout") -AddEventHandler("esx:onPlayerLogout", function() +RegisterNetEvent("esx:onPlayerLogout", function() ESX.PlayerLoaded = false ESX.PlayerData = {} end) -RegisterNetEvent("esx:setJob") -AddEventHandler("esx:setJob", function(job) +RegisterNetEvent("esx:setJob", function(job) ESX.PlayerData.job = job end) @@ -255,7 +252,7 @@ function IsInAuthorizedVehicle() return false end -AddEventHandler("bpt_fishermanjob:hasEnteredMarker", function(zone) +RegisterNetEvent("bpt_fishermanjob:hasEnteredMarker", function(zone) if zone == "VehicleSpawner" then CurrentAction = "vehicle_spawner" CurrentActionMsg = _U("spawner_prompt") @@ -282,7 +279,7 @@ AddEventHandler("bpt_fishermanjob:hasEnteredMarker", function(zone) end end) -AddEventHandler("bpt_fishermanjob:hasExitedMarker", function() +RegisterNetEvent("bpt_fishermanjob:hasExitedMarker", function() ESX.CloseContext() CurrentAction = nil end) diff --git a/server-data/resources/[bpt_addons]/bpt_fisherman/server/main.lua b/server-data/resources/[bpt_addons]/bpt_fisherman/server/main.lua index fcf1b92b4..e288b7e99 100644 --- a/server-data/resources/[bpt_addons]/bpt_fisherman/server/main.lua +++ b/server-data/resources/[bpt_addons]/bpt_fisherman/server/main.lua @@ -36,8 +36,7 @@ ESX.RegisterServerCallback("bpt_fishermanjob:SpawnVehicle", function(source, cb, cb() end) -RegisterNetEvent("bpt_fishermanjob:getStockItem") -AddEventHandler("bpt_fishermanjob:getStockItem", function(itemName, count) +RegisterNetEvent("bpt_fishermanjob:getStockItem", function(itemName, count) local xPlayer = ESX.GetPlayerFromId(source) if xPlayer.job.name == "fisherman" then @@ -69,8 +68,7 @@ ESX.RegisterServerCallback("bpt_fishermanjob:getStockItems", function(_, cb) end) end) -RegisterNetEvent("bpt_fishermanjob:putStockItems") -AddEventHandler("bpt_fishermanjob:putStockItems", function(itemName, count) +RegisterNetEvent("bpt_fishermanjob:putStockItems", function(itemName, count) local xPlayer = ESX.GetPlayerFromId(source) local sourceItem = xPlayer.getInventoryItem(itemName)