ESX = nil local PlayerData = {} local bomba, rob_status = false, true local timer = GetGameTimer() local prev_timer = 0 local stand = {} local policeNPCs = {} local policeNPCsActive = false -- Grup jaf local grupJaf = {} local esteLeader = false local jafulConfirmat = false local esteInGrup = false local aresteaza = false local planteazaBomba = false -- true pe durata animatiei de plantare bomba local jafActiv = false -- true DOAR dupa ce bomba e complet plantata si vitrinele sunt active -- HUD local hudTimpRamas = 0 local hudVitrineSparte = 0 local hudVitrineTotale = 20 local hudActiv = false -- NPC local npcPed = nil local NPC_COORDS = vector4(-584.8597, -287.2092, 41.6941, 112.4056) local TELEPORT_COORDS = vector4(-629.367004, -215.762634, 53.543580, 22.677164) local PUSCARIE_COORDS = vector4(1590.6698, 2553.3955, 49.9403, 90.0572) ----------------------------- -- ESX Init ----------------------------- Citizen.CreateThread(function() while ESX == nil do TriggerEvent('esx:getSharedObject', function(obj) ESX = obj end) Citizen.Wait(0) end while ESX.GetPlayerData().job == nil do Citizen.Wait(10) end PlayerData = ESX.GetPlayerData() local blip = AddBlipForCoord(-624.963, -232.908, 38.057) SetBlipSprite(blip, 439) SetBlipDisplay(blip, 4) SetBlipScale(blip, 0.7) SetBlipColour(blip, 5) SetBlipAsShortRange(blip, true) BeginTextCommandSetBlipName("STRING") AddTextComponentString(Config.Lang['blip']) EndTextCommandSetBlipName(blip) SpawnJafNPC() end) RegisterNetEvent('esx:setJob') AddEventHandler('esx:setJob', function(job) PlayerData.job = job end) ----------------------------- -- Spawn NPC ----------------------------- function SpawnJafNPC() local model = GetHashKey("s_m_y_uscg_01") RequestModel(model) while not HasModelLoaded(model) do Citizen.Wait(10) end npcPed = CreatePed(4, model, NPC_COORDS.x, NPC_COORDS.y, NPC_COORDS.z - 1.0, NPC_COORDS.w, false, true) SetEntityAsMissionEntity(npcPed, true, true) SetBlockingOfNonTemporaryEvents(npcPed, true) SetPedDiesWhenInjured(npcPed, false) SetEntityInvincible(npcPed, true) FreezeEntityPosition(npcPed, true) SetPedCanRagdoll(npcPed, false) SetModelAsNoLongerNeeded(model) end ----------------------------- -- Raza de detectie jucatori langa NPC ----------------------------- local PROX_RAZA = 10.0 -- metri in jurul NPC-ului ----------------------------- -- Thread NPC interactie ----------------------------- Citizen.CreateThread(function() while true do local w = 2000 if npcPed and DoesEntityExist(npcPed) then local myCoords = GetEntityCoords(PlayerPedId()) local d = #(myCoords - vector3(NPC_COORDS.x, NPC_COORDS.y, NPC_COORDS.z)) if d < 3.0 then w = 5 -- Numara jucatori din proximitate pentru hint local nearby = GetNearbyPlayerIds() local count = #nearby if count >= 1 then DrawText3D(NPC_COORDS.x, NPC_COORDS.y, NPC_COORDS.z + 1.0, "~g~[E]~w~ Incepe Jaf (~y~" .. count .. " jucatori in zona~w~)") else DrawText3D(NPC_COORDS.x, NPC_COORDS.y, NPC_COORDS.z + 1.0, "~r~Niciun jucator in proximitate~w~ (raza " .. PROX_RAZA .. "m)") end if IsControlJustPressed(0, 38) then DeschideMenuJaf() end end end Citizen.Wait(w) end end) ----------------------------- -- Returneaza lista de server ID-uri ale jucatorilor din proximitatea NPC ----------------------------- function GetNearbyPlayerIds() local result = {} local myId = PlayerId() local npcPos = vector3(NPC_COORDS.x, NPC_COORDS.y, NPC_COORDS.z) for _, playerId in ipairs(GetActivePlayers()) do if playerId ~= myId then local ped = GetPlayerPed(playerId) if DoesEntityExist(ped) then local pos = GetEntityCoords(ped) local dist = #(pos - npcPos) if dist <= PROX_RAZA then -- Obtine server ID din network player id local serverId = GetPlayerServerId(playerId) table.insert(result, serverId) if #result >= 3 then break end -- maxim 3 (eu + 3 = 4 total) end end end end return result end ----------------------------- -- Porneste jaful cu jucatorii din proximitate ----------------------------- function DeschideMenuJaf() CreateThread(function() local nearby = GetNearbyPlayerIds() if #nearby < 1 then AfisTextCentru('~r~Jaf Vangelico', 'Niciun jucator gasit in proximitate (' .. PROX_RAZA .. 'm)!', 5000) return end -- Construieste lista cu numele jucatorilor gasiti local numeJucatori = "" for i, serverId in ipairs(nearby) do -- Gaseste player local id dupa server id for _, pid in ipairs(GetActivePlayers()) do if GetPlayerServerId(pid) == serverId then numeJucatori = numeJucatori .. "\n• " .. GetPlayerName(pid) .. " (ID: " .. serverId .. ")" break end end end -- Confirmare cu lista jucatorilor detectati local result = lib.alertDialog({ header = 'Jaf Vangelico - Grup detectat', content = 'Au fost gasiti ' .. #nearby .. ' jucatori in proximitate (' .. PROX_RAZA .. 'm):' .. numeJucatori .. '\n\nVrei sa trimiti invitatii la toti?', centered = true, cancel = true, labels = { confirm = 'Trimite Invitatii', cancel = 'Anuleaza' } }) if result ~= 'confirm' then return end TriggerServerEvent('av_vangelico:inviteMembers', nearby) AfisTextCentru('~y~Jaf Vangelico', 'Invitatii trimise la ' .. #nearby .. ' jucatori! Asteapta...', 5000) end) end ----------------------------- -- Primeste invitatie grup ----------------------------- RegisterNetEvent('av_vangelico:primitiInvitatie') AddEventHandler('av_vangelico:primitiInvitatie', function(leaderName) CreateThread(function() local result = lib.alertDialog({ header = 'Invitatie Jaf Vangelico', content = leaderName .. ' te invita sa participi la jaful Vangelico. Accepti?', centered = true, cancel = true, labels = { confirm = 'Accepta', cancel = 'Refuza' } }) -- result == 'confirm' daca a acceptat, altceva/nil daca a refuzat TriggerServerEvent('av_vangelico:raspunsInvitatie', result == 'confirm') end) end) ----------------------------- -- Server confirma grupul format + teleport ----------------------------- RegisterNetEvent('av_vangelico:grupFormat') AddEventHandler('av_vangelico:grupFormat', function(members, isLeader) grupJaf = {} for _, id in ipairs(members) do grupJaf[id] = true end esteLeader = isLeader esteInGrup = true jafulConfirmat = false aresteaza = false print('^2[VANGELICO DEBUG] ^7grupFormat primit -> esteInGrup=TRUE | esteLeader=' .. tostring(isLeader) .. ' | membri=' .. #members) AfisTextCentru('~g~Jaf Vangelico', 'Grupul format (' .. #members .. ' membri)! Teleportare...', 4000) AfisObiectivMisiune('JAFUL VANGELICO INCEPE', 5000, 255, 200, 50) Citizen.Wait(1500) local p = PlayerPedId() SetEntityCoords(p, TELEPORT_COORDS.x, TELEPORT_COORDS.y, TELEPORT_COORDS.z, false, false, false, true) SetEntityHeading(p, TELEPORT_COORDS.w) if isLeader then Citizen.Wait(800) AfisTextCentru('~y~Pas 1/3', 'Esti liderul. Confirma startul jaful.', 6000) CreateThread(function() local result = lib.alertDialog({ header = 'Confirma Jaful', content = 'Esti gata sa incepi jaful? Toti membrii vor fi anuntati sa mearga la ventilatie.', centered = true, cancel = true, labels = { confirm = 'Confirma', cancel = 'Anuleaza' } }) if result == 'confirm' then TriggerServerEvent('av_vangelico:confirmaJaf') end end) else Citizen.Wait(800) AfisTextCentru('~y~Pas 1/3', 'Ai ajuns la locatie. Asteapta confirmarea liderului.', 6000) end end) ----------------------------- -- Jaful a fost confirmat de leader ----------------------------- RegisterNetEvent('av_vangelico:jafulIncepe') AddEventHandler('av_vangelico:jafulIncepe', function() jafulConfirmat = true print('^2[VANGELICO DEBUG] ^7jafulIncepe primit -> jafulConfirmat=TRUE | esteInGrup=' .. tostring(esteInGrup)) AfisTextCentru('~y~Pas 2/3 - Planteaza Bomba', 'Mergi la ventilatie si apasa ~r~[E]~w~ pentru a planta bomba.', 8000) AfisObiectivMisiune('PLANTEAZA BOMBA CU GAZ', 10000, 255, 200, 50) end) ----------------------------- -- Invitatie respinsa notificare ----------------------------- RegisterNetEvent('av_vangelico:notify_accept') AddEventHandler('av_vangelico:notify_accept', function(name) AfisTextCentru('~g~' .. name .. ' a acceptat invitatia!', '', 4000) end) RegisterNetEvent('av_vangelico:notify_err') AddEventHandler('av_vangelico:notify_err', function(msg) AfisTextCentru('~r~Jaf Vangelico', msg, 5000) end) RegisterNetEvent('av_vangelico:invitatieRespinsa') AddEventHandler('av_vangelico:invitatieRespinsa', function(name) AfisTextCentru('~r~' .. name .. ' a refuzat invitatia.', '', 4000) end) ----------------------------- -- Thread ventilatie - blocat pana jaful e confirmat ----------------------------- Citizen.CreateThread(function() while true do local w = 2000 local d = #(GetEntityCoords(PlayerPedId()) - vector3(Config.AirVent[1], Config.AirVent[2], Config.AirVent[3])) if d <= Config.AirVentDist and not bomba then w = 5 if jafulConfirmat and esteInGrup then if d > 1 and d <= Config.AirVentDist then DrawText3D(Config.AirVent[1], Config.AirVent[2], Config.AirVent[3], Config.Lang['air_vent']) elseif d <= 1 then DrawText3D(Config.AirVent[1], Config.AirVent[2], Config.AirVent[3], Config.Lang['plant_gas']) end if IsControlJustPressed(0, 38) and d < 1 then ESX.TriggerServerCallback('av_vangelico:cooldown', function(cooldown) if cooldown then AfisTextCentru('~r~Jaf Vangelico', Config.Lang['cooldown'], 5000) else bomba = true TriggerEvent('av_vangelico:bomba') TriggerServerEvent("av_vangelico:timer") end end) end else if d <= Config.AirVentDist then DrawText3D(Config.AirVent[1], Config.AirVent[2], Config.AirVent[3], "~r~Asteapta confirmarea liderului") end end end Citizen.Wait(w) end end) ----------------------------- -- Thread spargere vitrine ----------------------------- Citizen.CreateThread(function() while true do local w = 500 local p = PlayerPedId() local c = GetEntityCoords(p) if not rob_status then if timer == prev_timer then prev_timer = timer timer = GetGameTimer() end w = 5 if aresteaza then Citizen.Wait(w) goto continua end for i = 1, #stand do local s = stand[i] if GetDistanceBetweenCoords(c, s.x, s.y, s.z, true) < 1 and not s.broken then DrawText3D(s.x, s.y, s.z, Config.Lang['break']) if IsControlJustPressed(0, 38) then local canBreak = false if Config.WeaponsWL then local wp = GetSelectedPedWeapon(p) canBreak = hasWeapon(wp) if not canBreak then AfisTextCentru('~r~' .. Config.Lang['needs_weapon'], '', 3000) end else canBreak = true end if canBreak then s.broken = true TriggerServerEvent("av_vangelico:smash_counter", s.x, s.y, s.z, s.broken) PlaySoundFromCoord(-1, "Glass_Smash", s.x, s.y, s.z, "", 0, 0, 0) if not HasNamedPtfxAssetLoaded("scr_jewelheist") then RequestNamedPtfxAsset("scr_jewelheist") end while not HasNamedPtfxAssetLoaded("scr_jewelheist") do Citizen.Wait(0) end SetPtfxAssetNextCall("scr_jewelheist") StartParticleFxLoopedAtCoord("scr_jewel_cab_smash", s.x, s.y, s.z, 0.0, 0.0, 0.0, 1.0, false, false, false, false) anim("missheist_jewel") local calc_z = s.z - 1.46 SetEntityCoords(p, s.ax, s.ay, calc_z) SetEntityHeading(p, s.h) TaskPlayAnim(p, "missheist_jewel", "smash_case", 8.0, 3.0, -1, 2, 0, 0, 0, 0) Citizen.Wait(6000) ClearPedTasksImmediately(p) TriggerServerEvent('av_vangelico:stand') end end end end if GetGameTimer() - timer > Config.RobTime * 1000 * 60 then rob_status = true bomba = false prev_timer = timer TriggerServerEvent("av_vangelico:timer", rob_status, bomba) DespawnPoliceNPCs() end else w = 1000 end ::continua:: Citizen.Wait(w) end end) ----------------------------- -- Thread HUD - afiseaza timer si vitrine in timp real (top center) ----------------------------- Citizen.CreateThread(function() while true do Citizen.Wait(0) if hudActiv then local mins = math.floor(hudTimpRamas / 60) local secs = hudTimpRamas % 60 local timpStr = string.format('%02d:%02d', mins, secs) local culoareTimp = '~g~' if hudTimpRamas <= 30 then culoareTimp = '~r~' elseif hudTimpRamas <= 60 then culoareTimp = '~y~' end -- Timp ramas SetTextFont(4) SetTextScale(0.0, 0.55) SetTextColour(255, 255, 255, 255) SetTextOutline() SetTextCentre(true) SetTextEntry('STRING') AddTextComponentString('~w~Timp ramas: ' .. culoareTimp .. timpStr) DrawText(0.5, 0.03) -- Vitrine sparte local culoareVitrine = '~w~' if hudVitrineSparte >= hudVitrineTotale then culoareVitrine = '~g~' end SetTextFont(4) SetTextScale(0.0, 0.45) SetTextColour(255, 255, 255, 255) SetTextOutline() SetTextCentre(true) SetTextEntry('STRING') AddTextComponentString('~w~Vitrine sparte: ' .. culoareVitrine .. hudVitrineSparte .. '~w~/' .. hudVitrineTotale) DrawText(0.5, 0.075) end end end) ----------------------------- -- Text ARESTAT centrat ----------------------------- function AfisTxtArestat() Citizen.CreateThread(function() local duration = 5000 local start = GetGameTimer() while GetGameTimer() - start < duration do SetTextFont(4) SetTextScale(0.0, 0.7) SetTextColour(255, 50, 50, 255) SetTextCentre(true) SetTextOutline() SetTextEntry("STRING") AddTextComponentString("~r~AI FOST ARESTAT") DrawText(0.5, 0.4) Citizen.Wait(0) end end) end ----------------------------- -- Afiseaza obiectiv misiune pe ecran (stil GTA mission) ----------------------------- local obiectivActiv = nil -- tine referinta la obiectivul curent function AfisObiectivMisiune(text, durata, r, g, b) r = r or 255 g = g or 200 b = b or 50 durata = durata or 8000 -- Opreste obiectivul anterior daca exista if obiectivActiv then obiectivActiv.activ = false end local obiectiv = { activ = true } obiectivActiv = obiectiv Citizen.CreateThread(function() local start = GetGameTimer() local fadeIn = 500 local fadeOut = 500 while GetGameTimer() - start < durata and obiectiv.activ do local elapsed = GetGameTimer() - start local alpha = 255 -- Fade in if elapsed < fadeIn then alpha = math.floor((elapsed / fadeIn) * 255) end -- Fade out if elapsed > durata - fadeOut then alpha = math.floor(((durata - elapsed) / fadeOut) * 255) end if alpha < 0 then alpha = 0 end if alpha > 255 then alpha = 255 end -- Fundal semi-transparent (bara) DrawRect(0.5, 0.38, 0.35, 0.06, 0, 0, 0, math.floor(alpha * 0.6)) -- Linie decorativa sus DrawRect(0.5, 0.355, 0.35, 0.003, r, g, b, alpha) -- Text obiectiv SetTextFont(4) SetTextScale(0.0, 0.62) SetTextColour(r, g, b, alpha) SetTextCentre(true) SetTextOutline() SetTextEntry("STRING") AddTextComponentString(text) DrawText(0.5, 0.36) -- Linie decorativa jos DrawRect(0.5, 0.405, 0.35, 0.003, r, g, b, alpha) Citizen.Wait(0) end if obiectivActiv == obiectiv then obiectivActiv = nil end end) end ----------------------------- -- Wanted pentru membrii grupului ----------------------------- RegisterNetEvent('av_vangelico:setWanted') AddEventHandler('av_vangelico:setWanted', function(level) SetPlayerWantedLevel(PlayerId(), level, false) SetPlayerWantedLevelNow(PlayerId(), false) end) ----------------------------- -- Start spargere pentru membrii ----------------------------- RegisterNetEvent('av_vangelico:hudUpdate') AddEventHandler('av_vangelico:hudUpdate', function(timpRamas, vitrineSparte, vitrineTotale) hudTimpRamas = timpRamas hudVitrineSparte = vitrineSparte hudVitrineTotale = vitrineTotale end) RegisterNetEvent('av_vangelico:startSpargere') AddEventHandler('av_vangelico:startSpargere', function() jafActiv = true hudActiv = true hudVitrineSparte = 0 hudVitrineTotale = #stand > 0 and #stand or 20 print('^2[VANGELICO DEBUG] ^7startSpargere primit -> jafActiv=TRUE | hudActiv=TRUE | esteInGrup=' .. tostring(esteInGrup)) rob_status = false AfisTextCentru('~r~Pas 3/3 - Spargi Vitrinele!', 'Mergi la vitrine si apasa ~r~[E]~w~ pentru a le sparge!', 8000) AfisObiectivMisiune('SPARGE VITRINELE', 10000, 50, 200, 255) end) ----------------------------- -- Net events existente ----------------------------- RegisterNetEvent('av_vangelico:change_timer_status') AddEventHandler('av_vangelico:change_timer_status', function(rob_status_server, bomba_server) rob_status = rob_status_server bomba = bomba_server if rob_status_server then print('^1[VANGELICO DEBUG] ^7change_timer_status -> esteInGrup setat FALSE (jaf terminat/resetat)') DespawnPoliceNPCs() esteInGrup = false jafulConfirmat = false grupJaf = {} aresteaza = false jafActiv = false planteazaBomba = false hudActiv = false end end) ----------------------------- -- Jaf pierdut -> teleport puscarie ----------------------------- RegisterNetEvent('av_vangelico:jafReusit') AddEventHandler('av_vangelico:jafReusit', function() hudActiv = false jafActiv = false esteInGrup = false jafulConfirmat = false planteazaBomba = false DespawnPoliceNPCs() AfisTextCentru('~g~JAF REUSIT!', 'Felicitari! Ai spart toate vitrinele la timp!', 6000) AfisObiectivMisiune('JAF REUSIT!', 8000, 50, 255, 50) print('^2[VANGELICO DEBUG] ^7JAF REUSIT - HUD oprit') end) RegisterNetEvent('av_vangelico:jafPierdut') AddEventHandler('av_vangelico:jafPierdut', function() print('^1[VANGELICO DEBUG] ^7jafPierdut primit -> opresc jaful + teleport puscarie') -- Opreste imediat posibilitatea de a sparge vitrine aresteaza = true rob_status = true esteInGrup = false jafulConfirmat = false jafActiv = false planteazaBomba = false hudActiv = false print('^3[VANGELICO DEBUG] ^7aresteaza=TRUE | rob_status=TRUE | jafActiv=FALSE | hudActiv=FALSE -> vitrine blocate') CreateThread(function() local px, py, pz = PUSCARIE_COORDS.x, PUSCARIE_COORDS.y, PUSCARIE_COORDS.z local ph = PUSCARIE_COORDS.w AfisTextCentru('~r~AI PIERDUT JAFUL!', 'Esti transportat la inchisoare...', 3000) AfisObiectivMisiune('AI FOST ARESTAT!', 6000, 255, 50, 50) Citizen.Wait(1500) print('^3[VANGELICO DEBUG] ^7FadeOut inceput...') DoScreenFadeOut(800) while not IsScreenFadedOut() do Citizen.Wait(0) end local ped = PlayerPedId() SetEntityCoordsNoOffset(ped, px, py, pz, false, false, false) NetworkResurrectLocalPlayer(px, py, pz, ph, true, false) SetPlayerInvincible(ped, false) ClearPedBloodDamage(ped) FreezeEntityPosition(ped, false) print('^2[VANGELICO DEBUG] ^7NetworkResurrectLocalPlayer executat la puscarie') TriggerServerEvent('esx_ambulancejob:setDeathStatus', false) TriggerEvent('esx:onPlayerSpawn') TriggerServerEvent('esx:onPlayerSpawn') TriggerEvent('playerSpawned') DoScreenFadeIn(800) Citizen.Wait(300) ped = PlayerPedId() SetEntityCoords(ped, px, py, pz, false, false, false, true) SetEntityHeading(ped, ph) AfisTxtArestat() print('^2[VANGELICO DEBUG] ^7Teleport puscarie COMPLET | vitrine blocate permanent') end) end) RegisterNetEvent('av_vangelico:breakable_units') AddEventHandler('av_vangelico:breakable_units', function(stand_server) stand = stand_server end) RegisterNetEvent('av_vangelico:statusUpdate') AddEventHandler('av_vangelico:statusUpdate', function(status) rob_status = status end) RegisterNetEvent('av_vangelico:bomba') AddEventHandler('av_vangelico:bomba', function() local p = PlayerPedId() planteazaBomba = true -- blocheaza detectia mortii pe durata animatiei print('^3[VANGELICO DEBUG] ^7Animatie bomba incepe -> planteazaBomba=TRUE') ESX.Streaming.RequestAnimDict('anim@heists@ornate_bank@thermal_charge', function(dict) if HasAnimDictLoaded('anim@heists@ornate_bank@thermal_charge') then SetEntityCoords(p, -635.89, -213.86, 52.55) SetEntityHeading(p, 32.45) local fwd, _, _, pos = GetEntityMatrix(p) local np = (fwd * 0.8) + pos SetEntityCoords(p, np.xy, np.z - 1) local rot, pos2 = GetEntityRotation(p), GetEntityCoords(p) SetPedComponentVariation(p, 5, -1, 0, 0) local b = CreateObject(GetHashKey("hei_p_m_bag_var22_arm_s"), pos2.x, pos2.y, pos2.z, true, true, false) local sc = NetworkCreateSynchronisedScene(pos2.x, pos2.y, pos2.z, rot.x, rot.y, rot.z, 2, 0, 0, 1065353216, 0, 1.3) SetEntityCollision(b, 0, 1) NetworkAddPedToSynchronisedScene(p, sc, "anim@heists@ornate_bank@thermal_charge", "thermal_charge", 1.5, -4.0, 1, 16, 1148846080, 0) NetworkAddEntityToSynchronisedScene(b, sc, "anim@heists@ornate_bank@thermal_charge", "bag_thermal_charge", 4.0, -8.0, 1) NetworkStartSynchronisedScene(sc) Citizen.Wait(1500) pos2 = GetEntityCoords(p) local prop = CreateObject(GetHashKey("hei_prop_heist_thermite"), pos2.x, pos2.y, pos2.z + 0.2, 1, 1, 1) SetEntityCollision(prop, 0, 1) AttachEntityToEntity(prop, p, GetPedBoneIndex(p, 28422), 0, 0, 0, 0, 0, 180.0, 1, 1, 0, 1, 1, 1) Citizen.Wait(4000) ESX.Game.DeleteObject(b) SetPedComponentVariation(p, 5, 45, 0, 0) DetachEntity(prop, 1, 1) FreezeEntityPosition(prop, 1) SetEntityCollision(prop, 0, 1) TriggerServerEvent('av_vangelico:effect', prop) Citizen.Wait(4000) NetworkStopSynchronisedScene(sc) DeleteObject(prop) rob_status = false AfisTextCentru('~g~' .. Config.Lang['started'], 'Mergeti sa spargeti vitrinele!', 5000) AfisObiectivMisiune('SPARGE VITRINELE', 10000, 50, 200, 255) TriggerServerEvent('av_vangelico:gas') planteazaBomba = false jafActiv = true hudActiv = true hudVitrineSparte = 0 hudVitrineTotale = #stand > 0 and #stand or 20 print('^2[VANGELICO DEBUG] ^7Bomba plantata -> jafActiv=TRUE | hudActiv=TRUE') TriggerServerEvent('av_vangelico:bombaPlantata') if Config.SpawnPoliceNPCs then SpawnPoliceNPCs() -- Delay ca sa se vada mai intai "SPARGE VITRINELE" CreateThread(function() Citizen.Wait(10500) if jafActiv then AfisObiectivMisiune('SCAPA DE POLITIE!', 10000, 255, 50, 50) end end) end end end) end) RegisterNetEvent('av_vangelico:bombaFx') AddEventHandler('av_vangelico:bombaFx', function(entity) ESX.Streaming.RequestNamedPtfxAsset('scr_ornate_heist', function() if HasNamedPtfxAssetLoaded('scr_ornate_heist') then SetPtfxAssetNextCall("scr_ornate_heist") local explosiveEffect = StartParticleFxLoopedOnEntity("scr_heist_ornate_thermal_burn", entity, 0.0, 2.0, 0.0, 0.0, 0.0, 0.0, 2.0, 0.0, 0, 0, 0) Citizen.Wait(4000) StopParticleFxLooped(explosiveEffect, 0) end end) end) RegisterNetEvent('av_vangelico:smoke') AddEventHandler('av_vangelico:smoke', function() if #(GetEntityCoords(PlayerPedId()) - vector3(-632.39, -238.26, 38.07)) < 300 then local counter = 0 local particleEffects = {} RequestNamedPtfxAsset('core') while not HasNamedPtfxAssetLoaded('core') do Citizen.Wait(1) end while true do counter = counter + 1 if counter <= Config.GasTime * 4 then UseParticleFxAssetNextCall('core') local p1 = StartParticleFxLoopedAtCoord("exp_grd_grenade_smoke", -621.85, -230.71, 37.05, 0.0, 0.0, 0.0, 2.0, false, false, false, 0) table.insert(particleEffects, 1, p1) Citizen.Wait(1000) UseParticleFxAssetNextCall('core') local p2 = StartParticleFxLoopedAtCoord("exp_grd_grenade_smoke", -624.45, -227.78, 37.05, 0.0, 0.0, 0.0, 2.0, false, false, false, 0) table.insert(particleEffects, 1, p2) Citizen.Wait(5000) else for _, px in pairs(particleEffects) do StopParticleFxLooped(px, true) end break end end end end) RegisterNetEvent('av_vangelico:notify') AddEventHandler('av_vangelico:notify', function() if PlayerData.job.name == Config.PoliceJobName then ESX.ShowNotification(Config.Lang['police']) local blipRobbery = AddBlipForCoord(-632.39, -238.26, 38.07) SetBlipSprite(blipRobbery, 161) SetBlipScale(blipRobbery, 2.0) SetBlipColour(blipRobbery, 3) PulseBlip(blipRobbery) Citizen.Wait(60000) RemoveBlip(blipRobbery) end end) ----------------------------- -- Functii utilitare ----------------------------- function anim(dict) while not HasAnimDictLoaded(dict) do RequestAnimDict(dict) Citizen.Wait(5) end end function SpawnPoliceNPCs() if policeNPCsActive then return end policeNPCsActive = true if Config.WantedLevel > 0 then SetPlayerWantedLevel(PlayerId(), Config.WantedLevel, false) SetPlayerWantedLevelNow(PlayerId(), false) end local spawnPoints = Config.PoliceSpawnPoints for i = 1, Config.PoliceNPCCount do local sp = spawnPoints[((i - 1) % #spawnPoints) + 1] local modelName = Config.PoliceModels[((i - 1) % #Config.PoliceModels) + 1] local modelHash = GetHashKey(modelName) RequestModel(modelHash) while not HasModelLoaded(modelHash) do Citizen.Wait(10) end local ped = CreatePed(6, modelHash, sp.x, sp.y, sp.z, sp.h, true, false) SetEntityAsMissionEntity(ped, true, true) SetPedFleeAttributes(ped, 0, false) SetBlockingOfNonTemporaryEvents(ped, true) SetPedCombatAttributes(ped, 46, true) SetPedCombatAttributes(ped, 5, true) SetPedCombatMovement(ped, 2) SetPedCombatAbility(ped, 2) SetPedCombatRange(ped, 2) SetPedAccuracy(ped, 40) SetPedArmour(ped, 100) local weaponName = Config.PoliceWeapons[((i - 1) % #Config.PoliceWeapons) + 1] GiveWeaponToPed(ped, GetHashKey(weaponName), 500, false, true) SetPedRelationshipGroupHash(ped, GetHashKey('HATES_PLAYER')) TaskCombatPed(ped, PlayerPedId(), 0, 16) SetModelAsNoLongerNeeded(modelHash) table.insert(policeNPCs, ped) end Citizen.CreateThread(function() while policeNPCsActive do Citizen.Wait(8000) local playerPed = PlayerPedId() for _, ped in pairs(policeNPCs) do if DoesEntityExist(ped) and not IsPedDeadOrDying(ped, true) then if not IsPedInCombat(ped, playerPed) then TaskCombatPed(ped, playerPed, 0, 16) end end end if Config.WantedLevel > 0 then if GetPlayerWantedLevel(PlayerId()) < Config.WantedLevel then SetPlayerWantedLevel(PlayerId(), Config.WantedLevel, false) SetPlayerWantedLevelNow(PlayerId(), false) end end end end) end function DespawnPoliceNPCs() policeNPCsActive = false for _, ped in pairs(policeNPCs) do if DoesEntityExist(ped) then SetEntityAsMissionEntity(ped, false, true) DeleteEntity(ped) end end policeNPCs = {} ClearPlayerWantedLevel(PlayerId()) SetMaxWantedLevel(5) end function hasWeapon(weapon) for i = 1, #Config.Weapons do if weapon == Config.Weapons[i] then return true end end return false end ----------------------------- -- Afiseaza text centrat sus (ca HUD) pentru un numar de milisecunde ----------------------------- function AfisTextCentru(linie1, linie2, durata) CreateThread(function() local start = GetGameTimer() while GetGameTimer() - start < durata do -- Linia 1 (sub HUD-ul de timer care e la 0.03/0.075) SetTextFont(4) SetTextScale(0.0, 0.52) SetTextColour(255, 255, 255, 255) SetTextOutline() SetTextCentre(true) SetTextEntry('STRING') AddTextComponentString(linie1) DrawText(0.5, 0.12) -- Linia 2 if linie2 and linie2 ~= '' then SetTextFont(4) SetTextScale(0.0, 0.40) SetTextColour(210, 210, 210, 255) SetTextOutline() SetTextCentre(true) SetTextEntry('STRING') AddTextComponentString(linie2) DrawText(0.5, 0.165) end Citizen.Wait(0) end end) end function DrawText3D(x, y, z, text) SetTextScale(0.35, 0.35) SetTextFont(4) SetTextProportional(1) SetTextColour(255, 255, 255, 215) SetTextEntry("STRING") SetTextCentre(true) AddTextComponentString(text) SetDrawOrigin(x, y, z, 0) DrawText(0.0, 0.0) local factor = (string.len(text)) / 370 DrawRect(0.0, 0.0125, 0.017 + factor, 0.03, 0, 0, 0, 75) ClearDrawOrigin() end ----------------------------- -- DEBUG COMMANDS (sterge-le inainte de productie) ----------------------------- RegisterCommand('debug1', function() AfisObiectivMisiune('JAFUL VANGELICO INCEPE', 5000, 255, 200, 50) end, false) RegisterCommand('debug2', function() AfisObiectivMisiune('PLANTEAZA BOMBA CU GAZ', 10000, 255, 200, 50) end, false) RegisterCommand('debug3', function() AfisObiectivMisiune('SPARGE VITRINELE', 10000, 50, 200, 255) end, false) RegisterCommand('debug4', function() AfisObiectivMisiune('SCAPA DE POLITIE!', 10000, 255, 50, 50) end, false) RegisterCommand('debug5', function() AfisObiectivMisiune('JAF REUSIT!', 8000, 50, 255, 50) end, false) RegisterCommand('debug6', function() AfisObiectivMisiune('AI FOST ARESTAT!', 6000, 255, 50, 50) end, false)