Skip to content

Commit

Permalink
fix admin panel and get rid of last steamid references
Browse files Browse the repository at this point in the history
  • Loading branch information
GlorifiedPig committed Dec 30, 2020
1 parent 3151607 commit 31dea26
Show file tree
Hide file tree
Showing 4 changed files with 8 additions and 10 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -26,12 +26,12 @@ function GlorifiedBanking.LogDeposit( ply, depositAmount )
end

function GlorifiedBanking.LogTransfer( ply, receiver, transferAmount )
GlorifiedBanking.SQL.Query( "INSERT INTO `gb_logs`( `Date`, `Type`, `SteamID`, `ReceiverSteamID`, `Amount` ) VALUES ( " .. os.time() .. ", 'Transfer', '" .. ply:SteamID64() .. "', '" .. receiver:SteamID() .. "', " .. transferAmount .. " )" )
GlorifiedBanking.SQL.Query( "INSERT INTO `gb_logs`( `Date`, `Type`, `SteamID`, `ReceiverSteamID`, `Amount` ) VALUES ( " .. os.time() .. ", 'Transfer', '" .. ply:SteamID64() .. "', '" .. receiver:SteamID64() .. "', " .. transferAmount .. " )" )
table.insert( GlorifiedBanking.Logs, {
["Date"] = os.time(),
["Type"] = "Transfer",
["SteamID"] = ply:SteamID64(),
["ReceiverSteamID"] = receiver:SteamID(),
["ReceiverSteamID"] = receiver:SteamID64(),
["Amount"] = transferAmount
} )
end
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -244,7 +244,7 @@ net.Receive( "GlorifiedBanking.AdminPanel.PlayerListOpened", function( len, ply
if GlorifiedBanking.HasPermission( ply, "glorifiedbanking_openadminpanel" ) then
local playerList = {}
for k, v in ipairs( player.GetAll() ) do
playerList[ v:SteamID() ] = GlorifiedBanking.GetPlayerBalance( v )
playerList[v:UserID()] = GlorifiedBanking.GetPlayerBalance( v )
end

net.Start( "GlorifiedBanking.AdminPanel.PlayerListOpened.SendInfo" )
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ function PANEL:AddPlayer(ply, balance)
if IsValid(GlorifiedBanking.UI.BalancePopup) then return end

GlorifiedBanking.UI.BalancePopup = vgui.Create("GlorifiedBanking.BalancePopup")
GlorifiedBanking.UI.BalancePopup.SteamID = self.Player:SteamID()
GlorifiedBanking.UI.BalancePopup.SteamID = self.Player:SteamID64()
end

self.ResetBalance = vgui.Create("DButton", self)
Expand All @@ -38,7 +38,7 @@ function PANEL:AddPlayer(ply, balance)
if IsValid(GlorifiedBanking.UI.ConfirmationPopup) then return end

GlorifiedBanking.UI.ConfirmationPopup = vgui.Create("GlorifiedBanking.ConfirmationPopup")
GlorifiedBanking.UI.ConfirmationPopup.SteamID = self.Player:SteamID()
GlorifiedBanking.UI.ConfirmationPopup.SteamID = self.Player:SteamID64()
end

self.ViewTransactions = vgui.Create("DButton", self)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -52,17 +52,15 @@ end
vgui.Register("GlorifiedBanking.Players", PANEL, "Panel")

net.Receive("GlorifiedBanking.AdminPanel.PlayerListOpened.SendInfo", function()
local playersBals = util.JSONToTable(net.ReadLargeString())
local playersBals = net.ReadTableAsString()
if not playersBals then return end

local panel = GlorifiedBanking.UI.AdminMenu.Page
if not panel.ResetPlayers then return end

local players = player.GetAll()

panel:ResetPlayers()

for k,v in ipairs(players) do
panel:AddPlayer(v, playersBals[v:SteamID()] or -1)
for k, v in ipairs(player.GetAll()) do
panel:AddPlayer( v, playersBals[v:UserID()] or -1 )
end
end)

0 comments on commit 31dea26

Please sign in to comment.