Advertisement
Guest User

Untitled

a guest
Jun 25th, 2018
91
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 6.25 KB | None | 0 0
  1. local function Purge_Pay(ply, txt)
  2. local args = string.Explode(" ", string.lower(txt))
  3. if args[1] == "!pay" then
  4. local ct = ChatText()
  5. local ct_alt = ChatText()
  6. local commandname = args[1]
  7.  
  8. local playerName = ""
  9. for i=2,#args-1,1 do
  10. if i == 2 then
  11. playerName = args[i]
  12. else
  13. playerName = playerName .. " " .. args[i]
  14. end
  15. end
  16.  
  17. local payPly = FindPlayer(ply, playerName)
  18. local payAmnt = args[#args]
  19.  
  20. if #args == 2 then
  21. ct:AddText("[Purge] ", ColFail)
  22. ct:AddText("Target player could not be found.")
  23. ct:Send(ply)
  24. else
  25. if CheckInput(ply, payAmnt, commandname) then
  26. payAmnt = math.floor(payAmnt)
  27. if IsValid(payPly) and (ply != payPly) then
  28. if (payAmnt != 0) then
  29. if ply:GetCash() < tonumber(payAmnt) then
  30. ct:AddText("[Purge] ", ColFail)
  31. ct:AddText("You do not have enough money to send that amount.")
  32. ct:Send(ply)
  33. else
  34. ct:AddText("[Purge] ", CollSucc)
  35. ct:AddText("You gave $" .. numWithCommas(payAmnt) .. " to ".. payPly:Nick() .."!")
  36. ct:Send(ply)
  37.  
  38. ply:SubCash(payAmnt)
  39. payPly:AddCash(payAmnt)
  40.  
  41. ct_alt:AddText("[Purge] ", ColSucc)
  42. ct_alt:AddText("You received $".. numWithCommas(payAmnt) .." from ".. ply:Nick() .."!")
  43. ct_alt:Send(payPly)
  44. end
  45. else
  46. ct:AddText("[Purge] ", ColFail)
  47. ct:AddText("Value must be above 0.")
  48. ct:Send(ply)
  49. end
  50. else
  51. ct:AddText("[Purge] ", ColFail)
  52. ct:AddText("Target player could not be found.")
  53. ct:Send(ply)
  54. end
  55. end
  56. return ""
  57. end
  58.  
  59. end
  60. end
  61. hook.Add("PlayerSay", "Purge_Pay", Purge_Pay)
  62.  
  63. /*
  64. -- Give Cash
  65. local function Purge_GiveCash(ply, txt)
  66. local command = string.Explode(" ", txt)
  67. if command[1] == "!givecash" then
  68. local ct = ChatText()
  69. local ct2 = ChatText()
  70. if ply:IsAdmin() or ply:IsUserGroup("owner") or ply:IsUserGroup("coowner") then
  71. local target_player = FindPlayer(ply, command[2])
  72. local target_amount = command[3]
  73. local commandname = command[1]
  74. if CheckInput(ply, target_amount, commandname) then
  75. if IsValid(target_player) then
  76. target_player:AddCash(command[3])
  77.  
  78. ct:AddText("[Purge] ", Color(132, 199, 29, 255))
  79. ct:AddText("You gave "..target_player:Nick().." $"..numWithCommas(target_amount)..".")
  80. ct:Send(ply)
  81.  
  82. ct2:AddText("[Purge] ", Color(132, 199, 29, 255))
  83. ct2:AddText("You were given $"..numWithCommas(target_amount).." by "..ply:Nick()..".")
  84. ct2:Send(target_player)
  85. else
  86. ct:AddText("[Purge] ", Color(158, 49, 49, 255))
  87. ct:AddText("Target player could not be found.")
  88. ct:Send(ply)
  89. end
  90. end
  91. else
  92. ct:AddText("[Purge] ", Color(158, 49, 49, 255))
  93. ct:AddText("You don't have permission to use this command.")
  94. ct:Send(ply)
  95. end
  96. end
  97. end
  98. hook.Add("PlayerSay", "Purge_GiveCash", Purge_GiveCash)
  99.  
  100. -- Check Cash
  101. local function Purge_CheckCash(ply, txt)
  102. local command = string.Explode(" ", txt)
  103. if command[1] == "!checkcash" then
  104. local ct = ChatText()
  105. if ply:IsAdmin() or ply:IsUserGroup("owner") or ply:IsUserGroup("coowner") then
  106. local target_player = FindPlayer(ply, command[2])
  107. if IsValid(target_player) then
  108. ct:AddText("[Purge] ", Color(132, 199, 29, 255))
  109. ct:AddText(target_player:Nick().." has $"..numWithCommas(target_player:GetCash())..".")
  110. ct:Send(ply)
  111. else
  112. ct:AddText("[Purge] ", Color(158, 49, 49, 255))
  113. ct:AddText("Target player could not be found.")
  114. ct:Send(ply)
  115. end
  116. else
  117. ct:AddText("[Purge] ", Color(158, 49, 49, 255))
  118. ct:AddText("You don't have permission to use this command.")
  119. ct:Send(ply)
  120. end
  121. end
  122. end
  123. hook.Add("PlayerSay", "Purge_CheckCash", Purge_CheckCash)
  124.  
  125. -- Set Cash
  126. local function Purge_SetCash(ply, txt)
  127. local command = string.Explode(" ", txt)
  128. if command[1] == "!setcash" then
  129. local ct = ChatText()
  130. local ct2 = ChatText()
  131. if ply:IsAdmin() or ply:IsUserGroup("owner") or ply:IsUserGroup("coowner") then
  132. local target_player = FindPlayer(ply, command[2])
  133. local target_amount = command[3]
  134. local commandname = command[1]
  135. if CheckInput(ply, target_amount, commandname) then
  136. if IsValid(target_player) then
  137. target_player:SetCash(target_amount)
  138.  
  139. ct:AddText("[Purge] ", Color(132, 199, 29, 255))
  140. ct:AddText("You set "..target_player:Nick().."'s cash to $"..numWithCommas(target_amount)..".")
  141. ct:Send(ply)
  142.  
  143. ct2:AddText("[Purge] ", Color(132, 199, 29, 255))
  144. ct2:AddText("Your cash has been set to $"..numWithCommas(target_amount).." by "..ply:Nick()..".")
  145. ct2:Send(target_player)
  146. else
  147. ct:AddText("[Purge] ", Color(158, 49, 49, 255))
  148. ct:AddText("Target player could not be found.")
  149. ct:Send(ply)
  150. end
  151. end
  152. else
  153. ct:AddText("[Purge] ", Color(158, 49, 49, 255))
  154. ct:AddText("You don't have permission to use this command.")
  155. ct:Send(ply)
  156. end
  157. end
  158. end
  159. hook.Add("PlayerSay", "Purge_SetCash", Purge_SetCash)
  160.  
  161. -- Take Cash
  162. local function Purge_TakeCash(ply, txt)
  163. local command = string.Explode(" ", txt)
  164. if command[1] == "!takecash" then
  165. local ct = ChatText()
  166. local ct2 = ChatText()
  167. if ply:IsAdmin() or ply:IsUserGroup("owner") or ply:IsUserGroup("co-owner") then
  168. local target_player = FindPlayer(ply, command[2])
  169. local target_amount = command[3]
  170. local commandname = command[1]
  171. if CheckInput(ply, target_amount, commandname) then
  172. if IsValid(target_player) then
  173. target_player:SubCash(target_amount)
  174.  
  175. ct:AddText("[Purge] ", Color(132, 199, 29, 255))
  176. ct:AddText("You have taken $"..numWithCommas(target_amount).." from "..target_player:Nick()..".")
  177. ct:Send(ply)
  178.  
  179. ct2:AddText("[Purge] ", Color(132, 199, 29, 255))
  180. ct2:AddText("You had $"..numWithCommas(target_amount).." taken by "..ply:Nick()..".")
  181. ct2:Send(target_player)
  182. else
  183. ct:AddText("[Purge] ", Color(158, 49, 49, 255))
  184. ct:AddText("Target player could not be found.")
  185. ct:Send(ply)
  186. end
  187. end
  188. else
  189. ct:AddText("[Purge] ", Color(158, 49, 49, 255))
  190. ct:AddText("You don't have permission to use this command.")
  191. ct:Send(ply)
  192. end
  193. end
  194. end
  195. hook.Add("PlayerSay", "Purge_TakeCash", Purge_TakeCash)
  196. */
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement