mirror of
https://github.com/gmod-integration/lua.git
synced 2025-03-15 22:07:34 +00:00
fix: fuck some shit with ipairs
This commit is contained in:
parent
466e3cad4e
commit
5984ab5013
|
@ -201,7 +201,7 @@ function gmInte.openConfigMenu(data)
|
|||
messageLabel:Dock(FILL)
|
||||
messageLabel:SetText("Here you can configure your server settings.\nServer ID and Token are available on the webpanel in the server settings.\nThe documentation is available at https://docs.gmod-integration.com/\nIf you need help, please contact us on our discord server.")
|
||||
messageLabel:SetWrap(true)
|
||||
for k, catName in ipairs(configCat) do
|
||||
for k, catName in pairs(configCat) do
|
||||
local collapsibleCategory = vgui.Create("DCollapsibleCategory", scrollPanel)
|
||||
collapsibleCategory:Dock(TOP)
|
||||
collapsibleCategory:DockMargin(10, 0, 10, 10)
|
||||
|
@ -215,13 +215,13 @@ function gmInte.openConfigMenu(data)
|
|||
configList:EnableVerticalScrollbar(false)
|
||||
collapsibleCategory:SetContents(configList)
|
||||
local categoryConfig = {}
|
||||
for k, v in ipairs(possibleConfig) do
|
||||
for k, v in pairs(possibleConfig) do
|
||||
if v.category == catName then table.insert(categoryConfig, v) end
|
||||
end
|
||||
|
||||
// Sort by position
|
||||
table.sort(categoryConfig, function(a, b) return (a.position || 0) < (b.position || 0) end)
|
||||
for k, actualConfig in ipairs(categoryConfig) do
|
||||
for k, actualConfig in pairs(categoryConfig) do
|
||||
local panel = vgui.Create("DPanel", configList)
|
||||
panel:Dock(TOP)
|
||||
panel:SetSize(300, 25)
|
||||
|
@ -245,7 +245,6 @@ function gmInte.openConfigMenu(data)
|
|||
input.OnLoseFocus = function(self) if actualConfig.secret then self:SetText("*** Click to show ***") end end
|
||||
local isLastID = 0
|
||||
input.OnChange = function(self)
|
||||
value = self:GetValue()
|
||||
if actualConfig.resetIfEmpty && self:GetValue() == "" && actualConfig.defaultValue then
|
||||
self:SetText(actualConfig.defaultValue)
|
||||
return
|
||||
|
@ -286,7 +285,7 @@ function gmInte.openConfigMenu(data)
|
|||
buttonGrid:SetColWide(frame:GetWide() / 2 - 5)
|
||||
buttonGrid:SetRowHeight(45)
|
||||
local buttonsCount = 0
|
||||
for k, v in ipairs(buttonsInfo) do
|
||||
for k, v in pairs(buttonsInfo) do
|
||||
if v.condition && !v.condition(data) then continue end
|
||||
local button = vgui.Create("DButton")
|
||||
button:SetText(v.label)
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
function gmInte.chatAddText(data)
|
||||
local args = {}
|
||||
for _, v in ipairs(data) do
|
||||
for _, v in pairs(data) do
|
||||
table.insert(args, v.color)
|
||||
table.insert(args, v.text)
|
||||
end
|
||||
|
|
|
@ -22,13 +22,13 @@ function gmInte.createImgurMaterials(materials, addon_var, folder, name)
|
|||
end)
|
||||
end
|
||||
|
||||
for k, v in ipairs(materials) do
|
||||
for k, v in pairs(materials) do
|
||||
getMatFromUrl("https://i.imgur.com/" .. v .. ".png", k)
|
||||
end
|
||||
end
|
||||
|
||||
function gmInte.redowloadMaterials()
|
||||
for k, v in ipairs(ImageCache) do
|
||||
for k, v in pairs(ImageCache) do
|
||||
v.addon_var[v.id] = Material("../data/" .. v.folder .. "/" .. v.id .. ".png", "noclamp smooth")
|
||||
gmInte.log("materials", v.name .. " - Image Redownloaded - " .. v.id .. ".png")
|
||||
end
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
local function websocketDLLExist()
|
||||
local files, _ = file.Find("lua/bin/*", "GAME")
|
||||
for k, v in ipairs(files) do
|
||||
for k, v in pairs(files) do
|
||||
if v:find("gwsockets") then return true end
|
||||
end
|
||||
return false
|
||||
|
|
|
@ -6,7 +6,7 @@ local conFuncs = {
|
|||
["get-server-id"] = function() print(gmInte.config.id || "none") end,
|
||||
["screenshot"] = function(args)
|
||||
if !args[2] then return gmInte.log("No SteamID64 provided") end
|
||||
for _, ply in ipairs(player.GetAll()) do
|
||||
for _, ply in pairs(player.GetAll()) do
|
||||
if ply:SteamID64() == args[2] then return gmInte.takeScreenshot(ply) end
|
||||
end
|
||||
end,
|
||||
|
|
|
@ -12,7 +12,7 @@ local function filterMessage(reason)
|
|||
"Service provided by Gmod Integration",
|
||||
}
|
||||
|
||||
for k, v in ipairs(Message) do
|
||||
for k, v in pairs(Message) do
|
||||
Message[k] = "\n" .. v
|
||||
end
|
||||
return table.concat(Message)
|
||||
|
|
|
@ -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, ply in ipairs(player.GetAll()) do
|
||||
for _, ply in pairs(player.GetAll()) do
|
||||
gmInte.playerDisconnected(ply)
|
||||
end
|
||||
end)
|
||||
|
|
|
@ -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 ipairs(player.GetAll()) do
|
||||
for _, ply in pairs(player.GetAll()) do
|
||||
if ply:IsValid() && ply:IsPlayer(ply) then
|
||||
gmInte.log("Sending new Public Config to " .. ply:Nick(), true)
|
||||
gmInte.publicGetConfig(ply)
|
||||
|
@ -66,7 +66,7 @@ end
|
|||
|
||||
function gmInte.superadminSetConfig(ply, data)
|
||||
if !ply:IsValid() || !ply:IsPlayer(ply) || !ply:IsSuperAdmin() then return end
|
||||
for k, v in ipairs(data) do
|
||||
for k, v in pairs(data) do
|
||||
gmInte.saveSetting(k, v)
|
||||
end
|
||||
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
function gmInte.wsSyncBan(data)
|
||||
for _, ply in ipairs(player.GetAll()) do
|
||||
for _, ply in pairs(player.GetAll()) do
|
||||
if ply:SteamID64() == data.steam then ply:Kick(data.reason || "You have been banned from the server.") end
|
||||
end
|
||||
end
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
function gmInte.wsSyncKick(data)
|
||||
for _, ply in ipairs(player.GetAll()) do
|
||||
for _, ply in pairs(player.GetAll()) do
|
||||
if ply:SteamID64() == data.steam then ply:Kick(data.reason || "You have been banned from the server.") end
|
||||
end
|
||||
end
|
||||
|
|
|
@ -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 ipairs(player.GetAll()) do
|
||||
for k, v in pairs(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()
|
||||
|
|
|
@ -19,7 +19,7 @@ end
|
|||
|
||||
function gmInte.getPlayersFormat()
|
||||
local players = {}
|
||||
for k, v in ipairs(player.GetAll()) do
|
||||
for k, v in pairs(player.GetAll()) do
|
||||
table.insert(players, gmInte.getPlayerFormat(v))
|
||||
end
|
||||
return players
|
||||
|
|
|
@ -39,13 +39,13 @@ end
|
|||
local function getCustomValues(ply)
|
||||
local values = {}
|
||||
// Get compatability values
|
||||
for key, value in ipairs(getCustomCompatability(ply)) do
|
||||
for key, value in pairs(getCustomCompatability(ply)) do
|
||||
values[key] = value
|
||||
end
|
||||
|
||||
// Get custom values or overwrite compatability values
|
||||
if ply.gmIntCustomValues then
|
||||
for key, value in ipairs(ply.gmIntCustomValues) do
|
||||
for key, value in pairs(ply.gmIntCustomValues) do
|
||||
values[key] = value
|
||||
end
|
||||
end
|
||||
|
|
Loading…
Reference in New Issue
Block a user