Skip to content
This repository was archived by the owner on Jul 29, 2024. It is now read-only.
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
44 changes: 22 additions & 22 deletions hitman/[Core]/[Client]/bounty.lua
Original file line number Diff line number Diff line change
Expand Up @@ -22,11 +22,11 @@ local Weapons = {
--------------------------------------------------------------------------------
-- Core
--------------------------------------------------------------------------------
RegisterNetEvent('RootLodge:BountyHunter:C:SetUpMission')
RegisterNetEvent('RootLodge:BountyHunter:C:ResetTotalKills')
RegisterNetEvent('RootLodge:HitContracts:C:SetUpMission')
RegisterNetEvent('RootLodge:HitContracts:C:ResetTotalKills')
--------------------------------------------------------------------------------
TotalKilled = 0
local ArrayBounties = {}
local ArrayTargets = {}
local CreateNPC = {}
local NPCx, NPCy, NPCz = 0, 0, 0
local InMission = false
Expand All @@ -39,7 +39,7 @@ local alwaysfalse = false
local alwaystrue = true
--------------------------------------------------------------------------------

AddEventHandler('RootLodge:BountyHunter:C:SetUpMission', function()
AddEventHandler('RootLodge:HitContracts:C:SetUpMission', function()
-- Make sure this script does not execute twice.
SaveGuard = true

Expand All @@ -48,10 +48,10 @@ AddEventHandler('RootLodge:BountyHunter:C:SetUpMission', function()
-- Stop the user
if alwaysfalse and not alwaystrue then Notify("Something has went terribly wrong. Please contact the server administrator!", 1000) return end

-- Get a random bounty ID
local rLoc = Bounties[math.random(#Bounties)]
-- Get a random target/contract ID
local rLoc = Contracts[math.random(#Contracts)]
-- Get all NPCs associated with this ID
for k, v in pairs(Bounties) do
for k, v in pairs(Contracts) do
if v.ID == rLoc.ID then
TotalEnemies = TotalEnemies + 1
-- Get a random model for this NPC
Expand All @@ -68,7 +68,7 @@ AddEventHandler('RootLodge:BountyHunter:C:SetUpMission', function()
GiveWeaponToPed_2(CreateNPC[k], rWeapon, 50, true, true, 1, false, 0.5, 1.0, 1.0, true, 0, 0)
SetCurrentPedWeapon(CreateNPC[k], rWeapon, true)
TaskCombatPed(CreateNPC[k], PlayerPedId())
ArrayBounties[k] = CreateNPC[k]
ArrayTargets[k] = CreateNPC[k]
end
end

Expand All @@ -79,43 +79,43 @@ AddEventHandler('RootLodge:BountyHunter:C:SetUpMission', function()
-- Start the GPS
--StartGpsMultiRoute(6, true, true)

-- Add the coordinates of the NPCs in ArrayBounties to the GPS route
--for k, v in pairs(ArrayBounties) do
--local npcCoords = GetEntityCoords(ArrayBounties[k])
-- Add the coordinates of the NPCs in ArrayTargets to the GPS route
--for k, v in pairs(ArrayTargets) do
--local npcCoords = GetEntityCoords(ArrayTargets[k])
--AddPointToGpsMultiRoute(npcCoords.x, npcCoords.y, npcCoords.z)
--end

-- Set route render to visible
--SetGpsMultiRouteRender(true)

Wait(1000)
Notify('Your Bounty is located on the map!', 5000)
Notify('Your target has been located. Check your map!', 5000)
Wait(2000)
Notify('We need them dead, not alive! But Dead!', 5000)
Wait(1500)
Notify('You can stack bounties, just keep in mind', 5000)
Notify('You can stack Contracts, just keep in mind', 5000)
Wait(1000)
Notify('that you lose the bounties if you died!', 5000)
Notify('that you lose the Contracts if you died!', 5000)
InMission = true
SaveGuard = false
while InMission do Wait(1)
for k, v in pairs(ArrayBounties) do
for k, v in pairs(ArrayTargets) do

if not GPSToBodyIsSet then
GPSToBodyIsSet = true
StartGpsMultiRoute(6, true, true)
local npcCoords = GetEntityCoords(ArrayBounties[k])
local npcCoords = GetEntityCoords(ArrayTargets[k])
AddPointToGpsMultiRoute(npcCoords.x, npcCoords.y, npcCoords.z)
SetGpsMultiRouteRender(true)
end

if IsEntityDead(v) then
local eCoords = GetEntityCoords(ArrayBounties[k])
local eCoords = GetEntityCoords(ArrayTargets[k])

if ArrayBounties[k] ~= nil then
if ArrayTargets[k] ~= nil then
TotalEnemies = TotalEnemies - 1
TotalKilled = TotalKilled + 1
ArrayBounties[k] = nil
ArrayTargets[k] = nil
if TotalEnemies == 0 then
SetGpsMultiRouteRender(false)
TriggerEvent("vorp:TipRight", 'You managed to kill all targets', 5000)
Expand Down Expand Up @@ -156,17 +156,17 @@ AddEventHandler('RootLodge:BountyHunter:C:SetUpMission', function()
ClearGpsMultiRoute()
SetGpsMultiRouteRender(false)
for k, v in pairs(CreateNPC) do DeletePed(v) Wait(500) end
table.remove{CreateNPC} table.remove{ArrayBounties}
table.remove{CreateNPC} table.remove{ArrayTargets}
end

function GPStoBoards ()
bb2 = BountyBoards[2]
bb2 = HandlerLocations[2]
StartGpsMultiRoute(6, true, true)
AddPointToGpsMultiRoute(bb2.x, bb2.y, bb2.z)
SetGpsMultiRouteRender(true)
GPStoSDboardactive = true
end

AddEventHandler('RootLodge:BountyHunter:C:ResetTotalKills', function()
AddEventHandler('RootLodge:HitContracts:C:ResetTotalKills', function()
TotalKilled = 0
end)
16 changes: 8 additions & 8 deletions hitman/[Core]/[Client]/main.lua
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ local ActiveMenu = nil
local MenuOpen = false
local Location = nil

RegisterNetEvent('RootLodge:BountyHunter:C:StartMission')
RegisterNetEvent('RootLodge:HitContracts:C:StartMission')
--------------------------------------------------------------------------------
-- Core
--------------------------------------------------------------------------------
Expand All @@ -23,7 +23,7 @@ end


Citizen.CreateThread(function()
for _, board in ipairs(BountyBoards) do
for _, board in ipairs(HandlerLocations) do
local blipName = board.City
local blipHash = GetHashKey("blip_summer_guard") -- Replace with your blip style
addBlipForCoords(blipName, blipHash, {board.x, board.y, board.z})
Expand All @@ -36,7 +36,7 @@ Citizen.CreateThread(function()
while true do Wait(2000)
local ped = PlayerPedId()
local coords = GetEntityCoords(ped)
for k, v in pairs(BountyBoards) do
for k, v in pairs(HandlerLocations) do

local dist = GetDistanceBetweenCoords(coords.x, coords.y, coords.z, v.x, v.y, v.z)

Expand All @@ -54,19 +54,19 @@ Citizen.CreateThread(function()
if (dist <= 5) and not InRange then
InRange = true
Location = v.City
TriggerEvent('RootLodge:BountyHunter:C:StartMission')
TriggerEvent('RootLodge:HitContracts:C:StartMission')
end
end
end
end
end)

-- Check players distance from the stores.
AddEventHandler('RootLodge:BountyHunter:C:StartMission', function()
AddEventHandler('RootLodge:HitContracts:C:StartMission', function()
local ped = PlayerPedId()
while InRange do Wait(1)
local coords = GetEntityCoords(ped)
for k, v in pairs(BountyBoards) do
for k, v in pairs(HandlerLocations) do
local x, y, z = v.x, v.y, v.z
local dist = GetDistanceBetweenCoords(coords.x, coords.y, coords.z, x, y, z)

Expand Down Expand Up @@ -138,11 +138,11 @@ function PVEMenu ()

if hunt then
Location = nil
TriggerServerEvent('RootLodge:BountyHunter:S:CheckCharacter')
TriggerServerEvent('RootLodge:HitContracts:S:CheckCharacter')
end

if payment and (TotalKilled > 0)then
TriggerServerEvent('RootLodge:BountyHunter:S:PayDay', TotalKilled)
TriggerServerEvent('RootLodge:HitContracts:S:PayDay', TotalKilled)
TotalKilled = 0
SetGpsMultiRouteRender(false)
Location = nil
Expand Down
12 changes: 6 additions & 6 deletions hitman/[Core]/[Server]/main.lua
Original file line number Diff line number Diff line change
Expand Up @@ -7,15 +7,15 @@ function Wait(args) Citizen.Wait(args) end
function Invoke(args, bool) Citizen.InvokeNative(args, bool) end
--------------------------------------------------------------------------------
-- Event Register
RegisterServerEvent('RootLodge:BountyHunter:S:PayDay')
RegisterServerEvent('RootLodge:BountyHunter:S:CheckCharacter')
RegisterServerEvent('RootLodge:HitContracts:S:PayDay')
RegisterServerEvent('RootLodge:HitContracts:S:CheckCharacter')
--------------------------------------------------------------------------------
-- Core
--------------------------------------------------------------------------------
-- Variables
--------------------------------------------------------------------------------
--------------------------------------------------------------------------------
AddEventHandler('RootLodge:BountyHunter:S:PayDay', function(KillCount)
AddEventHandler('RootLodge:HitContracts:S:PayDay', function(KillCount)
local BPK = Payment.Money.BPK
local XPK = Payment.XP.XPK
local mMin = Payment.Money.Min
Expand Down Expand Up @@ -48,17 +48,17 @@ AddEventHandler('RootLodge:BountyHunter:S:PayDay', function(KillCount)
xPay = vEXP
end

TriggerClientEvent('RootLodge:BountyHunter:C:ResetTotalKills', source)
TriggerClientEvent('RootLodge:HitContracts:C:ResetTotalKills', source)
TriggerClientEvent("vorp:TipRight", source, "You received $"..mPay..' and '..xPay..' XP', 5000)
end)



AddEventHandler('RootLodge:BountyHunter:S:CheckCharacter', function()
AddEventHandler('RootLodge:HitContracts:S:CheckCharacter', function()
local User = VorpCore.getUser(source)
if User ~= nil then
local Character = User.getUsedCharacter
TriggerClientEvent('RootLodge:BountyHunter:C:SetUpMission', source)
TriggerClientEvent('RootLodge:HitContracts:C:SetUpMission', source)
end
end)

Expand Down
8 changes: 4 additions & 4 deletions hitman/config.lua
Original file line number Diff line number Diff line change
Expand Up @@ -29,10 +29,10 @@ Payment = {
}
}
--------------------------------------------------------------------------------
-- Here you can add all BountyBoards Menu locations.
-- Here you can add all HandlerLocations Menu locations.
-- The City name does nothing! this is just a visual reference.
--------------------------------------------------------------------------------
BountyBoards = {
HandlerLocations = {
{ City = 'Valentine', x = -274.8, y = 805.5, z = 119.3 },
{ City = 'Saint Denis', x = 2513.4, y = -1305.2, z = 48.9 },
{ City = 'Blackwater', x = -758.0, y = -1266.0, z = 44.0 },
Expand All @@ -42,14 +42,14 @@ BountyBoards = {


--------------------------------------------------------------------------------
-- These are the NPC bounties you can hunt. If you want to add
-- These are the NPC Contracts you can hunt. If you want to add
-- new location/mission, just add the coordinates on the list.
-- NOTE: that the IDs are what combines the enemies in a group.
-- If ID 1 is selected by the randomizer, all enemies with
-- ID 1 will be selected for the mission. The more enties
-- on the same ID, there more you have to kill per mission.
--------------------------------------------------------------------------------
Bounties = {
Contracts = {
{ID = 1, Coords = { x = -30.77, y = 1226.8, z = 172.92 }},
{ID = 1, Coords = { x = -33.77, y = 1229.8, z = 172.92 }},
{ID = 2, Coords = { x = 489.53, y = 619.81, z = 111.7 }},
Expand Down