mirror of
https://github.com/esx-framework/esx_core.git
synced 2026-08-29 17:28:53 +00:00
unused loop variable 'k' fixes
This commit is contained in:
@@ -482,7 +482,7 @@ end
|
||||
function ESX.Game.GetPlayers(onlyOtherPlayers, returnKeyValue, returnPeds)
|
||||
local players, myPlayer = {}, PlayerId()
|
||||
|
||||
for k, player in ipairs(GetActivePlayers()) do
|
||||
for _, player in ipairs(GetActivePlayers()) do
|
||||
local ped = GetPlayerPed(player)
|
||||
|
||||
if DoesEntityExist(ped) and ((onlyOtherPlayers and player ~= myPlayer) or not onlyOtherPlayers) then
|
||||
@@ -560,7 +560,7 @@ function ESX.Game.GetClosestEntity(entities, isPlayerEntities, coords, modelFilt
|
||||
if modelFilter then
|
||||
filteredEntities = {}
|
||||
|
||||
for k, entity in pairs(entities) do
|
||||
for _, entity in pairs(entities) do
|
||||
if modelFilter[GetEntityModel(entity)] then
|
||||
filteredEntities[#filteredEntities + 1] = entity
|
||||
end
|
||||
@@ -1056,7 +1056,7 @@ function ESX.ShowInventory()
|
||||
end
|
||||
end
|
||||
|
||||
for k, v in ipairs(ESX.PlayerData.inventory) do
|
||||
for _, v in ipairs(ESX.PlayerData.inventory) do
|
||||
if v.count > 0 then
|
||||
currentWeight = currentWeight + (v.weight * v.count)
|
||||
|
||||
@@ -1073,7 +1073,7 @@ function ESX.ShowInventory()
|
||||
end
|
||||
end
|
||||
|
||||
for k, v in ipairs(Config.Weapons) do
|
||||
for _, v in ipairs(Config.Weapons) do
|
||||
local weaponHash = joaat(v.name)
|
||||
|
||||
if HasPedGotWeapon(playerPed, weaponHash, false) then
|
||||
@@ -1171,7 +1171,7 @@ function ESX.ShowInventory()
|
||||
{unselectable = true, icon = "fas fa-users", title = "Nearby Players"}
|
||||
}
|
||||
|
||||
for k, playerNearby in ipairs(playersNearby) do
|
||||
for _, playerNearby in ipairs(playersNearby) do
|
||||
players[GetPlayerServerId(playerNearby)] = true
|
||||
end
|
||||
|
||||
|
||||
@@ -218,7 +218,7 @@ AddEventHandler('esx:restoreLoadout', function()
|
||||
local ammoTypes = {}
|
||||
RemoveAllPedWeapons(ESX.PlayerData.ped, true)
|
||||
|
||||
for k, v in ipairs(ESX.PlayerData.loadout) do
|
||||
for _, v in ipairs(ESX.PlayerData.loadout) do
|
||||
local weaponName = v.name
|
||||
local weaponHash = joaat(weaponName)
|
||||
|
||||
@@ -377,7 +377,7 @@ if not Config.OxInventory then
|
||||
local pickupObject = CreateWeaponObject(weaponHash, 50, coords.x, coords.y, coords.z, true, 1.0, 0)
|
||||
SetWeaponObjectTintIndex(pickupObject, tintIndex)
|
||||
|
||||
for k, v in ipairs(components) do
|
||||
for _, v in ipairs(components) do
|
||||
local component = ESX.GetWeaponComponent(name, v)
|
||||
GiveWeaponComponentToWeaponObject(pickupObject, component.hash)
|
||||
end
|
||||
|
||||
@@ -13,7 +13,7 @@ end
|
||||
|
||||
function ESX.Table.Set(t)
|
||||
local set = {}
|
||||
for k,v in ipairs(t) do set[v] = true end
|
||||
for _,v in ipairs(t) do set[v] = true end
|
||||
return set
|
||||
end
|
||||
|
||||
|
||||
@@ -148,7 +148,7 @@ function CreateExtendedPlayer(playerId, identifier, group, accounts, inventory,
|
||||
if minimal then
|
||||
local minimalInventory = {}
|
||||
|
||||
for k, v in ipairs(self.inventory) do
|
||||
for _, v in ipairs(self.inventory) do
|
||||
if v.count > 0 then
|
||||
minimalInventory[v.name] = v.count
|
||||
end
|
||||
@@ -170,7 +170,7 @@ function CreateExtendedPlayer(playerId, identifier, group, accounts, inventory,
|
||||
end
|
||||
local minimalLoadout = {}
|
||||
|
||||
for k,v in ipairs(self.loadout) do
|
||||
for _,v in ipairs(self.loadout) do
|
||||
minimalLoadout[v.name] = {ammo = v.ammo}
|
||||
if v.tintIndex > 0 then minimalLoadout[v.name].tintIndex = v.tintIndex end
|
||||
|
||||
@@ -270,7 +270,7 @@ function CreateExtendedPlayer(playerId, identifier, group, accounts, inventory,
|
||||
end
|
||||
|
||||
function self.getInventoryItem(name, metadata)
|
||||
for k,v in ipairs(self.inventory) do
|
||||
for _,v in ipairs(self.inventory) do
|
||||
if v.name == name then
|
||||
return v
|
||||
end
|
||||
@@ -531,7 +531,7 @@ function CreateExtendedPlayer(playerId, identifier, group, accounts, inventory,
|
||||
local loadoutNum, weapon = self.getWeapon(weaponName)
|
||||
|
||||
if weapon then
|
||||
for k,v in ipairs(weapon.components) do
|
||||
for _,v in ipairs(weapon.components) do
|
||||
if v == weaponComponent then
|
||||
return true
|
||||
end
|
||||
@@ -544,7 +544,7 @@ function CreateExtendedPlayer(playerId, identifier, group, accounts, inventory,
|
||||
end
|
||||
|
||||
function self.hasWeapon(weaponName)
|
||||
for k,v in ipairs(self.loadout) do
|
||||
for _,v in ipairs(self.loadout) do
|
||||
if v.name == weaponName then
|
||||
return true
|
||||
end
|
||||
@@ -554,7 +554,7 @@ function CreateExtendedPlayer(playerId, identifier, group, accounts, inventory,
|
||||
end
|
||||
|
||||
function self.hasItem(item, metadata)
|
||||
for k,v in ipairs(self.inventory) do
|
||||
for _,v in ipairs(self.inventory) do
|
||||
if (v.name == item) and (v.count >= 1) then
|
||||
return v, v.count
|
||||
end
|
||||
|
||||
Reference in New Issue
Block a user