diff --git a/gamemode/config/sh_config.lua b/gamemode/config/sh_config.lua index 6816d69cc..c377e5157 100644 --- a/gamemode/config/sh_config.lua +++ b/gamemode/config/sh_config.lua @@ -96,7 +96,7 @@ ix.config.Add("saveInterval", 300, "How often characters save in seconds.", nil, category = "characters" }) ix.config.Add("walkSpeed", 130, "How fast a player normally walks.", function(oldValue, newValue) - for _, v in ipairs(player.GetAll()) do + for _, v in player.Iterator() do v:SetWalkSpeed(newValue) end end, { @@ -104,7 +104,7 @@ end, { category = "characters" }) ix.config.Add("runSpeed", 235, "How fast a player normally runs.", function(oldValue, newValue) - for _, v in ipairs(player.GetAll()) do + for _, v in player.Iterator() do v:SetRunSpeed(newValue) end end, { diff --git a/gamemode/core/hooks/sv_hooks.lua b/gamemode/core/hooks/sv_hooks.lua index 1572eb34e..c7dc232ee 100644 --- a/gamemode/core/hooks/sv_hooks.lua +++ b/gamemode/core/hooks/sv_hooks.lua @@ -71,7 +71,7 @@ function GM:PlayerInitialSpawn(client) client.ixLoaded = true client:SetData("intro", true) - for _, v in ipairs(player.GetAll()) do + for _, v in player.Iterator() do if (v:GetCharacter()) then v:GetCharacter():Sync(client) end @@ -451,7 +451,7 @@ local function CalcPlayerCanHearPlayersVoice(listener) listener.ixVoiceHear = listener.ixVoiceHear or {} local eyePos = listener:EyePos() - for _, speaker in ipairs(player.GetAll()) do + for _, speaker in player.Iterator() do local speakerEyePos = speaker:EyePos() listener.ixVoiceHear[speaker] = eyePos:DistToSqr(speakerEyePos) < voiceDistance end @@ -465,7 +465,7 @@ function GM:InitializedConfig() end function GM:VoiceToggled(bAllowVoice) - for _, v in ipairs(player.GetAll()) do + for _, v in player.Iterator() do local uniqueID = v:SteamID64() .. "ixCanHearPlayersVoice" if (bAllowVoice) then @@ -724,7 +724,7 @@ function GM:PlayerDisconnected(client) return end - for _, v in ipairs(player.GetAll()) do + for _, v in player.Iterator() do if (!v.ixVoiceHear) then continue end @@ -771,7 +771,7 @@ function GM:ShutDown() hook.Run("SaveData") - for _, v in ipairs(player.GetAll()) do + for _, v in player.Iterator() do v:SaveData() if (v:GetCharacter()) then @@ -877,7 +877,7 @@ function GM:CharacterPreSave(character) end timer.Create("ixLifeGuard", 1, 0, function() - for _, v in ipairs(player.GetAll()) do + for _, v in player.Iterator() do if (v:GetCharacter() and v:Alive() and hook.Run("ShouldPlayerDrowned", v) != false) then if (v:WaterLevel() >= 3) then if (!v.drowningTime) then diff --git a/gamemode/core/libs/sh_chatbox.lua b/gamemode/core/libs/sh_chatbox.lua index ebadff4ee..8edea49b6 100644 --- a/gamemode/core/libs/sh_chatbox.lua +++ b/gamemode/core/libs/sh_chatbox.lua @@ -318,7 +318,7 @@ if (SERVER) then if (class.CanHear and !receivers) then receivers = {} - for _, v in ipairs(player.GetAll()) do + for _, v in player.Iterator() do if (v:GetCharacter() and class:CanHear(speaker, v, data) != false) then receivers[#receivers + 1] = v end diff --git a/gamemode/core/libs/sh_class.lua b/gamemode/core/libs/sh_class.lua index 913e1d8be..93c5ea4c2 100644 --- a/gamemode/core/libs/sh_class.lua +++ b/gamemode/core/libs/sh_class.lua @@ -124,7 +124,7 @@ end function ix.class.GetPlayers(class) local players = {} - for _, v in ipairs(player.GetAll()) do + for _, v in player.Iterator() do local char = v:GetCharacter() if (char and char:GetClass() == class) then diff --git a/gamemode/core/meta/sh_character.lua b/gamemode/core/meta/sh_character.lua index 5928a222f..38b58ea40 100644 --- a/gamemode/core/meta/sh_character.lua +++ b/gamemode/core/meta/sh_character.lua @@ -100,7 +100,7 @@ if (SERVER) then function CHAR:Sync(receiver) -- Broadcast the character information if receiver is not set. if (receiver == nil) then - for _, v in ipairs(player.GetAll()) do + for _, v in player.Iterator() do self:Sync(v) end -- Send all character information if the receiver is the character's owner. @@ -250,7 +250,7 @@ function CHAR:GetPlayer() elseif (self.steamID) then local steamID = self.steamID - for _, v in ipairs(player.GetAll()) do + for _, v in player.Iterator() do if (v:SteamID64() == steamID) then self.player = v diff --git a/gamemode/core/meta/sh_entity.lua b/gamemode/core/meta/sh_entity.lua index 0e7e48591..31637dfbb 100644 --- a/gamemode/core/meta/sh_entity.lua +++ b/gamemode/core/meta/sh_entity.lua @@ -121,7 +121,7 @@ if (SERVER) then self.ignoreUse = false self.ixIsMuted = false - for _, v in ipairs(ents.GetAll()) do + for _, v in ents.Iterator() do if (v:GetParent() == self) then v:SetNotSolid(false) v:SetNoDraw(false) @@ -150,7 +150,7 @@ if (SERVER) then dummy:SetBodygroup(v.id, self:GetBodygroup(v.id)) end - for _, v in ipairs(ents.GetAll()) do + for _, v in ents.Iterator() do if (v:GetParent() == self) then v:SetNotSolid(true) v:SetNoDraw(true) diff --git a/gamemode/core/meta/sh_inventory.lua b/gamemode/core/meta/sh_inventory.lua index 9dcf9590c..c0613ddb7 100644 --- a/gamemode/core/meta/sh_inventory.lua +++ b/gamemode/core/meta/sh_inventory.lua @@ -150,7 +150,7 @@ end -- @treturn[1] Player Owning player -- @treturn[2] nil If no connected player owns this inventory function META:GetOwner() - for _, v in ipairs(player.GetAll()) do + for _, v in player.Iterator() do if (v:GetCharacter() and v:GetCharacter().id == self.owner) then return v end @@ -170,7 +170,7 @@ function META:SetOwner(owner, fullUpdate) if (SERVER) then if (fullUpdate) then - for _, v in ipairs(player.GetAll()) do + for _, v in player.Iterator() do if (v:GetNetVar("char") == owner) then self:Sync(v, true) diff --git a/gamemode/core/meta/sh_item.lua b/gamemode/core/meta/sh_item.lua index 767b7c44a..25e6df8af 100644 --- a/gamemode/core/meta/sh_item.lua +++ b/gamemode/core/meta/sh_item.lua @@ -305,7 +305,7 @@ function ITEM:GetOwner() local id = self:GetID() - for _, v in ipairs(player.GetAll()) do + for _, v in player.Iterator() do local character = v:GetCharacter() if (character and character:GetInventory():GetItemByID(id)) then diff --git a/gamemode/core/sh_commands.lua b/gamemode/core/sh_commands.lua index fe62f8840..9e09e3ddd 100644 --- a/gamemode/core/sh_commands.lua +++ b/gamemode/core/sh_commands.lua @@ -100,7 +100,7 @@ ix.command.Add("CharGiveFlag", { target:GiveFlags(flags) - for _, v in ipairs(player.GetAll()) do + for _, v in player.Iterator() do if (self:OnCheckAccess(v) or v == target:GetPlayer()) then v:NotifyLocalized("flagGive", client:GetName(), target:GetName(), flags) end @@ -125,7 +125,7 @@ ix.command.Add("CharTakeFlag", { target:TakeFlags(flags) - for _, v in ipairs(player.GetAll()) do + for _, v in player.Iterator() do if (self:OnCheckAccess(v) or v == target:GetPlayer()) then v:NotifyLocalized("flagTake", client:GetName(), flags, target:GetName()) end @@ -155,7 +155,7 @@ ix.command.Add("CharSetModel", { target:SetModel(model) target:GetPlayer():SetupHands() - for _, v in ipairs(player.GetAll()) do + for _, v in player.Iterator() do if (self:OnCheckAccess(v) or v == target:GetPlayer()) then v:NotifyLocalized("cChangeModel", client:GetName(), target:GetName(), model) end @@ -174,7 +174,7 @@ ix.command.Add("CharSetSkin", { target:SetData("skin", skin) target:GetPlayer():SetSkin(skin or 0) - for _, v in ipairs(player.GetAll()) do + for _, v in player.Iterator() do if (self:OnCheckAccess(v) or v == target:GetPlayer()) then v:NotifyLocalized("cChangeSkin", client:GetName(), target:GetName(), skin or 0) end @@ -267,7 +267,7 @@ ix.command.Add("CharSetName", { end, target:GetName()) end - for _, v in ipairs(player.GetAll()) do + for _, v in player.Iterator() do if (self:OnCheckAccess(v) or v == target:GetPlayer()) then v:NotifyLocalized("cChangeName", client:GetName(), target:GetName(), newName) end @@ -322,7 +322,7 @@ ix.command.Add("CharKick", { target:Kick() end) - for _, v in ipairs(player.GetAll()) do + for _, v in player.Iterator() do if (self:OnCheckAccess(v) or v == target:GetPlayer()) then v:NotifyLocalized("charKick", client:GetName(), target:GetName()) end @@ -346,7 +346,7 @@ ix.command.Add("CharBan", { target:Ban(minutes) target:Save() - for _, v in ipairs(player.GetAll()) do + for _, v in player.Iterator() do if (self:OnCheckAccess(v) or v == target:GetPlayer()) then v:NotifyLocalized("charBan", client:GetName(), target:GetName()) end @@ -372,7 +372,7 @@ ix.command.Add("CharUnban", { return "@charNotBanned" end - for _, v2 in ipairs(player.GetAll()) do + for _, v2 in player.Iterator() do if (self:OnCheckAccess(v2) or v2 == v:GetPlayer()) then v2:NotifyLocalized("charUnBan", client:GetName(), v:GetName()) end @@ -409,7 +409,7 @@ ix.command.Add("CharUnban", { updateQuery:Where("id", characterID) updateQuery:Execute() - for _, v in ipairs(player.GetAll()) do + for _, v in player.Iterator() do if (self:OnCheckAccess(v)) then v:NotifyLocalized("charUnBan", client:GetName(), name) end @@ -529,7 +529,7 @@ ix.command.Add("PlyWhitelist", { if (faction) then if (target:SetWhitelisted(faction.index, true)) then - for _, v in ipairs(player.GetAll()) do + for _, v in player.Iterator() do if (self:OnCheckAccess(v) or v == target) then v:NotifyLocalized("whitelist", client:GetName(), target:GetName(), L(faction.name, v)) end @@ -590,7 +590,7 @@ ix.command.Add("PlyUnwhitelist", { local targetPlayer = ix.util.FindPlayer(target) if (IsValid(targetPlayer) and targetPlayer:SetWhitelisted(faction.index, false)) then - for _, v in ipairs(player.GetAll()) do + for _, v in player.Iterator() do if (self:OnCheckAccess(v) or v == targetPlayer) then v:NotifyLocalized("unwhitelist", client:GetName(), targetPlayer:GetName(), L(faction.name, v)) end @@ -617,7 +617,7 @@ ix.command.Add("PlyUnwhitelist", { updateQuery:Where("steamid", steamID64) updateQuery:Execute() - for _, v in ipairs(player.GetAll()) do + for _, v in player.Iterator() do if (self:OnCheckAccess(v)) then v:NotifyLocalized("unwhitelist", client:GetName(), target, L(faction.name, v)) end @@ -739,7 +739,7 @@ ix.command.Add("PlyTransfer", { faction:OnTransferred(target) end - for _, v in ipairs(player.GetAll()) do + for _, v in player.Iterator() do if (self:OnCheckAccess(v) or v == target:GetPlayer()) then v:NotifyLocalized("cChangeFaction", client:GetName(), target:GetName(), L(faction.name, v)) end diff --git a/gamemode/core/sh_util.lua b/gamemode/core/sh_util.lua index 6f436dc6e..87f583ef0 100644 --- a/gamemode/core/sh_util.lua +++ b/gamemode/core/sh_util.lua @@ -251,7 +251,7 @@ function ix.util.FindPlayer(identifier, bAllowPatterns) identifier = string.PatternSafe(identifier) end - for _, v in ipairs(player.GetAll()) do + for _, v in player.Iterator() do if (ix.util.StringMatches(v:Name(), identifier)) then return v end diff --git a/plugins/area/sv_hooks.lua b/plugins/area/sv_hooks.lua index df81a4d67..33197d59e 100644 --- a/plugins/area/sv_hooks.lua +++ b/plugins/area/sv_hooks.lua @@ -38,7 +38,7 @@ function PLUGIN:PlayerSpawn(client) end function PLUGIN:AreaThink() - for _, client in ipairs(player.GetAll()) do + for _, client in player.Iterator() do local character = client:GetCharacter() if (!client:Alive() or !character) then diff --git a/plugins/doors/derma/cl_door.lua b/plugins/doors/derma/cl_door.lua index b30fc70ad..81f063e49 100644 --- a/plugins/doors/derma/cl_door.lua +++ b/plugins/doors/derma/cl_door.lua @@ -48,7 +48,7 @@ function PANEL:SetDoor(door, access, door2) self.accessData = access self.door = door - for _, v in ipairs(player.GetAll()) do + for _, v in player.Iterator() do if (v != LocalPlayer() and v:GetCharacter()) then self.access:AddLine(v:Name(), L(ACCESS_LABELS[access[v] or 0])).player = v end diff --git a/plugins/doors/sv_plugin.lua b/plugins/doors/sv_plugin.lua index 210a4ad80..4c193b400 100644 --- a/plugins/doors/sv_plugin.lua +++ b/plugins/doors/sv_plugin.lua @@ -107,7 +107,7 @@ function PLUGIN:SaveDoorData() local data = {} local doors = {} - for _, v in ipairs(ents.GetAll()) do + for _, v in ents.Iterator() do if (v:IsDoor()) then doors[v:MapCreationID()] = v end diff --git a/plugins/observer.lua b/plugins/observer.lua index 84fc2aa94..628e41024 100644 --- a/plugins/observer.lua +++ b/plugins/observer.lua @@ -35,7 +35,7 @@ if (CLIENT) then !client:InVehicle() and CAMI.PlayerHasAccess(client, "Helix - Observer", nil)) then local scrW, scrH = ScrW(), ScrH() - for _, v in ipairs(player.GetAll()) do + for _, v in player.Iterator() do if (v == client or !v:GetCharacter() or client:GetAimVector():Dot((v:GetPos() - client:GetPos()):GetNormal()) < 0.65) then continue end diff --git a/plugins/pac.lua b/plugins/pac.lua index 7185323c8..a7ac31dc5 100644 --- a/plugins/pac.lua +++ b/plugins/pac.lua @@ -207,7 +207,7 @@ else end if (IsValid(pac.LocalPlayer)) then - for _, v in ipairs(player.GetAll()) do + for _, v in player.Iterator() do local character = v:GetCharacter() if (character) then @@ -302,7 +302,7 @@ else end if (class:find("HL2MPRagdoll")) then - for _, v in ipairs(player.GetAll()) do + for _, v in player.Iterator() do if (v:GetRagdollEntity() == entity) then entity.objCache = v end diff --git a/plugins/recognition.lua b/plugins/recognition.lua index 441deb131..d29e7edb3 100644 --- a/plugins/recognition.lua +++ b/plugins/recognition.lua @@ -170,7 +170,7 @@ else class = ix.chat.classes[class] - for _, v in ipairs(player.GetAll()) do + for _, v in player.Iterator() do if (client != v and v:GetCharacter() and class:CanHear(client, v)) then targets[#targets + 1] = v end diff --git a/plugins/typing.lua b/plugins/typing.lua index 85fff867f..8a0402945 100644 --- a/plugins/typing.lua +++ b/plugins/typing.lua @@ -115,7 +115,7 @@ if (CLIENT) then local client = LocalPlayer() local position = client:GetPos() - for _, v in ipairs(player.GetAll()) do + for _, v in player.Iterator() do if (v == client) then continue end