mirror of
https://github.com/gmod-integration/lua.git
synced 2025-04-29 22:05:24 +00:00
feat: implement CH_ATM and DarkRP money logging functions
This commit is contained in:
parent
499c382066
commit
91e8b3d2ef
49
lua/gmod_integration/server/compatibility/chatm/sv_atm.lua
Normal file
49
lua/gmod_integration/server/compatibility/chatm/sv_atm.lua
Normal file
|
@ -0,0 +1,49 @@
|
||||||
|
function gmInte.postCHATMTakeMoney(ply, amount, reason)
|
||||||
|
if !ply:IsValid() || !ply:IsPlayer(ply) then return end
|
||||||
|
gmInte.http.postLog("/servers/:serverID/players/" .. ply:SteamID64() .. "/ch-atm/take-money", {
|
||||||
|
["player"] = gmInte.getPlayerFormat(ply),
|
||||||
|
["amount"] = math.Round(amount),
|
||||||
|
["reason"] = reason
|
||||||
|
})
|
||||||
|
end
|
||||||
|
|
||||||
|
function gmInte.postCHATMReceiveMoney(ply, amount, reason)
|
||||||
|
if !ply:IsValid() || !ply:IsPlayer(ply) then return end
|
||||||
|
gmInte.http.postLog("/servers/:serverID/players/" .. ply:SteamID64() .. "/ch-atm/receive-money", {
|
||||||
|
["player"] = gmInte.getPlayerFormat(ply),
|
||||||
|
["amount"] = math.Round(amount),
|
||||||
|
["reason"] = reason
|
||||||
|
})
|
||||||
|
end
|
||||||
|
|
||||||
|
function gmInte.postCHATMSendMoney(ply, amount, plyReceiver)
|
||||||
|
if !ply:IsValid() || !ply:IsPlayer(ply) then return end
|
||||||
|
if !plyReceiver:IsValid() || !plyReceiver:IsPlayer(plyReceiver) then return end
|
||||||
|
gmInte.http.postLog("/servers/:serverID/players/" .. ply:SteamID64() .. "/ch-atm/send-money", {
|
||||||
|
["player"] = gmInte.getPlayerFormat(ply),
|
||||||
|
["receiver"] = gmInte.getPlayerFormat(plyReceiver),
|
||||||
|
["amount"] = math.Round(amount)
|
||||||
|
})
|
||||||
|
end
|
||||||
|
|
||||||
|
function gmInte.postCHATMWithdrawMoney(ply, amount)
|
||||||
|
if !ply:IsValid() || !ply:IsPlayer(ply) then return end
|
||||||
|
gmInte.http.postLog("/servers/:serverID/players/" .. ply:SteamID64() .. "/ch-atm/withdraw-money", {
|
||||||
|
["player"] = gmInte.getPlayerFormat(ply),
|
||||||
|
["amount"] = math.Round(amount)
|
||||||
|
})
|
||||||
|
end
|
||||||
|
|
||||||
|
function gmInte.postCHATMDepositMoney(ply, amount)
|
||||||
|
if !ply:IsValid() || !ply:IsPlayer(ply) then return end
|
||||||
|
gmInte.http.postLog("/servers/:serverID/players/" .. ply:SteamID64() .. "/ch-atm/deposit-money", {
|
||||||
|
["player"] = gmInte.getPlayerFormat(ply),
|
||||||
|
["amount"] = math.Round(amount)
|
||||||
|
})
|
||||||
|
end
|
||||||
|
|
||||||
|
hook.Add("CH_ATM_bLogs_TakeMoney", "gmInte:Player:CH:ATM:TakeMoney", function(amount, ply, reason) gmInte.postCHATMTakeMoney(ply, amount, reason) end)
|
||||||
|
hook.Add("CH_ATM_bLogs_ReceiveMoney", "gmInte:Player:CH:ATM:ReceiveMoney", function(amount, ply, reason) gmInte.postCHATMReceiveMoney(ply, amount, reason) end)
|
||||||
|
hook.Add("CH_ATM_bLogs_SendMoney", "gmInte:Player:CH:ATM:SendMoney", function(ply, amount, plyReceiver) gmInte.postCHATMSendMoney(ply, amount, plyReceiver) end)
|
||||||
|
hook.Add("CH_ATM_bLogs_WithdrawMoney", "gmInte:Player:CH:ATM:WithdrawMoney", function(ply, amount) gmInte.postCHATMWithdrawMoney(ply, amount) end)
|
||||||
|
hook.Add("CH_ATM_bLogs_DepositMoney", "gmInte:Player:CH:ATM:DepositMoney", function(ply, amount) gmInte.postCHATMDepositMoney(ply, amount) end)
|
|
@ -0,0 +1,35 @@
|
||||||
|
function gmInte.postDarkRPDroppedMoney(ply, amount, entity)
|
||||||
|
if !ply:IsValid() || !ply:IsPlayer(ply) then return end
|
||||||
|
gmInte.http.postLog("/servers/:serverID/players/" .. ply:SteamID64() .. "/dark-rp/drop-money", {
|
||||||
|
["player"] = gmInte.getPlayerFormat(ply),
|
||||||
|
["amount"] = math.Round(amount),
|
||||||
|
["entity"] = gmInte.getEntityFormat(entity),
|
||||||
|
})
|
||||||
|
end
|
||||||
|
|
||||||
|
function gmInte.postDarkRPPickedUpMoney(ply, price, entity)
|
||||||
|
if !ply:IsValid() || !ply:IsPlayer(ply) then return end
|
||||||
|
gmInte.http.postLog("/servers/:serverID/players/" .. ply:SteamID64() .. "/dark-rp/picked-up-money", {
|
||||||
|
["player"] = gmInte.getPlayerFormat(ply),
|
||||||
|
["amount"] = math.Round(price),
|
||||||
|
["entity"] = gmInte.getEntityFormat(entity),
|
||||||
|
})
|
||||||
|
end
|
||||||
|
|
||||||
|
function gmInte.postDarkRPPickedUpCheque(plyWriter, plyTarget, price, sucess, entity)
|
||||||
|
if !plyWriter:IsValid() || !plyWriter:IsPlayer() then return end
|
||||||
|
if !plyTarget:IsValid() || !plyTarget:IsPlayer() then return end
|
||||||
|
if ply != plyTo then return end
|
||||||
|
gmInte.http.postLog("/servers/:serverID/players/" .. ply:SteamID64() .. "/dark-rp/picked-up-cheque", {
|
||||||
|
["playerChequeWriter"] = gmInte.getPlayerFormat(plyWriter),
|
||||||
|
["playerChequeTarget"] = gmInte.getPlayerFormat(plyTarget),
|
||||||
|
["amount"] = math.Round(price),
|
||||||
|
["entity"] = gmInte.getEntityFormat(entity),
|
||||||
|
})
|
||||||
|
end
|
||||||
|
|
||||||
|
if DarkRP then
|
||||||
|
hook.Add("playerDroppedMoney", "gmInte:Player:DarkRPDroppedMoney", function(ply, amount, entity) gmInte.postDarkRPDroppedMoney(ply, amount, entity) end)
|
||||||
|
hook.Add("playerPickedUpMoney", "gmInte:Player:DarkRPPickedUpMoney", function(ply, price, entity) gmInte.postDarkRPPickedUpMoney(ply, price, entity) end)
|
||||||
|
hook.Add("playerDroppedCheque", "gmInte:Player:DarkRPPickedUpCheque", function(plyWriter, plyTarget, price, sucess, entity) gmInte.postDarkRPPickedUpCheque(plyWriter, plyTarget, price, sucess, entity) end)
|
||||||
|
end
|
|
@ -55,6 +55,8 @@ local function getCustomCompatability(ply)
|
||||||
values.ps2Points = ply.PS2_Wallet.points
|
values.ps2Points = ply.PS2_Wallet.points
|
||||||
values.ps2PremiumPoints = ply.PS2_Wallet.premiumPoints
|
values.ps2PremiumPoints = ply.PS2_Wallet.premiumPoints
|
||||||
end
|
end
|
||||||
|
|
||||||
|
if CH_ATM && SERVER then values.bank = CH_ATM.GetMoneyBankAccount(ply) end
|
||||||
return values
|
return values
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue
Block a user