Minor changes, added futher configuration

This commit is contained in:
ElPumpo
2018-08-14 17:29:34 +02:00
parent 2913e35009
commit 93c075e958
4 changed files with 35 additions and 32 deletions
+15 -21
View File
@@ -22,12 +22,6 @@ Citizen.CreateThread(function()
end
end)
function DisplayHelpText(str)
SetTextComponentFormat("STRING")
AddTextComponentString(str)
DisplayHelpTextFromStringLabel(0, 0, 1, -1)
end
function drawTxt(x,y ,width,height,scale, text, r,g,b,a, outline)
SetTextFont(0)
SetTextProportional(0)
@@ -36,9 +30,7 @@ function drawTxt(x,y ,width,height,scale, text, r,g,b,a, outline)
SetTextDropShadow(0, 0, 0, 0,255)
SetTextEdge(1, 0, 0, 0, 255)
SetTextDropShadow()
if(outline)then
SetTextOutline()
end
if outline then SetTextOutline() end
SetTextEntry("STRING")
AddTextComponentString(text)
DrawText(x - width/2, y - height/2 + 0.005)
@@ -87,13 +79,14 @@ AddEventHandler('esx_holdup:starttimer', function()
timer = Stores[store].secondsRemaining
Citizen.CreateThread(function()
while timer > 0 do
Citizen.Wait(0)
Citizen.Wait(1000)
if(timer > 0)then
if timer > 0 then
timer = timer - 1
end
end
end)
Citizen.CreateThread(function()
while true do
Citizen.Wait(0)
@@ -108,13 +101,14 @@ end)
Citizen.CreateThread(function()
for k,v in pairs(Stores)do
for k,v in pairs(Stores) do
local ve = v.position
local blip = AddBlipForCoord(ve.x, ve.y, ve.z)
SetBlipSprite(blip, 156)
SetBlipScale(blip, 0.8)
SetBlipAsShortRange(blip, true)
BeginTextCommandSetBlipName("STRING")
AddTextComponentString(_U('shop_robbery'))
EndTextCommandSetBlipName(blip)
@@ -126,27 +120,29 @@ incircle = false
Citizen.CreateThread(function()
while true do
Citizen.Wait(1)
local pos = GetEntityCoords(GetPlayerPed(-1), true)
local pos = GetEntityCoords(PlayerPedId(), true)
for k,v in pairs(Stores)do
local pos2 = v.position
if(Vdist(pos.x, pos.y, pos.z, pos2.x, pos2.y, pos2.z) < 15.0)then
if Vdist(pos.x, pos.y, pos.z, pos2.x, pos2.y, pos2.z) < 15.0 then
if not holdingup then
DrawMarker(1, v.position.x, v.position.y, v.position.z - 1, 0, 0, 0, 0, 0, 0, 1.0001, 1.0001, 1.5001, 1555, 0, 0,255, 0, 0, 0,0)
if(Vdist(pos.x, pos.y, pos.z, pos2.x, pos2.y, pos2.z) < 1.0)then
if (incircle == false) then
DisplayHelpText(_U('press_to_rob', v.nameofstore))
if Vdist(pos.x, pos.y, pos.z, pos2.x, pos2.y, pos2.z) < 1.0 then
if not incirle then
ESX.ShowHelpNotification(_U('press_to_rob', v.nameofstore))
end
incircle = true
if IsControlJustReleased(0, Keys['E']) then
if IsPedArmed(GetPlayerPed(-1), 4) then
if IsPedArmed(PlayerPedId(), 4) then
TriggerServerEvent('esx_holdup:rob', k)
else
ESX.ShowNotification(_U('no_threat'))
end
end
elseif(Vdist(pos.x, pos.y, pos.z, pos2.x, pos2.y, pos2.z) > 1.0)then
incircle = false
end
@@ -157,11 +153,9 @@ Citizen.CreateThread(function()
if holdingup then
local pos2 = Stores[store].position
if(Vdist(pos.x, pos.y, pos.z, pos2.x, pos2.y, pos2.z) > 13)then
if Vdist(pos.x, pos.y, pos.z, pos2.x, pos2.y, pos2.z) > Config.MaxDistance then
TriggerServerEvent('esx_holdup:toofar', store)
end
end
end
end)
+12 -9
View File
@@ -4,65 +4,68 @@ Config.Locale = 'fr'
Config.PoliceNumberRequired = 2
Config.TimerBeforeNewRob = 1800 -- seconds
Config.MaxDistance = 40 -- 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 = { ['x'] = 1736.32, ['y'] = 6419.47, ['z'] = 35.03 },
position = { x = 1736.32, y = 6419.47, z = 35.03 },
reward = math.random(5000, 35000),
nameofstore = "24/7. (Paleto Bay)",
secondsRemaining = 350, -- seconds
lastrobbed = 0
},
["sandyshores_twentyfoursever"] = {
position = { ['x'] = 1961.24, ['y'] = 3749.46, ['z'] = 32.34 },
position = { x = 1961.24, y = 3749.46, z = 32.34 },
reward = math.random(3000, 20000),
nameofstore = "24/7. (Sandy Shores)",
secondsRemaining = 200, -- seconds
lastrobbed = 0
},
["littleseoul_twentyfourseven"] = {
position = { ['x'] = -709.17, ['y'] = -904.21, ['z'] = 19.21 },
position = { x = -709.17, y = -904.21, z = 19.21 },
reward = math.random(3000, 20000),
nameofstore = "24/7. (Little Seoul)",
secondsRemaining = 200, -- seconds
lastrobbed = 0
},
["bar_one"] = {
position = { ['x'] = 1990.57, ['y'] = 3044.95, ['z'] = 47.21 },
position = { x = 1990.57, y = 3044.95, z = 47.21 },
reward = math.random(5000, 35000),
nameofstore = "Yellow Jack. (Sandy Shores)",
secondsRemaining = 300, -- seconds
lastrobbed = 0
},
["ocean_liquor"] = {
position = { ['x'] = -2959.33, ['y'] = 388.21, ['z'] = 14.00 },
position = { x = -2959.33, y = 388.21, z = 14.00 },
reward = math.random(3000, 30000),
nameofstore = "Robs Liquor. (Great Ocean Highway)",
secondsRemaining = 200, -- seconds
lastrobbed = 0
},
["rancho_liquor"] = {
position = { ['x'] = 1126.80, ['y'] = -980.40, ['z'] = 45.41 },
position = { x = 1126.80, y = -980.40, z = 45.41 },
reward = math.random(3000, 50000),
nameofstore = "Robs Liquor. (El Rancho Blvd)",
secondsRemaining = 200, -- seconds
lastrobbed = 0
},
["sanandreas_liquor"] = {
position = { ['x'] = -1219.85, ['y'] = -916.27, ['z'] = 11.32 },
position = { x = -1219.85, y = -916.27, z = 11.32 },
reward = math.random(3000, 30000),
nameofstore = "Robs Liquor. (San Andreas Avenue)",
secondsRemaining = 200, -- seconds
lastrobbed = 0
},
["grove_ltd"] = {
position = { ['x'] = -43.40, ['y'] = -1749.20, ['z'] = 29.42 },
position = { x = -43.40, y = -1749.20, z = 29.42 },
reward = math.random(3000, 15000),
nameofstore = "LTD Gasoline. (Grove Street)",
secondsRemaining = 200, -- seconds
lastrobbed = 0
},
["mirror_ltd"] = {
position = { ['x'] = 1160.67, ['y'] = -314.40, ['z'] = 69.20 },
position = { x = 1160.67, y = -314.40, z = 69.20 },
reward = math.random(3000, 15000),
nameofstore = "LTD Gasoline. (Mirror Park Boulevard)",
secondsRemaining = 200, -- seconds
+1 -1
View File
@@ -6,7 +6,7 @@ Locales['sv'] = {
['rob_in_prog'] = '~r~Det är ett pågående rån vid ~b~%s~s~',
['started_to_rob'] = 'du började att råna ~y~%s~s~, gå inte för långt från butiken!',
['alarm_triggered'] = '~o~Larmet har utlösts~s~',
['robbery_complete'] = '~r~Rånet är avklarat~s~, du stal ~g~$%s~s~!',
['robbery_complete'] = '~r~Rånet är avklarat~s~, du stal ~r~%s SEK~s~!',
['robbery_complete_at'] = '~r~Ett rån lyckades~s~ vid ~y~%s~s~',
['robbery_cancelled'] = 'rånet har avbrutits!',
['robbery_cancelled_at'] = '~r~Rånet~s~ vid ~b~%s~s~ har avbrutits!',
+7 -1
View File
@@ -49,6 +49,7 @@ AddEventHandler('esx_holdup:rob', function(robb)
if not rob then
if cops >= Config.PoliceNumberRequired then
rob = true
for i=1, #xPlayers, 1 do
local xPlayer = ESX.GetPlayerFromId(xPlayers[i])
if xPlayer.job.name == 'police' then
@@ -73,7 +74,12 @@ AddEventHandler('esx_holdup:rob', function(robb)
if xPlayer then
local award = store.reward
TriggerClientEvent('esx_holdup:robberycomplete', savedSource, award)
xPlayer.addAccountMoney('black_money', award)
if Config.GiveBlackMoney then
xPlayer.addAccountMoney('black_money', award)
else
xPlayer.addMoney(award)
end
local xPlayers = ESX.GetPlayers()
for i=1, #xPlayers, 1 do