refactor: in ipairs(player.GetAll())

This commit is contained in:
Linventif 2024-08-09 17:53:58 +00:00
parent e3d95296b2
commit 39b857c1f3
7 changed files with 7 additions and 7 deletions

View File

@ -215,7 +215,7 @@ function gmInte.openConfigMenu(data)
configList:EnableVerticalScrollbar(false)
collapsibleCategory:SetContents(configList)
local categoryConfig = {}
for k, v in pairs(possibleConfig) do
for k, v in ipairs(possibleConfig) do
if v.category == catName then table.insert(categoryConfig, v) end
end

View File

@ -90,7 +90,7 @@ end
hook.Add("gmInte:PlayerReady", "gmInte:Player:Ready", function(ply) gmInte.playerReady(ply) end)
hook.Add("ShutDown", "gmInte:Server:Shutdown:SavePlayers", function()
for _, ply in pairs(player.GetAll()) do
for _, ply in ipairs(player.GetAll()) do
gmInte.playerDisconnected(ply)
end
end)

View File

@ -14,7 +14,7 @@ function gmInte.saveSetting(setting, value)
gmInte.log("Setting Saved")
if value == "websocketFQDN" || value == "id" || value == "token" then gmInte.resetWebSocket() end
// send to all players the new public config
for _, ply in pairs(player.GetAll()) do
for _, ply in ipairs(player.GetAll()) do
if ply:IsValid() && ply:IsPlayer(ply) then
gmInte.log("Sending new Public Config to " .. ply:Nick(), true)
gmInte.publicGetConfig(ply)

View File

@ -1,5 +1,5 @@
function gmInte.wsSyncBan(data)
for _, ply in pairs(player.GetAll()) do
for _, ply in ipairs(player.GetAll()) do
if ply:SteamID64() == data.steam then ply:Kick(data.reason || "You have been banned from the server.") end
end
end

View File

@ -1,5 +1,5 @@
function gmInte.wsSyncKick(data)
for _, ply in pairs(player.GetAll()) do
for _, ply in ipairs(player.GetAll()) do
if ply:SteamID64() == data.steam then ply:Kick(data.reason || "You have been banned from the server.") end
end
end

View File

@ -72,7 +72,7 @@ end)
// For those who refuse to use CAMI (bro, WTF), routine scan
local lastScan = {}
timer.Create("gmInte:SyncRoles:PlayerScan", 3, 0, function()
for k, v in pairs(player.GetAll()) do
for k, v in ipairs(player.GetAll()) do
if lastScan[v:SteamID64()] == v:GetUserGroup() then continue end
gmInte.playerChangeGroup(v:SteamID64(), lastScan[v:SteamID64()], v:GetUserGroup())
lastScan[v:SteamID64()] = v:GetUserGroup()

View File

@ -19,7 +19,7 @@ end
function gmInte.getPlayersFormat()
local players = {}
for k, v in pairs(player.GetAll()) do
for k, v in ipairs(player.GetAll()) do
table.insert(players, gmInte.getPlayerFormat(v))
end
return players