Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- local clientjobID = 0
- job = {
- plate = 0,
- }
- local pool_locations = {
- {enteringpool = {722.0145,-909.5587,24.43356}, innutile2 = {722.0145,-909.5587,24.43356}, outsidepool= {717.3234,-894.7209,24.0391}},
- }
- local pool_blips ={}
- local inrangeofpool= false
- local inrangeofpool3 = false
- local currentlocation = nil
- local boughtcar = false
- local function LocalPed()
- return GetPlayerPed(-1)
- end
- function drawTxtpool(text,font,centre,x,y,scale,r,g,b,a)
- SetTextFont(font)
- SetTextProportional(0)
- SetTextScale(scale, scale)
- SetTextColour(r, g, b, a)
- SetTextDropShadow(0, 0, 0, 0,255)
- SetTextEdge(1, 0, 0, 0, 255)
- SetTextDropShadow()
- SetTextOutline()
- SetTextCentre(centre)
- SetTextEntry("STRING")
- AddTextComponentString(text)
- DrawText(x , y)
- end
- function IsPlayerInRangeOfpool()
- return inrangeofpool
- end
- function IsPlayerInRangeOfpool3()
- return inrangeofpool3
- end
- function ShowpoolBlips(bool)
- if bool and #pool_blips == 0 then
- for station,pos in pairs(pool_locations) do
- local loc = pos
- pos = pos.outsidepool
- local blip = AddBlipForCoord(pos[1],pos[2],pos[3])
- -- 60 58 137
- SetBlipSprite(blip,399)
- SetBlipColour(blip, 2)
- SetBlipScale(blip, 0.65)
- BeginTextCommandSetBlipName("STRING")
- AddTextComponentString('Piscine')
- EndTextCommandSetBlipName(blip)
- SetBlipAsShortRange(blip,true)
- SetBlipAsMissionCreatorBlip(blip,true)
- table.insert(pool_blips, {blip = blip, pos = loc})
- end
- Citizen.CreateThread(function()
- while #pool_blips > 0 do
- Citizen.Wait(0)
- local inrange = false
- local inrange3 = false
- for i,b in ipairs(pool_blips) do
- if IsPedInAnyVehicle(LocalPed(), true) == false and GetDistanceBetweenCoords(b.pos.enteringpool[1],b.pos.enteringpool[2],b.pos.enteringpool[3],GetEntityCoords(LocalPed()),true) > 0 then
- DrawMarker(0,711.4304,-893.3711,23.05157,0,0,0,0,0,0,2.001,2.0001,0.5001,0,155,255,200,0,0,0,0)
- currentlocation = b
- if GetDistanceBetweenCoords(711.4304,-893.3711,23.05157,GetEntityCoords(LocalPed()),true) < 3 then
- ShowInfoJobPool("Appuyez sur ~INPUT_CONTEXT~ pour sortir votre ~b~Camion~w~.", 0)
- inrange3 = true
- end
- end
- end
- inrangeofpool = inrange
- inrangeofpool3 = inrange3
- end
- end)
- elseif bool == false and #pool_blips > 0 then
- for i,b in ipairs(pool_blips) do
- if DoesBlipExist(b.blip) then
- SetBlipAsMissionCreatorBlip(b.blip,false)
- Citizen.InvokeNative(0x86A652570E5F25DD, Citizen.PointerValueIntInitialized(b.blip))
- end
- end
- pool_blips = {}
- end
- end
- RegisterNetEvent("job:f_GetIdentifier")
- AddEventHandler("job:f_GetIdentifier", function(plate)
- job.plate = plate
- end)
- AddEventHandler("playerSpawned", function()
- TriggerServerEvent("job:GetIdentifier")
- end)
- local ShowMsgtime = { msg = "", time = 0 }
- local myjob = 0
- RegisterNetEvent("mine:getJobs")
- AddEventHandler("mine:getJobs", function(job)
- myjob = job
- end)
- Citizen.CreateThread(function()
- while true do
- Citizen.Wait(0)
- if ShowMsgtime.time ~= 0 then
- drawTxtpool(ShowMsgtime.msg, 0, 1, 0.5, 0.8, 0.6, 255, 255, 255, 255)
- ShowMsgtime.time = ShowMsgtime.time - 1
- end
- end
- end)
- Citizen.CreateThread(function()
- while true do
- Citizen.Wait(0)
- if IsControlJustPressed(1,38) and inrangeofpool3 then
- TriggerServerEvent("poleemploi:getjobs")
- Wait(100)
- if myjob == 2 then
- SetPedComponentVariation(GetPlayerPed(-1), 11, 123, 1, 0)
- SetPedComponentVariation(GetPlayerPed(-1), 8, 15, 0, 0)
- SetPedComponentVariation(GetPlayerPed(-1), 4, 17, 6, 0)
- SetPedComponentVariation(GetPlayerPed(-1), 6, 8, 0, 0)
- SetPedComponentVariation(GetPlayerPed(-1), 3, 0, 0, 0)
- --TriggerServerEvent('CheckPoolVehi')
- --TriggerServerEvent('SetPlateJob')
- --local car = 0xC703DB5F
- Wait(100)
- --local car = GetHashKey("pony2")
- local car = 0x58B3979C
- -- VOITURE PAR DÉFAUT
- local cplate = job.plate
- Citizen.CreateThread(function()
- Citizen.Wait(10)
- RequestModel(car)
- while not HasModelLoaded(car) do
- Citizen.Wait(0)
- end
- veh = CreateVehicle(car, 729.268, -878.351, 24.95, 0.0, true, false)
- SetEntityVelocity(veh, 2000)
- SetVehicleNumberPlateText(veh, cplate)
- SetVehicleOnGroundProperly(veh)
- SetVehicleHasBeenOwnedByPlayer(veh,true)
- local id = NetworkGetNetworkIdFromEntity(veh)
- SetNetworkIdCanMigrate(id, true)
- SetVehRadioStation(veh, "OFF")
- SetVehicleColours(veh, 64,64)
- SetVehicleLivery(veh, 3)
- SetPedIntoVehicle(GetPlayerPed(-1), veh, -1)
- DrawNotif("Véhicule sorti, bonne route")
- end)
- clientjobID = 45 -- Piscine
- inrangeofpool3 = false
- inrange3 = false
- else
- ShowMsgtime.msg = '~r~ Vous devez être nettoyeur de piscine !'
- ShowMsgtime.time = 150
- end
- end
- end
- end)
- onJobPool = 0
- daily = {flag = {}, blip = {}, veh = {}, coords = {cx={}, cy={}, cz={}}}
- function StartJobPool()
- showLoadingPromtpool("Chargement du métier.""Conduisez et allez nettoyer les ~h~~y~Piscines~w~.", 10000)
- onJobPool = 1
- end
- function DrawMissionTextpool(m_text, showtime)
- ClearPrints()
- SetTextEntry_2("STRING")
- AddTextComponentString(m_text)
- DrawSubtitleTimed(showtime, 1)
- end
- function showLoadingPromtpool(showText, showTime, showType)
- Citizen.CreateThread(function()
- Citizen.Wait(0)
- N_0xaba17d7ce615adbf("STRING") -- set type
- AddTextComponentString(showText) -- sets the text
- N_0xbd12f8228410d9b4(showType) -- show promt (types = 3)
- Citizen.Wait(showTime) -- show time
- N_0x10d373323e5b9c0d() -- remove promt
- end)
- end
- function DrawNotif(text)
- SetNotificationTextEntry("STRING")
- AddTextComponentString(text)
- DrawNotification(false, false)
- end
- function ShowInfoJobPool(text, state)
- SetTextComponentFormat("STRING")
- AddTextComponentString(text)
- DisplayHelpTextFromStringLabel(0, state, 0, -1)
- end
- function StopJobPool()
- if daily.blip[1] ~= nil and DoesBlipExist(daily.blip[1]) then
- Citizen.InvokeNative(0x86A652570E5F25DD,Citizen.PointerValueIntInitialized(daily.blip[1]))
- daily.blip[1] = nil
- end
- onJobPool = 0
- clientjobID = 0
- daily.veh[1] = nil
- daily.flag[1] = nil
- daily.flag[2] = nil
- end
- Citizen.CreateThread(function()
- while true do
- Wait(0)
- if onJobPool == 0 then
- if (clientjobID == 45) then -- JOB pool
- if IsPedSittingInAnyVehicle(GetPlayerPed(-1)) then
- --if IsVehicleModel(GetVehiclePedIsUsing(GetPlayerPed(-1)), GetHashKey("pony2", _r)) then
- if IsVehicleModel(GetVehiclePedIsUsing(GetPlayerPed(-1)), 0x58B3979C) then
- TriggerServerEvent("poleemploi:getjobs")
- Wait(100)
- if myjob == 2 then
- StartJobPool(1)
- else
- ShowMsgtime.msg = '~r~ Vous devez être nettoyeur de piscine !'
- ShowMsgtime.time = 150
- end
- end
- end
- end
- elseif onJobPool == 1 then
- if DoesEntityExist(daily.veh[1]) and IsVehicleDriveable(daily.veh[1], 0) then
- if daily.flag[1] == 1 then
- daily.flag[2] = GetRandomIntInRange(1, 88)
- daily.blip[1] = AddBlipForCoord(daily.coords.cx[daily.flag[2]],daily.coords.cy[daily.flag[2]],daily.coords.cz[daily.flag[2]])
- N_0x80ead8e2e1d5d52e(daily.blip[1])
- SetBlipRoute(daily.blip[1], 1)
- distance = GetDistanceBetweenCoords(GetEntityCoords(GetPlayerPed(-1)), daily.coords.cx[daily.flag[2]],daily.coords.cy[daily.flag[2]],daily.coords.cz[daily.flag[2]], true)
- daily.flag[1] = 2
- end
- if daily.flag[1] == 2 then
- if GetDistanceBetweenCoords(GetEntityCoords(GetPlayerPed(-1)), daily.coords.cx[daily.flag[2]],daily.coords.cy[daily.flag[2]],daily.coords.cz[daily.flag[2]], true) > 5.0001 then
- --DrawMarker(1, daily.coords.cx[daily.flag[2]],daily.coords.cy[daily.flag[2]],daily.coords.cz[daily.flag[2]]-1.0001, 0, 0, 0, 0, 0, 0, 2.0, 2.0, 2.0, 178, 236, 93, 155, 0, 0, 2, 0, 0, 0, 0)
- else
- if daily.blip[1] ~= nil and DoesBlipExist(daily.blip[1]) then
- Citizen.InvokeNative(0x86A652570E5F25DD,Citizen.PointerValueIntInitialized(daily.blip[1]))
- daily.blip[1] = nil
- end
- if IsPedInAnyVehicle(LocalPed(), true) == false then
- ShowInfoJobPool("Appuyez sur ~INPUT_CONTEXT~ pour ~b~nettoyer~w~ la piscine.", 0)
- if IsControlJustPressed(1,38) then
- local dict = "pickup_object"
- local anim = "pickup_low"
- RequestAnimDict(dict)
- while not HasAnimDictLoaded(dict) do
- Citizen.Wait(0)
- end
- local myPed = PlayerPedId()
- local animation = anim
- local flags = 16 -- only play the animation on the upper body
- TaskPlayAnim(myPed, dict, animation, 8.0, -8, -1, flags, 0, 0, 0, 0)
- Wait(2000)
- DrawMissionTextpool("~h~Vous avez ~g~nettoyé~w~ une piscine !", 5000)
- TriggerServerEvent('job:success', distance)
- --TriggerServerEvent('CheckPool')
- Wait(1000)
- daily.flag[1] = 1
- daily.flag[2] = GetRandomIntInRange(1, 88)
- end
- end
- end
- end
- if GetDistanceBetweenCoords(GetEntityCoords(GetPlayerPed(-1)), GetEntityCoords(daily.veh[1]), true) > 350.0001 then
- StopJobPool(1)
- DrawNotif("~r~Retournez dans votre véhicule pour reprendre votre travail")
- else
- end
- else
- StopJobPool(1)
- DrawMissionTextpool("Votre camion est ~h~~r~hors-service~w~.", 5000)
- end
- end
- end
- end)
- AddEventHandler('playerSpawned', function(spawn)
- ShowpoolBlips(true)
- end)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement