Merge pull request #339 from Mycroft-Studios/master

Fixes
This commit is contained in:
FuraXx
2021-04-10 14:22:33 +02:00
committed by GitHub
2 changed files with 27 additions and 48 deletions
+24 -46
View File
@@ -10,29 +10,7 @@ Citizen.CreateThread(function()
Citizen.Wait(0)
end
Citizen.Wait(10000)
ESX.TriggerServerCallback('esx_vehicleshop:getCategories', function(categories)
Categories = categories
end)
ESX.TriggerServerCallback('esx_vehicleshop:getVehicles', function(vehicles)
Vehicles = vehicles
end)
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
PlayerManagement()
end)
function getVehicleLabelFromModel(model)
@@ -45,10 +23,17 @@ function getVehicleLabelFromModel(model)
return
end
RegisterNetEvent('esx:playerLoaded')
AddEventHandler('esx:playerLoaded', function(xPlayer)
ESX.PlayerData = xPlayer
function getVehicles()
ESX.TriggerServerCallback('esx_vehicleshop:getCategories', function(categories)
Categories = categories
end)
ESX.TriggerServerCallback('esx_vehicleshop:getVehicles', function(vehicles)
Vehicles = vehicles
end)
end
function PlayerManagement()
if Config.EnablePlayerManagement then
if ESX.PlayerData.job.name == 'cardealer' then
Config.Zones.ShopEntering.Type = 1
@@ -62,6 +47,14 @@ AddEventHandler('esx:playerLoaded', function(xPlayer)
Config.Zones.BossActions.Type = -1
end
end
end
RegisterNetEvent('esx:playerLoaded')
AddEventHandler('esx:playerLoaded', function(xPlayer)
ESX.PlayerData = xPlayer
PlayerManagement()
getVehicles()
end)
RegisterNetEvent('esx_vehicleshop:sendCategories')
@@ -74,6 +67,9 @@ AddEventHandler('esx_vehicleshop:sendVehicles', function(vehicles)
Vehicles = vehicles
end)
RegisterNetEvent('esx:setJob') AddEventHandler('esx:setJob', PlayerManagement)
function DeleteDisplayVehicleInsideShop()
local attempt = 0
@@ -647,24 +643,6 @@ function OpenPutStocksMenu()
end)
end
RegisterNetEvent('esx:setJob')
AddEventHandler('esx:setJob', function(job)
ESX.PlayerData.job = job
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)
AddEventHandler('esx_vehicleshop:hasEnteredMarker', function(zone)
if zone == 'ShopEntering' then
@@ -787,7 +765,7 @@ end)
-- Enter / Exit marker events & Draw Markers
Citizen.CreateThread(function()
while true do
Citizen.Wait(0)
Citizen.Wait(4)
local playerCoords = GetEntityCoords(PlayerPedId())
local isInMarker, letSleep, currentZone = false, true
@@ -827,7 +805,7 @@ end)
-- Key controls
Citizen.CreateThread(function()
while true do
Citizen.Wait(0)
Citizen.Wait(5)
if CurrentAction then
ESX.ShowHelpNotification(CurrentActionMsg)
+3 -2
View File
@@ -23,8 +23,9 @@ function RemoveOwnedVehicle(plate)
end
AddEventHandler('onResourceStart', function(resourceName)
Wait(1000)
SQLVehiclesAndCategories()
if resourceName == GetCurrentResourceName() then
MySQL.ready(function() SQLVehiclesAndCategories() end)
end
end)
function SQLVehiclesAndCategories()