Commit a6bf54d2 authored by Jonah's avatar Jonah

added code for ui section

parent fb79fbf2
......@@ -182,3 +182,34 @@ function pb_updateban(steamid, ply, bantime, reason, name)
pbSQLQuery(query, qTab)
XGUIRefreshBans()
end
--UI Section
local function UpdateBanList(result, qTab)
local tempTable = {}
for k,v in pairs(result) do
tempTable[v.authid] = {}
tempTable[v.authid].bid = v.bid
tempTable[v.authid].sid = tonumber(v.sid) > 0 and v.sid or "Web"
tempTable[v.authid].admin = v.admin
tempTable[v.authid].adminid = v.aid
tempTable[v.authid].name = v.name
tempTable[v.authid].reason = v.reason
tempTable[v.authid].steamID = v.authid
tempTable[v.authid].time = v.created
tempTable[v.authid].unban = v.created == v.ends and 0 or v.ends
end
pbTable = tempTable
end
function pbRetrieveBans()
local qTab = {}
qTab.cb = function(result, qTab) UpdateBanList(result, qTab) end
if not banRetrieveLimit or type(banRetrieveLimit) ~= number then
banRetrieveLimit = 150
end
pbSQLQuery("SELECT a.user as admin, b.aid, b.bid, b.sid, b.name, b.reason, b.authid, b.created, b.ends FROM " ..db_prefix.. "bans b INNER JOIN " ..db_prefix.. "admins a ON b.aid = a.aid WHERE b.RemoveType is null ORDER BY b.created DESC LIMIT "..menuLimit, qTab)
end
hook.Add("InitPostEntity", "LoadPropBans", pbRetrieveBans)
timer.Create("UpdatePBListPls", pbRefreshTime, 0, pbRetrieveBans)
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment