Guest User

Untitled

a guest
Dec 19th, 2018
93
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 5.20 KB | None | 0 0
  1. contract = contract or {}
  2.  
  3. contract.bounties = {}
  4. contract.bountyprices = {}
  5.  
  6. -- Gets all the hitmen Incase you couldn't read the title
  7. function contract.gethitmen()
  8. hitmen = {}
  9. for k,v in pairs(player.GetAll()) do
  10. if table.HasValue( hitmanJobs, v:Team()) then
  11. table.insert( hitmen, v)
  12. end
  13. end
  14. return hitmen
  15. end
  16.  
  17.  
  18. hook.Add( "PlayerSay", "Bounty Command", function(ply, msg)
  19. -- Checking if the player says the command farckward
  20. if(string.StartWith( msg, chatCommand)) then
  21. if not table.HasValue( hitmanJobs, ply:Team()) then
  22. ply:PrintMessage( 3, "Really Your trying to give yourself a hit! That would be a Phat Denied My Friend.")
  23. return
  24. end
  25. local args = string.Split( msg, " ")
  26. if args[2] == nil or args[3] == nil then
  27. ply:PrintMessage( 3, "Seem's You don't have enough arguments the Command should be !bounty <player> <price>")
  28. return
  29. end
  30. local found = 0
  31. local target
  32. -- Were making sure theres only one person with the name they said AND that the idiot placing a bounty actually said someone who exists
  33. for k,v in pairs(player.GetAll()) do
  34. if string.find( string.lower(v:Nick()), string.lower(args[2])) then
  35. found = found + 1
  36. target = v
  37. end
  38. end
  39. -- Checking names and shit here Get the names and shit ^^ there
  40. if target == nil then ply:PrintMessage( 3, "Are you trying to put a bounty on air??? "..args[2].." Dosn't exist") return end
  41. if found == 0 then ply:PrintMessage( 3, "Well noone exists with the name "..target:Nick()) return end
  42. if found > 1 then ply:PrintMessage( 3, "It seems there was "..found.." number of players with the name "..target:Nick()) return end
  43. if target:GetName() == ply:GetName() then ply:PrintMessage( 3, "Why?? Are you trying to get yourself Killed!! like seriously you can't put a bounty on yourself") return end
  44. -- DOLLAR DOLLAR BILLS YALL
  45. local amount = tonumber( args[3] )
  46. local money = ply.DarkRPVars.money
  47. if amount < minamount then
  48. ply:PrintMessage( 3, "Wow your cheap! ".. args[3].."credit(s) really come on the minimum amount to start a bounty is "..minamount.." try to reach it.")
  49. return
  50. end
  51. if money < amount then ply:PrintMessage( 3, "You Poor soul you don't have enough money to afford a bounty of "..amount.." credits") return end
  52. local tbllength = table.Count(contract.bounties)
  53. local plusbounty = false
  54. local savenum = 0
  55. local samount = 0
  56. for i = 1, tbllength do
  57. if contract.bounties[i]:GetName() == target:GetName() then
  58. plusbounty = true
  59. savenum = i
  60. samount = amount
  61. amount = amount + contract.bountyprices[i]
  62. end
  63. end
  64. -- CHECKING THE DOLLAR DOLLAR BILLS YALL
  65. local hitmen = contract.gethitmen()
  66. if not samount == 0 then
  67. ply:addmoney(-samount)
  68. else
  69. ply:addMoney(-amount)
  70. end
  71. -- If Bounty Prices Should Stack so you know MORE DOLLAR DOLLAR BILLS
  72. if plusbounty == true then
  73. if ShouldStack == false then
  74. ply:PrintMessage( 3, "Someone else dosn't like this person either and since stacking Isn't on you can't place a hit just yet")
  75. ply:addMoney(samount)
  76. return
  77. end
  78. table.remove( contract.bounties, savenum)
  79. table.remove( contract.bountyprices, savenum)
  80. -- Remoivng from the table Don't Worry its Stored earlier
  81.  
  82. ply:PrintMessage( 3, "Someone else dislikes " .. target:Nick() .. " so we added $" .. samount .. " to the bounty" )
  83. -- FOR BLOGS NO TOUCH
  84. hook.Run( "bountyincreased", ply, target, amount, samount)
  85.  
  86. -- Tells all hitment that the bounty has been increased
  87. for i = 1, table.Count(hitmen) do
  88. hitmen[i]:PrintMessage( 3, "Its your lucky day bois the Bounty on "..target:Nick().." has been upped to "..amount.." happy Hunting!")
  89. end
  90. else
  91. -- basically this if a hit dosn't already exist on the person Starting it In case you can't read like three lines down lmao
  92. ply:PrintMessage( 3, "A bounty of "..amount.." has been added to "..target:Nick())
  93. -- MORE BLOGS SHIT NO TOUCH
  94. hook.Run( "bountystarted", ply, target, amount)
  95. for i = 1, table.Count(hitmen) do
  96. hitmen[i]:PrintMessage( 3, target:Nick().." has a bounty on his head of "..amount..". Happy Hunting!")
  97. end
  98. end
  99.  
  100. -- Adding Shit to tables so you know I can get it and Also Making it so I can acces it in the shared file
  101. table.insert( contract.bounties, target)
  102. table.insert( contract.bountyprices, amount)
  103. util.AddNetworkString("bounties")
  104. util.AddNetworkString("bountyprice")
  105. net.Start("bounties")
  106. net.WriteTable(contract.bounties)
  107. net.Broadcast()
  108. net.Start("bountyprice")
  109. net.WriteTable(contract.bountyprices)
  110. net.Broadcast()
  111.  
  112. end
  113. end)
Add Comment
Please, Sign In to add comment