refactor: remove unneccessary ESX.GetPlayerData calls

es_extended/imports.lua already syncs these values with an event
This commit is contained in:
Linden
2022-03-11 02:40:20 +11:00
parent 297a01e9ae
commit 771a4509bd
6 changed files with 12 additions and 12 deletions
+1 -1
View File
@@ -38,7 +38,7 @@ if not Config.UseDeferrals then
AddEventHandler('esx_identity:showRegisterIdentity', function()
TriggerEvent('esx_skin:resetFirstSpawn')
if not ESX.GetPlayerData().dead then
if not ESX.PlayerData.dead then
EnableGui(true)
end
end)
+1 -1
View File
@@ -229,7 +229,7 @@ end)
if Config.EnableControls then
RegisterCommand("accessory", function(src)
if not ESX.GetPlayerData().dead then
if not ESX.PlayerData.dead then
OpenAccessoryMenu()
end
end)
+3 -3
View File
@@ -6,7 +6,7 @@ isInShopMenu = false
function OpenAmbulanceActionsMenu()
local elements = {{label = _U('cloakroom'), value = 'cloakroom'}}
if Config.EnablePlayerManagement and ESX.GetPlayerData().job.grade_name == 'boss' then
if Config.EnablePlayerManagement and ESX.PlayerData.job.grade_name == 'boss' then
table.insert(elements, {label = _U('boss_actions'), value = 'boss_actions'})
end
@@ -184,7 +184,7 @@ CreateThread(function()
while true do
local sleep = 1500
if ESX.GetPlayerData().job and ESX.GetPlayerData().job.name == 'ambulance' then
if ESX.PlayerData.job and ESX.PlayerData.job.name == 'ambulance' then
local playerCoords = GetEntityCoords(PlayerPedId())
local isInMarker, hasExited = false, false
local currentHospital, currentPart, currentPartNum
@@ -373,7 +373,7 @@ CreateThread(function()
end)
RegisterCommand("ambulance", function(src)
if ESX.GetPlayerData().job and ESX.GetPlayerData().job.name == 'ambulance' and not ESX.GetPlayerData().dead then
if ESX.PlayerData.job and ESX.PlayerData.job.name == 'ambulance' and not ESX.PlayerData.dead then
OpenMobileAmbulanceActionsMenu()
end
end)
+2 -2
View File
@@ -78,13 +78,13 @@ end
-- Key Controls
RegisterCommand('animmenu', function()
if not ESX.GetPlayerData().dead then
if not ESX.PlayerData.dead then
OpenAnimationsMenu()
end
end, false)
RegisterCommand('cleartasks', function()
if not ESX.GetPlayerData().dead then
if not ESX.PlayerData.dead then
ClearPedTasks(PlayerPedId())
end
end, false)
+3 -3
View File
@@ -253,7 +253,7 @@ function OpenPropertyMenu(property)
menu.close()
if data.current.value == 'enter' then
TriggerEvent('instance:create', 'property', {property = property.name, owner = ESX.GetPlayerData().identifier})
TriggerEvent('instance:create', 'property', {property = property.name, owner = ESX.PlayerData.identifier})
elseif data.current.value == 'leave' then
TriggerServerEvent('esx_property:removeOwnedProperty', property.name)
elseif data.current.value == 'buy' then
@@ -329,7 +329,7 @@ function OpenGatewayOwnedPropertiesMenu(property)
menu2.close()
if data2.current.value == 'enter' then
TriggerEvent('instance:create', 'property', {property = data.current.value, owner = ESX.GetPlayerData().identifier})
TriggerEvent('instance:create', 'property', {property = data.current.value, owner = ESX.PlayerData.identifier})
ESX.UI.Menu.CloseAll()
elseif data2.current.value == 'leave' then
TriggerServerEvent('esx_property:removeOwnedProperty', data.current.value)
@@ -690,7 +690,7 @@ AddEventHandler('esx:onPlayerSpawn', function()
end
end
TriggerEvent('instance:create', 'property', {property = propertyName, owner = ESX.GetPlayerData().identifier})
TriggerEvent('instance:create', 'property', {property = propertyName, owner = ESX.PlayerData.identifier})
end
end
end)
+2 -2
View File
@@ -720,7 +720,7 @@ CreateThread(function()
while true do
Wait(0)
if CurrentAction and not ESX.GetPlayerData().dead then
if CurrentAction and not ESX.PlayerData.dead then
ESX.ShowHelpNotification(CurrentActionMsg)
if IsControlJustReleased(0, 38) and ESX.PlayerData.job and ESX.PlayerData.job.name == 'taxi' then
@@ -740,7 +740,7 @@ CreateThread(function()
end
end)
RegisterCommand('taximenu', function()
if not ESX.GetPlayerData().dead and Config.EnablePlayerManagement and ESX.PlayerData.job and ESX.PlayerData.job.name == 'taxi' then
if not ESX.PlayerData.dead and Config.EnablePlayerManagement and ESX.PlayerData.job and ESX.PlayerData.job.name == 'taxi' then
OpenMobileTaxiActionsMenu()
end
end, false)