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)