Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- vRP = Proxy.getInterface("vRP")
- local holdingup = false
- local store = ""
- local secondsRemaining = 0
- function holdup_DisplayHelpText(str)
- SetTextComponentFormat("STRING")
- AddTextComponentString(str)
- DisplayHelpTextFromStringLabel(0, 0, 1, -1)
- end
- function holdup_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
- local stores = {}
- RegisterNetEvent('es_holdup:initstores')
- AddEventHandler('es_holdup:initstores', function(client_stores)
- stores = client_stores
- end)
- RegisterNetEvent('es_holdup:currentlyrobbing')
- AddEventHandler('es_holdup:currentlyrobbing', function(robb, timeRemaining)
- store = robb
- secondsRemaining = timeRemaining
- holdingup = true
- end)
- RegisterNetEvent('es_holdup:toofarlocal')
- AddEventHandler('es_holdup:toofarlocal', function(robb)
- holdingup = false
- TriggerEvent('chatMessage', 'SYSTEM', {255, 0, 0}, "Le braquage a été annulé, vous ne recevrez rien.")
- store = ""
- secondsRemaining = 0
- incircle = false
- end)
- RegisterNetEvent('es_holdup:playerdiedlocal')
- AddEventHandler('es_holdup:playerdiedlocal', function(robb)
- holdingup = false
- TriggerEvent('chatMessage', 'SYSTEM', {255, 0, 0}, "Le braquage a été annulé, vous êtes mort ...")
- store = ""
- secondsRemaining = 0
- incircle = false
- end)
- RegisterNetEvent('es_holdup:robberycomplete')
- AddEventHandler('es_holdup:robberycomplete', function(reward)
- holdingup = false
- TriggerEvent('chatMessage', 'SYSTEM', {255, 0, 0}, "Braquage terminé vous avez eu : ^2" .. reward)
- store = ""
- secondsRemaining = 0
- incircle = false
- end)
- Citizen.CreateThread(function()
- while true do
- if holdingup then
- Citizen.Wait(1000)
- if(secondsRemaining > 0)then
- secondsRemaining = secondsRemaining - 1
- else
- holdingup = false
- TriggerServerEvent("es_holdup:robberydone",store)
- end
- end
- Citizen.Wait(0)
- end
- end)
- Citizen.CreateThread(function()
- while true do
- local pos = GetEntityCoords(GetPlayerPed(-1), true)
- if holdingup then
- -- wanted only when holding up
- 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 IsPlayerWantedLevelGreater(PlayerId(),0) or ArePlayerFlashingStarsAboutToDrop(PlayerId()) then
- local wanted = GetPlayerWantedLevel(PlayerId())
- Citizen.Wait(5000)
- SetPlayerWantedLevel(PlayerId(), wanted, 0)
- SetPlayerWantedLevelNow(PlayerId(), 0)
- end
- end
- end
- end
- Citizen.Wait(0)
- 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, 52)
- SetBlipScale(blip, 0.8)
- SetBlipAsShortRange(blip, true)
- BeginTextCommandSetBlipName("STRING")
- AddTextComponentString("Robbable Store")
- EndTextCommandSetBlipName(blip)
- end
- end)]]
- incircle = false
- Citizen.CreateThread(function()
- while true do
- local pos = GetEntityCoords(GetPlayerPed(-1), true)
- if holdingup then
- SetPlayerWantedLevel(PlayerId(), 5, 0)
- SetPlayerWantedLevelNow(PlayerId(), 0)
- holdup_drawTxt(0.66, 1.44, 1.0,1.0,0.4, "Braquage de magasin : ~r~" .. secondsRemaining .. "~w~ secondes restante", 255, 255, 255, 255)
- local pos2 = stores[store].position
- local ped = GetPlayerPed(-1)
- if vRP.isInComa() then
- TriggerServerEvent('es_holdup:playerdied', store)
- elseif(Vdist(pos.x, pos.y, pos.z, pos2.x, pos2.y, pos2.z) > 15)then
- TriggerServerEvent('es_holdup:toofar', store)
- end
- else
- 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) < 2.0)then
- if (incircle == false) then
- holdup_DisplayHelpText("Press ~INPUT_CONTEXT~ pour braqué ~b~" .. v.nameofstore .. "~w~")
- end
- incircle = true
- if(IsControlJustReleased(1, 51))then
- TriggerServerEvent('es_holdup:rob', k)
- end
- elseif(Vdist(pos.x, pos.y, pos.z, pos2.x, pos2.y, pos2.z) > 2.0)then
- incircle = false
- end
- end
- end
- end
- end
- Citizen.Wait(0)
- end
- end)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement