From dec706afed1a99f04ef1a4d7e0c45c7724cf6cdc Mon Sep 17 00:00:00 2001 From: ElPumpo Date: Wed, 25 Jul 2018 12:35:38 +0200 Subject: [PATCH] Fixed yet again player data not loaded --- client/main.lua | 21 ++++++++++++++++++++- 1 file changed, 20 insertions(+), 1 deletion(-) diff --git a/client/main.lua b/client/main.lua index 7bf9e794..cc5e2af4 100644 --- a/client/main.lua +++ b/client/main.lua @@ -29,7 +29,7 @@ Citizen.CreateThread(function () Citizen.Wait(0) end - Citizen.Wait(5000) + Citizen.Wait(10000) ESX.TriggerServerCallback('esx_vehicleshop:getCategories', function (categories) Categories = categories @@ -54,6 +54,25 @@ Citizen.CreateThread(function () end end) +RegisterNetEvent('esx:playerLoaded') +AddEventHandler('esx:playerLoaded', function(xPlayer) + ESX.PlayerData = xPlayer + + if Config.EnablePlayerManagement then + if ESX.PlayerData.job.name == 'cardealer' then + Config.Zones.ShopEntering.Type = 1 + + if ESX.PlayerData.job.grade_name == 'boss' then + Config.Zones.BossActions.Type = 1 + end + + else + Config.Zones.ShopEntering.Type = -1 + Config.Zones.BossActions.Type = -1 + end + end +end) + RegisterNetEvent('esx_vehicleshop:sendCategories') AddEventHandler('esx_vehicleshop:sendCategories', function (categories) Categories = categories