-
Notifications
You must be signed in to change notification settings - Fork 22
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
4f17b2b
commit 2b625fb
Showing
14 changed files
with
386 additions
and
380 deletions.
There are no files selected for viewing
176 changes: 88 additions & 88 deletions
176
server-data/resources/[esx_addons]/esx_holdup/client/main.lua
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,118 +1,118 @@ | ||
local holdingUp = false | ||
local store = '' | ||
local store = "" | ||
local blipRobbery = nil | ||
|
||
function DrawTxt(x,y, width, height, scale, text, r, g, b, a, outline) | ||
SetTextFont(0) | ||
SetTextScale(scale, scale) | ||
SetTextColour(r, g, b, a) | ||
SetTextDropshadow(0, 0, 0, 0,255) | ||
SetTextDropShadow() | ||
if outline then | ||
function DrawTxt(x, y, width, height, scale, text, r, g, b, a, outline) | ||
SetTextFont(0) | ||
SetTextScale(scale, scale) | ||
SetTextColour(r, g, b, a) | ||
SetTextDropshadow(0, 0, 0, 0, 255) | ||
SetTextDropShadow() | ||
if outline then | ||
SetTextOutline() | ||
end | ||
BeginTextCommandDisplayText('STRING') | ||
AddTextComponentSubstringPlayerName(text) | ||
EndTextCommandDisplayText(x - width / 2, y - height / 2 + 0.005) | ||
BeginTextCommandDisplayText("STRING") | ||
AddTextComponentSubstringPlayerName(text) | ||
EndTextCommandDisplayText(x - width / 2, y - height / 2 + 0.005) | ||
end | ||
|
||
RegisterNetEvent('esx_holdup:currentlyRobbing') | ||
AddEventHandler('esx_holdup:currentlyRobbing', function(currentStore) | ||
holdingUp, store = true, currentStore | ||
RegisterNetEvent("esx_holdup:currentlyRobbing") | ||
AddEventHandler("esx_holdup:currentlyRobbing", function(currentStore) | ||
holdingUp, store = true, currentStore | ||
end) | ||
|
||
RegisterNetEvent('esx_holdup:killBlip') | ||
AddEventHandler('esx_holdup:killBlip', function() | ||
RemoveBlip(blipRobbery) | ||
RegisterNetEvent("esx_holdup:killBlip") | ||
AddEventHandler("esx_holdup:killBlip", function() | ||
RemoveBlip(blipRobbery) | ||
end) | ||
|
||
RegisterNetEvent('esx_holdup:setBlip') | ||
AddEventHandler('esx_holdup:setBlip', function(position) | ||
blipRobbery = AddBlipForCoord(position) | ||
SetBlipSprite(blipRobbery, 161) | ||
SetBlipScale(blipRobbery, 2.0) | ||
SetBlipColour(blipRobbery, 3) | ||
PulseBlip(blipRobbery) | ||
RegisterNetEvent("esx_holdup:setBlip") | ||
AddEventHandler("esx_holdup:setBlip", function(position) | ||
blipRobbery = AddBlipForCoord(position) | ||
SetBlipSprite(blipRobbery, 161) | ||
SetBlipScale(blipRobbery, 2.0) | ||
SetBlipColour(blipRobbery, 3) | ||
PulseBlip(blipRobbery) | ||
end) | ||
|
||
RegisterNetEvent('esx_holdup:tooFar') | ||
AddEventHandler('esx_holdup:tooFar', function() | ||
store = '' | ||
ESX.ShowNotification(_U('robbery_cancelled')) | ||
RegisterNetEvent("esx_holdup:tooFar") | ||
AddEventHandler("esx_holdup:tooFar", function() | ||
store = "" | ||
ESX.ShowNotification(_U("robbery_cancelled")) | ||
end) | ||
|
||
RegisterNetEvent('esx_holdup:robberyComplete') | ||
AddEventHandler('esx_holdup:robberyComplete', function(award) | ||
holdingUp, store = false, '' | ||
ESX.ShowNotification(_U('robbery_complete', award)) | ||
RegisterNetEvent("esx_holdup:robberyComplete") | ||
AddEventHandler("esx_holdup:robberyComplete", function(award) | ||
holdingUp, store = false, "" | ||
ESX.ShowNotification(_U("robbery_complete", award)) | ||
end) | ||
|
||
RegisterNetEvent('esx_holdup:startTimer') | ||
AddEventHandler('esx_holdup:startTimer', function() | ||
local timer = Stores[store].secondsRemaining | ||
CreateThread(function() | ||
while timer > 0 and holdingUp do | ||
Wait(1000) | ||
if timer > 0 then | ||
timer = timer - 1 | ||
end | ||
end | ||
end) | ||
CreateThread(function() | ||
while holdingUp do | ||
Wait(0) | ||
DrawTxt(0.66, 1.44, 1.0, 1.0, 0.4, _U('robbery_timer', timer), 255, 255, 255, 255) | ||
end | ||
end) | ||
RegisterNetEvent("esx_holdup:startTimer") | ||
AddEventHandler("esx_holdup:startTimer", function() | ||
local timer = Stores[store].secondsRemaining | ||
CreateThread(function() | ||
while timer > 0 and holdingUp do | ||
Wait(1000) | ||
if timer > 0 then | ||
timer = timer - 1 | ||
end | ||
end | ||
end) | ||
CreateThread(function() | ||
while holdingUp do | ||
Wait(0) | ||
DrawTxt(0.66, 1.44, 1.0, 1.0, 0.4, _U("robbery_timer", timer), 255, 255, 255, 255) | ||
end | ||
end) | ||
end) | ||
|
||
CreateThread(function() | ||
for k,v in pairs(Stores) do | ||
local blip = AddBlipForCoord(v.position) | ||
SetBlipSprite(blip, 156) | ||
SetBlipScale(blip, 0.8) | ||
SetBlipAsShortRange(blip, true) | ||
BeginTextCommandSetBlipName('STRING') | ||
AddTextComponentSubstringPlayerName(_U('shop_robbery')) | ||
EndTextCommandSetBlipName(blip) | ||
end | ||
for k, v in pairs(Stores) do | ||
local blip = AddBlipForCoord(v.position) | ||
SetBlipSprite(blip, 156) | ||
SetBlipScale(blip, 0.8) | ||
SetBlipAsShortRange(blip, true) | ||
BeginTextCommandSetBlipName("STRING") | ||
AddTextComponentSubstringPlayerName(_U("shop_robbery")) | ||
EndTextCommandSetBlipName(blip) | ||
end | ||
end) | ||
|
||
CreateThread(function() | ||
while true do | ||
Wait(0) | ||
local playerPos, letSleep = GetEntityCoords(PlayerPedId()), true | ||
for k,v in pairs(Stores) do | ||
local distance = #(playerPos - v.position) | ||
if distance < Config.Marker.DrawDistance then | ||
if not holdingUp then | ||
while true do | ||
Wait(0) | ||
local playerPos, letSleep = GetEntityCoords(PlayerPedId()), true | ||
for k, v in pairs(Stores) do | ||
local distance = #(playerPos - v.position) | ||
if distance < Config.Marker.DrawDistance then | ||
if not holdingUp then | ||
letSleep = false | ||
DrawMarker(Config.Marker.Type, v.position, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, Config.Marker.x, Config.Marker.y, Config.Marker.z, Config.Marker.r, Config.Marker.g, Config.Marker.b, Config.Marker.a, false, false, 2, false, false, false, false) | ||
if distance < 2.0 then | ||
ESX.ShowHelpNotification(_U('press_to_rob', v.nameOfStore)) | ||
if IsControlJustReleased(0, 38) then | ||
if IsPedArmed(PlayerPedId(), 4) then | ||
TriggerServerEvent('esx_holdup:robberyStarted', k) | ||
else | ||
ESX.ShowNotification(_U('no_threat')) | ||
end | ||
end | ||
end | ||
end | ||
DrawMarker(Config.Marker.Type, v.position, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, Config.Marker.x, Config.Marker.y, Config.Marker.z, Config.Marker.r, Config.Marker.g, Config.Marker.b, Config.Marker.a, false, false, 2, false, false, false, false) | ||
if distance < 2.0 then | ||
ESX.ShowHelpNotification(_U("press_to_rob", v.nameOfStore)) | ||
if IsControlJustReleased(0, 38) then | ||
if IsPedArmed(PlayerPedId(), 4) then | ||
TriggerServerEvent("esx_holdup:robberyStarted", k) | ||
else | ||
ESX.ShowNotification(_U("no_threat")) | ||
end | ||
end | ||
end | ||
end | ||
break | ||
else | ||
letSleep = true | ||
end | ||
end | ||
if holdingUp then | ||
else | ||
letSleep = true | ||
end | ||
end | ||
if holdingUp then | ||
letSleep = false | ||
if #(playerPos - Stores[store].position) > Config.MaxDistance then | ||
TriggerServerEvent('esx_holdup:tooFar', store) | ||
holdingUp, letSleep = false, true | ||
end | ||
end | ||
if #(playerPos - Stores[store].position) > Config.MaxDistance then | ||
TriggerServerEvent("esx_holdup:tooFar", store) | ||
holdingUp, letSleep = false, true | ||
end | ||
end | ||
if letSleep then | ||
Wait(500) | ||
end | ||
end | ||
end | ||
end) |
144 changes: 75 additions & 69 deletions
144
server-data/resources/[esx_addons]/esx_holdup/config.lua
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,80 +1,86 @@ | ||
Config = {} | ||
Config.Locale = 'it' | ||
Config.Locale = "en" | ||
|
||
Config.Marker = { | ||
r = 250, g = 0, b = 0, a = 100, -- red color | ||
x = 1.0, y = 1.0, z = 1.5, -- tiny, cylinder formed circle | ||
DrawDistance = 15.0, Type = 1 -- default circle type, low draw distance due to indoors area | ||
r = 250, | ||
g = 0, | ||
b = 0, | ||
a = 100, -- red color | ||
x = 1.0, | ||
y = 1.0, | ||
z = 1.5, -- tiny, cylinder formed circle | ||
DrawDistance = 15.0, | ||
Type = 1, -- default circle type, low draw distance due to indoors area | ||
} | ||
|
||
Config.PoliceNumberRequired = 2 | ||
Config.TimerBeforeNewRob = 1800 -- The cooldown timer on a store after robbery was completed / canceled, in seconds | ||
Config.TimerBeforeNewRob = 1800 -- The cooldown timer on a store after robbery was completed / canceled, in seconds | ||
|
||
Config.MaxDistance = 20 -- max distance from the robbary, going any longer away from it will to cancel the robbary | ||
Config.MaxDistance = 20 -- max distance from the robbary, going any longer away from it will to cancel the robbary | ||
Config.GiveBlackMoney = true -- give black money? If disabled it will give cash instead | ||
|
||
Stores = { | ||
['paleto_twentyfourseven'] = { | ||
position = vector3(1736.32, 6419.47, 34.03), | ||
reward = math.random(5000, 35000), | ||
nameOfStore = '24/7. (Paleto Bay)', | ||
secondsRemaining = 350, -- seconds | ||
lastRobbed = 0 | ||
}, | ||
['sandyshores_twentyfoursever'] = { | ||
position = vector3(1961.24, 3749.46, 31.34), | ||
reward = math.random(3000, 20000), | ||
nameOfStore = '24/7. (Sandy Shores)', | ||
secondsRemaining = 200, -- seconds | ||
lastRobbed = 0 | ||
}, | ||
['littleseoul_twentyfourseven'] = { | ||
position = vector3(-709.17, -904.21, 18.21), | ||
reward = math.random(3000, 20000), | ||
nameOfStore = '24/7. (Little Seoul)', | ||
secondsRemaining = 200, -- seconds | ||
lastRobbed = 0 | ||
}, | ||
['bar_one'] = { | ||
position = vector3(1990.57, 3044.95, 46.21), | ||
reward = math.random(5000, 35000), | ||
nameOfStore = 'Yellow Jack. (Sandy Shores)', | ||
secondsRemaining = 300, -- seconds | ||
lastRobbed = 0 | ||
}, | ||
['ocean_liquor'] = { | ||
position = vector3(-2959.33, 388.21, 13.00), | ||
reward = math.random(3000, 30000), | ||
nameOfStore = 'Robs Liquor. (Great Ocean Highway)', | ||
secondsRemaining = 200, -- seconds | ||
lastRobbed = 0 | ||
}, | ||
['rancho_liquor'] = { | ||
position = vector3(1126.80, -980.40, 44.41), | ||
reward = math.random(3000, 50000), | ||
nameOfStore = 'Robs Liquor. (El Rancho Blvd)', | ||
secondsRemaining = 200, -- seconds | ||
lastRobbed = 0 | ||
}, | ||
['sanandreas_liquor'] = { | ||
position = vector3(-1219.85, -916.27, 10.32), | ||
reward = math.random(3000, 30000), | ||
nameOfStore = 'Robs Liquor. (San Andreas Avenue)', | ||
secondsRemaining = 200, -- seconds | ||
lastRobbed = 0 | ||
}, | ||
['grove_ltd'] = { | ||
position = vector3(-43.40, -1749.20, 28.42), | ||
reward = math.random(3000, 15000), | ||
nameOfStore = 'LTD Gasoline. (Grove Street)', | ||
secondsRemaining = 200, -- seconds | ||
lastRobbed = 0 | ||
}, | ||
['mirror_ltd'] = { | ||
position = vector3(1160.67, -314.40, 68.20), | ||
reward = math.random(3000, 15000), | ||
nameOfStore = 'LTD Gasoline. (Mirror Park Boulevard)', | ||
secondsRemaining = 200, -- seconds | ||
lastRobbed = 0 | ||
} | ||
["paleto_twentyfourseven"] = { | ||
position = vector3(1736.32, 6419.47, 34.03), | ||
reward = math.random(5000, 35000), | ||
nameOfStore = "24/7. (Paleto Bay)", | ||
secondsRemaining = 350, -- seconds | ||
lastRobbed = 0, | ||
}, | ||
["sandyshores_twentyfoursever"] = { | ||
position = vector3(1961.24, 3749.46, 31.34), | ||
reward = math.random(3000, 20000), | ||
nameOfStore = "24/7. (Sandy Shores)", | ||
secondsRemaining = 200, -- seconds | ||
lastRobbed = 0, | ||
}, | ||
["littleseoul_twentyfourseven"] = { | ||
position = vector3(-709.17, -904.21, 18.21), | ||
reward = math.random(3000, 20000), | ||
nameOfStore = "24/7. (Little Seoul)", | ||
secondsRemaining = 200, -- seconds | ||
lastRobbed = 0, | ||
}, | ||
["bar_one"] = { | ||
position = vector3(1990.57, 3044.95, 46.21), | ||
reward = math.random(5000, 35000), | ||
nameOfStore = "Yellow Jack. (Sandy Shores)", | ||
secondsRemaining = 300, -- seconds | ||
lastRobbed = 0, | ||
}, | ||
["ocean_liquor"] = { | ||
position = vector3(-2959.33, 388.21, 13.00), | ||
reward = math.random(3000, 30000), | ||
nameOfStore = "Robs Liquor. (Great Ocean Highway)", | ||
secondsRemaining = 200, -- seconds | ||
lastRobbed = 0, | ||
}, | ||
["rancho_liquor"] = { | ||
position = vector3(1126.80, -980.40, 44.41), | ||
reward = math.random(3000, 50000), | ||
nameOfStore = "Robs Liquor. (El Rancho Blvd)", | ||
secondsRemaining = 200, -- seconds | ||
lastRobbed = 0, | ||
}, | ||
["sanandreas_liquor"] = { | ||
position = vector3(-1219.85, -916.27, 10.32), | ||
reward = math.random(3000, 30000), | ||
nameOfStore = "Robs Liquor. (San Andreas Avenue)", | ||
secondsRemaining = 200, -- seconds | ||
lastRobbed = 0, | ||
}, | ||
["grove_ltd"] = { | ||
position = vector3(-43.40, -1749.20, 28.42), | ||
reward = math.random(3000, 15000), | ||
nameOfStore = "LTD Gasoline. (Grove Street)", | ||
secondsRemaining = 200, -- seconds | ||
lastRobbed = 0, | ||
}, | ||
["mirror_ltd"] = { | ||
position = vector3(1160.67, -314.40, 68.20), | ||
reward = math.random(3000, 15000), | ||
nameOfStore = "LTD Gasoline. (Mirror Park Boulevard)", | ||
secondsRemaining = 200, -- seconds | ||
lastRobbed = 0, | ||
}, | ||
} |
Oops, something went wrong.