Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- contract = contract or {}
- contract.bounties = {}
- contract.bountyprices = {}
- -- Gets all the hitmen Incase you couldn't read the title
- function contract.gethitmen()
- hitmen = {}
- for k,v in pairs(player.GetAll()) do
- if table.HasValue( hitmanJobs, v:Team()) then
- table.insert( hitmen, v)
- end
- end
- return hitmen
- end
- hook.Add( "PlayerSay", "Bounty Command", function(ply, msg)
- -- Checking if the player says the command farckward
- if(string.StartWith( msg, chatCommand)) then
- if not table.HasValue( hitmanJobs, ply:Team()) then
- ply:PrintMessage( 3, "Really Your trying to give yourself a hit! That would be a Phat Denied My Friend.")
- return
- end
- local args = string.Split( msg, " ")
- if args[2] == nil or args[3] == nil then
- ply:PrintMessage( 3, "Seem's You don't have enough arguments the Command should be !bounty <player> <price>")
- return
- end
- local found = 0
- local target
- -- Were making sure theres only one person with the name they said AND that the idiot placing a bounty actually said someone who exists
- for k,v in pairs(player.GetAll()) do
- if string.find( string.lower(v:Nick()), string.lower(args[2])) then
- found = found + 1
- target = v
- end
- end
- -- Checking names and shit here Get the names and shit ^^ there
- if target == nil then ply:PrintMessage( 3, "Are you trying to put a bounty on air??? "..args[2].." Dosn't exist") return end
- if found == 0 then ply:PrintMessage( 3, "Well noone exists with the name "..target:Nick()) return end
- if found > 1 then ply:PrintMessage( 3, "It seems there was "..found.." number of players with the name "..target:Nick()) return end
- 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
- -- DOLLAR DOLLAR BILLS YALL
- local amount = tonumber( args[3] )
- local money = ply.DarkRPVars.money
- if amount < minamount then
- 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.")
- return
- end
- 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
- local tbllength = table.Count(contract.bounties)
- local plusbounty = false
- local savenum = 0
- local samount = 0
- for i = 1, tbllength do
- if contract.bounties[i]:GetName() == target:GetName() then
- plusbounty = true
- savenum = i
- samount = amount
- amount = amount + contract.bountyprices[i]
- end
- end
- -- CHECKING THE DOLLAR DOLLAR BILLS YALL
- local hitmen = contract.gethitmen()
- if not samount == 0 then
- ply:addmoney(-samount)
- else
- ply:addMoney(-amount)
- end
- -- If Bounty Prices Should Stack so you know MORE DOLLAR DOLLAR BILLS
- if plusbounty == true then
- if ShouldStack == false then
- 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")
- ply:addMoney(samount)
- return
- end
- table.remove( contract.bounties, savenum)
- table.remove( contract.bountyprices, savenum)
- -- Remoivng from the table Don't Worry its Stored earlier
- ply:PrintMessage( 3, "Someone else dislikes " .. target:Nick() .. " so we added $" .. samount .. " to the bounty" )
- -- FOR BLOGS NO TOUCH
- hook.Run( "bountyincreased", ply, target, amount, samount)
- -- Tells all hitment that the bounty has been increased
- for i = 1, table.Count(hitmen) do
- hitmen[i]:PrintMessage( 3, "Its your lucky day bois the Bounty on "..target:Nick().." has been upped to "..amount.." happy Hunting!")
- end
- else
- -- 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
- ply:PrintMessage( 3, "A bounty of "..amount.." has been added to "..target:Nick())
- -- MORE BLOGS SHIT NO TOUCH
- hook.Run( "bountystarted", ply, target, amount)
- for i = 1, table.Count(hitmen) do
- hitmen[i]:PrintMessage( 3, target:Nick().." has a bounty on his head of "..amount..". Happy Hunting!")
- end
- end
- -- Adding Shit to tables so you know I can get it and Also Making it so I can acces it in the shared file
- table.insert( contract.bounties, target)
- table.insert( contract.bountyprices, amount)
- util.AddNetworkString("bounties")
- util.AddNetworkString("bountyprice")
- net.Start("bounties")
- net.WriteTable(contract.bounties)
- net.Broadcast()
- net.Start("bountyprice")
- net.WriteTable(contract.bountyprices)
- net.Broadcast()
- end
- end)
Add Comment
Please, Sign In to add comment