mirror of
https://github.com/esx-framework/esx_core.git
synced 2026-08-31 18:28:52 +00:00
Old file names deletion
This commit is contained in:
@@ -1,142 +0,0 @@
|
||||
local holdingup = false
|
||||
local store = ""
|
||||
local secondsRemaining = 0
|
||||
local blipRobbery = nil
|
||||
ESX = nil
|
||||
|
||||
Citizen.CreateThread(function()
|
||||
while ESX == nil do
|
||||
TriggerEvent('esx:getSharedObject', function(obj) ESX = obj end)
|
||||
Citizen.Wait(0)
|
||||
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)
|
||||
SetTextScale(scale, scale)
|
||||
SetTextColour(r, g, b, a)
|
||||
SetTextDropShadow(0, 0, 0, 0,255)
|
||||
SetTextEdge(1, 0, 0, 0, 255)
|
||||
SetTextDropShadow()
|
||||
if(outline)then
|
||||
SetTextOutline()
|
||||
end
|
||||
SetTextEntry("STRING")
|
||||
AddTextComponentString(text)
|
||||
DrawText(x - width/2, y - height/2 + 0.005)
|
||||
end
|
||||
|
||||
RegisterNetEvent('esx_holdup:currentlyrobbing')
|
||||
AddEventHandler('esx_holdup:currentlyrobbing', function(robb)
|
||||
holdingup = true
|
||||
store = robb
|
||||
secondsRemaining = 300
|
||||
end)
|
||||
|
||||
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.x, position.y, position.z)
|
||||
SetBlipSprite(blipRobbery , 161)
|
||||
SetBlipScale(blipRobbery , 2.0)
|
||||
SetBlipColour(blipRobbery, 3)
|
||||
PulseBlip(blipRobbery)
|
||||
end)
|
||||
|
||||
RegisterNetEvent('esx_holdup:toofarlocal')
|
||||
AddEventHandler('esx_holdup:toofarlocal', function(robb)
|
||||
holdingup = false
|
||||
ESX.ShowNotification(_U('robbery_cancelled'))
|
||||
robbingName = ""
|
||||
secondsRemaining = 0
|
||||
incircle = false
|
||||
end)
|
||||
|
||||
|
||||
RegisterNetEvent('esx_holdup:robberycomplete')
|
||||
AddEventHandler('esx_holdup:robberycomplete', function(robb)
|
||||
holdingup = false
|
||||
ESX.ShowNotification(_U('robbery_cancelled') .. Stores[store].reward)
|
||||
store = ""
|
||||
secondsRemaining = 0
|
||||
incircle = false
|
||||
end)
|
||||
|
||||
Citizen.CreateThread(function()
|
||||
while true do
|
||||
Citizen.Wait(0)
|
||||
if holdingup then
|
||||
Citizen.Wait(1000)
|
||||
if(secondsRemaining > 0)then
|
||||
secondsRemaining = secondsRemaining - 1
|
||||
end
|
||||
end
|
||||
end
|
||||
end)
|
||||
|
||||
Citizen.CreateThread(function()
|
||||
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)
|
||||
end
|
||||
end)
|
||||
incircle = false
|
||||
|
||||
Citizen.CreateThread(function()
|
||||
while true do
|
||||
local pos = GetEntityCoords(GetPlayerPed(-1), 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 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)
|
||||
end
|
||||
incircle = true
|
||||
if IsControlJustReleased(1, 51) then
|
||||
TriggerServerEvent('esx_holdup:rob', k)
|
||||
end
|
||||
elseif(Vdist(pos.x, pos.y, pos.z, pos2.x, pos2.y, pos2.z) > 1.0)then
|
||||
incircle = false
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
if holdingup then
|
||||
|
||||
drawTxt(0.66, 1.44, 1.0,1.0,0.4, _U('robbery_of') .. secondsRemaining .. _U('seconds_remaining'), 255, 255, 255, 255)
|
||||
|
||||
local pos2 = Stores[store].position
|
||||
|
||||
if(Vdist(pos.x, pos.y, pos.z, pos2.x, pos2.y, pos2.z) > 7.5)then
|
||||
TriggerServerEvent('esx_holdup:toofar', store)
|
||||
end
|
||||
end
|
||||
|
||||
Citizen.Wait(0)
|
||||
end
|
||||
end)
|
||||
@@ -1,104 +0,0 @@
|
||||
local rob = false
|
||||
local robbers = {}
|
||||
ESX = nil
|
||||
|
||||
TriggerEvent('esx:getSharedObject', function(obj) ESX = obj end)
|
||||
|
||||
function get3DDistance(x1, y1, z1, x2, y2, z2)
|
||||
return math.sqrt(math.pow(x1 - x2, 2) + math.pow(y1 - y2, 2) + math.pow(z1 - z2, 2))
|
||||
end
|
||||
|
||||
RegisterServerEvent('esx_holdup:toofar')
|
||||
AddEventHandler('esx_holdup:toofar', function(robb)
|
||||
local source = source
|
||||
local xPlayers = ESX.GetPlayers()
|
||||
rob = false
|
||||
for i=1, #xPlayers, 1 do
|
||||
local xPlayer = ESX.GetPlayerFromId(xPlayers[i])
|
||||
if xPlayer.job.name == 'police' then
|
||||
TriggerClientEvent('esx:showNotification', xPlayers[i], _U('robbery_cancelled_at') .. Stores[robb].nameofstore)
|
||||
TriggerClientEvent('esx_holdup:killblip', xPlayers[i])
|
||||
end
|
||||
end
|
||||
if(robbers[source])then
|
||||
TriggerClientEvent('esx_holdup:toofarlocal', source)
|
||||
robbers[source] = nil
|
||||
TriggerClientEvent('esx:showNotification', source, _U('robbery_has_cancelled') .. Stores[robb].nameofstore)
|
||||
end
|
||||
end)
|
||||
|
||||
RegisterServerEvent('esx_holdup:rob')
|
||||
AddEventHandler('esx_holdup:rob', function(robb)
|
||||
|
||||
local source = source
|
||||
local xPlayer = ESX.GetPlayerFromId(source)
|
||||
local xPlayers = ESX.GetPlayers()
|
||||
|
||||
if Stores[robb] then
|
||||
|
||||
local store = Stores[robb]
|
||||
|
||||
if (os.time() - store.lastrobbed) < 600 and store.lastrobbed ~= 0 then
|
||||
|
||||
TriggerClientEvent('esx:showNotification', source, _U('already_robbed') .. (1800 - (os.time() - store.lastrobbed)) .. _U('seconds'))
|
||||
return
|
||||
end
|
||||
|
||||
|
||||
local cops = 0
|
||||
for i=1, #xPlayers, 1 do
|
||||
local xPlayer = ESX.GetPlayerFromId(xPlayers[i])
|
||||
if xPlayer.job.name == 'police' then
|
||||
cops = cops + 1
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
if rob == false then
|
||||
|
||||
if(cops > 1)then
|
||||
|
||||
rob = true
|
||||
for i=1, #xPlayers, 1 do
|
||||
local xPlayer = ESX.GetPlayerFromId(xPlayers[i])
|
||||
if xPlayer.job.name == 'police' then
|
||||
TriggerClientEvent('esx:showNotification', xPlayers[i], _U('rob_in_prog') .. store.nameofstore)
|
||||
TriggerClientEvent('esx_holdup:setblip', xPlayers[i], Stores[robb].position)
|
||||
end
|
||||
end
|
||||
|
||||
TriggerClientEvent('esx:showNotification', source, _U('started_to_rob') .. store.nameofstore .. _U('do_not_move'))
|
||||
TriggerClientEvent('esx:showNotification', source, _U('alarm_triggered'))
|
||||
TriggerClientEvent('esx:showNotification', source, _U('hold_pos'))
|
||||
TriggerClientEvent('esx_holdup:currentlyrobbing', source, robb)
|
||||
Stores[robb].lastrobbed = os.time()
|
||||
robbers[source] = robb
|
||||
local savedSource = source
|
||||
SetTimeout(300000, function()
|
||||
|
||||
if(robbers[savedSource])then
|
||||
|
||||
rob = false
|
||||
TriggerClientEvent('esx_holdup:robberycomplete', savedSource, job)
|
||||
if(xPlayer)then
|
||||
|
||||
xPlayer.addAccountMoney('black_money', store.reward)
|
||||
local xPlayers = ESX.GetPlayers()
|
||||
for i=1, #xPlayers, 1 do
|
||||
local xPlayer = ESX.GetPlayerFromId(xPlayers[i])
|
||||
if xPlayer.job.name == 'police' then
|
||||
TriggerClientEvent('esx:showNotification', xPlayers[i], _U('robbery_complete_at') .. store.nameofstore)
|
||||
TriggerClientEvent('esx_holdup:killblip', xPlayers[i])
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
end)
|
||||
else
|
||||
TriggerClientEvent('esx:showNotification', source, _U('min_two_police'))
|
||||
end
|
||||
else
|
||||
TriggerClientEvent('esx:showNotification', source, _U('robbery_already'))
|
||||
end
|
||||
end
|
||||
end)
|
||||
Reference in New Issue
Block a user