Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- local function Purge_Pay(ply, txt)
- local args = string.Explode(" ", string.lower(txt))
- if args[1] == "!pay" then
- local ct = ChatText()
- local ct_alt = ChatText()
- local commandname = args[1]
- local playerName = ""
- for i=2,#args-1,1 do
- if i == 2 then
- playerName = args[i]
- else
- playerName = playerName .. " " .. args[i]
- end
- end
- local payPly = FindPlayer(ply, playerName)
- local payAmnt = args[#args]
- if #args == 2 then
- ct:AddText("[Purge] ", ColFail)
- ct:AddText("Target player could not be found.")
- ct:Send(ply)
- else
- if CheckInput(ply, payAmnt, commandname) then
- payAmnt = math.floor(payAmnt)
- if IsValid(payPly) and (ply != payPly) then
- if (payAmnt != 0) then
- if ply:GetCash() < tonumber(payAmnt) then
- ct:AddText("[Purge] ", ColFail)
- ct:AddText("You do not have enough money to send that amount.")
- ct:Send(ply)
- else
- ct:AddText("[Purge] ", CollSucc)
- ct:AddText("You gave $" .. numWithCommas(payAmnt) .. " to ".. payPly:Nick() .."!")
- ct:Send(ply)
- ply:SubCash(payAmnt)
- payPly:AddCash(payAmnt)
- ct_alt:AddText("[Purge] ", ColSucc)
- ct_alt:AddText("You received $".. numWithCommas(payAmnt) .." from ".. ply:Nick() .."!")
- ct_alt:Send(payPly)
- end
- else
- ct:AddText("[Purge] ", ColFail)
- ct:AddText("Value must be above 0.")
- ct:Send(ply)
- end
- else
- ct:AddText("[Purge] ", ColFail)
- ct:AddText("Target player could not be found.")
- ct:Send(ply)
- end
- end
- return ""
- end
- end
- end
- hook.Add("PlayerSay", "Purge_Pay", Purge_Pay)
- /*
- -- Give Cash
- local function Purge_GiveCash(ply, txt)
- local command = string.Explode(" ", txt)
- if command[1] == "!givecash" then
- local ct = ChatText()
- local ct2 = ChatText()
- if ply:IsAdmin() or ply:IsUserGroup("owner") or ply:IsUserGroup("coowner") then
- local target_player = FindPlayer(ply, command[2])
- local target_amount = command[3]
- local commandname = command[1]
- if CheckInput(ply, target_amount, commandname) then
- if IsValid(target_player) then
- target_player:AddCash(command[3])
- ct:AddText("[Purge] ", Color(132, 199, 29, 255))
- ct:AddText("You gave "..target_player:Nick().." $"..numWithCommas(target_amount)..".")
- ct:Send(ply)
- ct2:AddText("[Purge] ", Color(132, 199, 29, 255))
- ct2:AddText("You were given $"..numWithCommas(target_amount).." by "..ply:Nick()..".")
- ct2:Send(target_player)
- else
- ct:AddText("[Purge] ", Color(158, 49, 49, 255))
- ct:AddText("Target player could not be found.")
- ct:Send(ply)
- end
- end
- else
- ct:AddText("[Purge] ", Color(158, 49, 49, 255))
- ct:AddText("You don't have permission to use this command.")
- ct:Send(ply)
- end
- end
- end
- hook.Add("PlayerSay", "Purge_GiveCash", Purge_GiveCash)
- -- Check Cash
- local function Purge_CheckCash(ply, txt)
- local command = string.Explode(" ", txt)
- if command[1] == "!checkcash" then
- local ct = ChatText()
- if ply:IsAdmin() or ply:IsUserGroup("owner") or ply:IsUserGroup("coowner") then
- local target_player = FindPlayer(ply, command[2])
- if IsValid(target_player) then
- ct:AddText("[Purge] ", Color(132, 199, 29, 255))
- ct:AddText(target_player:Nick().." has $"..numWithCommas(target_player:GetCash())..".")
- ct:Send(ply)
- else
- ct:AddText("[Purge] ", Color(158, 49, 49, 255))
- ct:AddText("Target player could not be found.")
- ct:Send(ply)
- end
- else
- ct:AddText("[Purge] ", Color(158, 49, 49, 255))
- ct:AddText("You don't have permission to use this command.")
- ct:Send(ply)
- end
- end
- end
- hook.Add("PlayerSay", "Purge_CheckCash", Purge_CheckCash)
- -- Set Cash
- local function Purge_SetCash(ply, txt)
- local command = string.Explode(" ", txt)
- if command[1] == "!setcash" then
- local ct = ChatText()
- local ct2 = ChatText()
- if ply:IsAdmin() or ply:IsUserGroup("owner") or ply:IsUserGroup("coowner") then
- local target_player = FindPlayer(ply, command[2])
- local target_amount = command[3]
- local commandname = command[1]
- if CheckInput(ply, target_amount, commandname) then
- if IsValid(target_player) then
- target_player:SetCash(target_amount)
- ct:AddText("[Purge] ", Color(132, 199, 29, 255))
- ct:AddText("You set "..target_player:Nick().."'s cash to $"..numWithCommas(target_amount)..".")
- ct:Send(ply)
- ct2:AddText("[Purge] ", Color(132, 199, 29, 255))
- ct2:AddText("Your cash has been set to $"..numWithCommas(target_amount).." by "..ply:Nick()..".")
- ct2:Send(target_player)
- else
- ct:AddText("[Purge] ", Color(158, 49, 49, 255))
- ct:AddText("Target player could not be found.")
- ct:Send(ply)
- end
- end
- else
- ct:AddText("[Purge] ", Color(158, 49, 49, 255))
- ct:AddText("You don't have permission to use this command.")
- ct:Send(ply)
- end
- end
- end
- hook.Add("PlayerSay", "Purge_SetCash", Purge_SetCash)
- -- Take Cash
- local function Purge_TakeCash(ply, txt)
- local command = string.Explode(" ", txt)
- if command[1] == "!takecash" then
- local ct = ChatText()
- local ct2 = ChatText()
- if ply:IsAdmin() or ply:IsUserGroup("owner") or ply:IsUserGroup("co-owner") then
- local target_player = FindPlayer(ply, command[2])
- local target_amount = command[3]
- local commandname = command[1]
- if CheckInput(ply, target_amount, commandname) then
- if IsValid(target_player) then
- target_player:SubCash(target_amount)
- ct:AddText("[Purge] ", Color(132, 199, 29, 255))
- ct:AddText("You have taken $"..numWithCommas(target_amount).." from "..target_player:Nick()..".")
- ct:Send(ply)
- ct2:AddText("[Purge] ", Color(132, 199, 29, 255))
- ct2:AddText("You had $"..numWithCommas(target_amount).." taken by "..ply:Nick()..".")
- ct2:Send(target_player)
- else
- ct:AddText("[Purge] ", Color(158, 49, 49, 255))
- ct:AddText("Target player could not be found.")
- ct:Send(ply)
- end
- end
- else
- ct:AddText("[Purge] ", Color(158, 49, 49, 255))
- ct:AddText("You don't have permission to use this command.")
- ct:Send(ply)
- end
- end
- end
- hook.Add("PlayerSay", "Purge_TakeCash", Purge_TakeCash)
- */
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement