mirror of
https://github.com/gmod-integration/lua.git
synced 2025-03-15 22:07:34 +00:00
refactor: in ipairs(player.GetAll())
This commit is contained in:
parent
e3d95296b2
commit
39b857c1f3
|
@ -215,7 +215,7 @@ function gmInte.openConfigMenu(data)
|
||||||
configList:EnableVerticalScrollbar(false)
|
configList:EnableVerticalScrollbar(false)
|
||||||
collapsibleCategory:SetContents(configList)
|
collapsibleCategory:SetContents(configList)
|
||||||
local categoryConfig = {}
|
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
|
if v.category == catName then table.insert(categoryConfig, v) end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
|
@ -90,7 +90,7 @@ end
|
||||||
|
|
||||||
hook.Add("gmInte:PlayerReady", "gmInte:Player:Ready", function(ply) gmInte.playerReady(ply) end)
|
hook.Add("gmInte:PlayerReady", "gmInte:Player:Ready", function(ply) gmInte.playerReady(ply) end)
|
||||||
hook.Add("ShutDown", "gmInte:Server:Shutdown:SavePlayers", function()
|
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)
|
gmInte.playerDisconnected(ply)
|
||||||
end
|
end
|
||||||
end)
|
end)
|
||||||
|
|
|
@ -14,7 +14,7 @@ function gmInte.saveSetting(setting, value)
|
||||||
gmInte.log("Setting Saved")
|
gmInte.log("Setting Saved")
|
||||||
if value == "websocketFQDN" || value == "id" || value == "token" then gmInte.resetWebSocket() end
|
if value == "websocketFQDN" || value == "id" || value == "token" then gmInte.resetWebSocket() end
|
||||||
// send to all players the new public config
|
// 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
|
if ply:IsValid() && ply:IsPlayer(ply) then
|
||||||
gmInte.log("Sending new Public Config to " .. ply:Nick(), true)
|
gmInte.log("Sending new Public Config to " .. ply:Nick(), true)
|
||||||
gmInte.publicGetConfig(ply)
|
gmInte.publicGetConfig(ply)
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
function gmInte.wsSyncBan(data)
|
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
|
if ply:SteamID64() == data.steam then ply:Kick(data.reason || "You have been banned from the server.") end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
function gmInte.wsSyncKick(data)
|
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
|
if ply:SteamID64() == data.steam then ply:Kick(data.reason || "You have been banned from the server.") end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
|
@ -72,7 +72,7 @@ end)
|
||||||
// For those who refuse to use CAMI (bro, WTF), routine scan
|
// For those who refuse to use CAMI (bro, WTF), routine scan
|
||||||
local lastScan = {}
|
local lastScan = {}
|
||||||
timer.Create("gmInte:SyncRoles:PlayerScan", 3, 0, function()
|
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
|
if lastScan[v:SteamID64()] == v:GetUserGroup() then continue end
|
||||||
gmInte.playerChangeGroup(v:SteamID64(), lastScan[v:SteamID64()], v:GetUserGroup())
|
gmInte.playerChangeGroup(v:SteamID64(), lastScan[v:SteamID64()], v:GetUserGroup())
|
||||||
lastScan[v:SteamID64()] = v:GetUserGroup()
|
lastScan[v:SteamID64()] = v:GetUserGroup()
|
||||||
|
|
|
@ -19,7 +19,7 @@ end
|
||||||
|
|
||||||
function gmInte.getPlayersFormat()
|
function gmInte.getPlayersFormat()
|
||||||
local players = {}
|
local players = {}
|
||||||
for k, v in pairs(player.GetAll()) do
|
for k, v in ipairs(player.GetAll()) do
|
||||||
table.insert(players, gmInte.getPlayerFormat(v))
|
table.insert(players, gmInte.getPlayerFormat(v))
|
||||||
end
|
end
|
||||||
return players
|
return players
|
||||||
|
|
Loading…
Reference in New Issue
Block a user