mirror of
https://github.com/esx-framework/esx_core.git
synced 2026-09-04 16:23:21 +00:00
fix: Correction to xPlayer loops
This commit is contained in:
@@ -148,10 +148,7 @@ elseif not Config.UseDeferrals then
|
||||
end
|
||||
|
||||
local xPlayers = ESX.GetExtendedPlayers()
|
||||
|
||||
for i=1, #xPlayers, 1 do
|
||||
local xPlayer = xPlayers[i]
|
||||
|
||||
for playerId, xPlayer in pairs(xPlayers)
|
||||
if xPlayer then
|
||||
checkIdentity(xPlayer)
|
||||
end
|
||||
|
||||
@@ -39,8 +39,7 @@ ESX.RegisterServerCallback('esx_bankerjob:getCustomers', function (source, cb)
|
||||
local xPlayers = ESX.GetExtendedPlayers()
|
||||
local customers = {}
|
||||
|
||||
for i=1, #xPlayers do
|
||||
local xPlayer = xPlayers[i]
|
||||
for playerId, xPlayer in pairs(xPlayers)
|
||||
|
||||
TriggerEvent('esx_addonaccount:getAccount', 'bank_savings', xPlayer.identifier, function(account)
|
||||
table.insert(customers, {
|
||||
|
||||
@@ -7,12 +7,10 @@ AddEventHandler('esx_holdup:tooFar', function(currentStore)
|
||||
local xPlayers = ESX.GetExtendedPlayers()
|
||||
rob = false
|
||||
|
||||
for i=1, #xPlayers, 1 do
|
||||
local xPlayer = xPlayers[i]
|
||||
|
||||
for playerId, xPlayer in pairs(xPlayers)
|
||||
if xPlayer.job.name == 'police' then
|
||||
TriggerClientEvent('esx:showNotification', xPlayers[i], _U('robbery_cancelled_at', Stores[currentStore].nameOfStore))
|
||||
TriggerClientEvent('esx_holdup:killBlip', xPlayers[i])
|
||||
TriggerClientEvent('esx:showNotification', playerId, _U('robbery_cancelled_at', Stores[currentStore].nameOfStore))
|
||||
TriggerClientEvent('esx_holdup:killBlip', playerId)
|
||||
end
|
||||
end
|
||||
|
||||
@@ -38,8 +36,7 @@ AddEventHandler('esx_holdup:robberyStarted', function(currentStore)
|
||||
end
|
||||
|
||||
local cops = 0
|
||||
for i=1, #xPlayers, 1 do
|
||||
local xPlayer = xPlayers[i]
|
||||
for playerId, xPlayer in pairs(xPlayers)
|
||||
if xPlayer.job.name == 'police' then
|
||||
cops = cops + 1
|
||||
end
|
||||
@@ -49,11 +46,10 @@ AddEventHandler('esx_holdup:robberyStarted', function(currentStore)
|
||||
if cops >= Config.PoliceNumberRequired then
|
||||
rob = true
|
||||
|
||||
for i=1, #xPlayers, 1 do
|
||||
local xPlayer = xPlayers[i]
|
||||
for playerId, xPlayer in pairs(xPlayers)
|
||||
if xPlayer.job.name == 'police' then
|
||||
TriggerClientEvent('esx:showNotification', xPlayers[i], _U('rob_in_prog', store.nameOfStore))
|
||||
TriggerClientEvent('esx_holdup:setBlip', xPlayers[i], Stores[currentStore].position)
|
||||
TriggerClientEvent('esx:showNotification', playerId, _U('rob_in_prog', store.nameOfStore))
|
||||
TriggerClientEvent('esx_holdup:setBlip', playerId, Stores[currentStore].position)
|
||||
end
|
||||
end
|
||||
|
||||
@@ -78,13 +74,11 @@ AddEventHandler('esx_holdup:robberyStarted', function(currentStore)
|
||||
xPlayer.addMoney(store.reward)
|
||||
end
|
||||
|
||||
local xPlayers, xPlayer = ESX.GetExtendedPlayers(), nil
|
||||
for i=1, #xPlayers, 1 do
|
||||
xPlayer = xPlayers[i]
|
||||
|
||||
local xPlayers = ESX.GetExtendedPlayers()
|
||||
for playerId, xPlayer in pairs(xPlayers)
|
||||
if xPlayer.job.name == 'police' then
|
||||
TriggerClientEvent('esx:showNotification', xPlayers[i], _U('robbery_complete_at', store.nameOfStore))
|
||||
TriggerClientEvent('esx_holdup:killBlip', xPlayers[i])
|
||||
TriggerClientEvent('esx:showNotification', playerId, _U('robbery_complete_at', store.nameOfStore))
|
||||
TriggerClientEvent('esx_holdup:killBlip', playerId)
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
@@ -5,8 +5,8 @@ AddEventHandler('onResourceStart', function(resource)
|
||||
if resource == GetCurrentResourceName() then
|
||||
local xPlayers = ESX.GetExtendedPlayers()
|
||||
|
||||
for i=1, #xPlayers, 1 do
|
||||
LoadPlayer(xPlayers[i])
|
||||
for k, v in pairs(xPlayers) do
|
||||
LoadPlayer(v)
|
||||
end
|
||||
end
|
||||
end)
|
||||
|
||||
Reference in New Issue
Block a user