Advertisement
Stivicx

Postman [LaLife]

Jun 11th, 2017
288
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 15.14 KB | None | 0 0
  1. local clientjobID = 0
  2.  
  3. job = {
  4.     plate = 0,
  5. }
  6.  
  7. local pool_locations = {
  8.     {enteringpool = {722.0145,-909.5587,24.43356}, innutile2 = {722.0145,-909.5587,24.43356}, outsidepool= {717.3234,-894.7209,24.0391}},
  9. }
  10.  
  11. local pool_blips ={}
  12. local inrangeofpool= false
  13. local inrangeofpool3 = false
  14. local currentlocation = nil
  15. local boughtcar = false
  16.  
  17. local function LocalPed()
  18.     return GetPlayerPed(-1)
  19. end
  20.  
  21. function drawTxtpool(text,font,centre,x,y,scale,r,g,b,a)
  22.     SetTextFont(font)
  23.     SetTextProportional(0)
  24.     SetTextScale(scale, scale)
  25.     SetTextColour(r, g, b, a)
  26.     SetTextDropShadow(0, 0, 0, 0,255)
  27.     SetTextEdge(1, 0, 0, 0, 255)
  28.     SetTextDropShadow()
  29.     SetTextOutline()
  30.     SetTextCentre(centre)
  31.     SetTextEntry("STRING")
  32.     AddTextComponentString(text)
  33.     DrawText(x , y)
  34. end
  35.  
  36. function IsPlayerInRangeOfpool()
  37.     return inrangeofpool
  38. end
  39.  
  40. function IsPlayerInRangeOfpool3()
  41.     return inrangeofpool3
  42. end
  43.  
  44. function ShowpoolBlips(bool)
  45.     if bool and #pool_blips == 0 then
  46.         for station,pos in pairs(pool_locations) do
  47.             local loc = pos
  48.             pos = pos.outsidepool
  49.             local blip = AddBlipForCoord(pos[1],pos[2],pos[3])
  50.             -- 60 58 137
  51.             SetBlipSprite(blip,399)
  52.             SetBlipColour(blip, 2)
  53.             SetBlipScale(blip, 0.65)
  54.             BeginTextCommandSetBlipName("STRING")
  55.             AddTextComponentString('Wood Postal')
  56.             EndTextCommandSetBlipName(blip)
  57.             SetBlipAsShortRange(blip,true)
  58.             SetBlipAsMissionCreatorBlip(blip,true)
  59.             table.insert(pool_blips, {blip = blip, pos = loc})
  60.         end
  61.         Citizen.CreateThread(function()
  62.             while #pool_blips > 0 do
  63.                 Citizen.Wait(0)
  64.                 local inrange = false
  65.                 local inrange3 = false
  66.                 for i,b in ipairs(pool_blips) do
  67.                     if IsPedInAnyVehicle(LocalPed(), true) == false and GetDistanceBetweenCoords(b.pos.enteringpool[1],b.pos.enteringpool[2],b.pos.enteringpool[3],GetEntityCoords(LocalPed()),true) > 0 then
  68.                         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)
  69.                         currentlocation = b
  70.                         if GetDistanceBetweenCoords(711.4304,-893.3711,23.05157,GetEntityCoords(LocalPed()),true) < 3 then
  71.                             ShowInfoJobPool("Appuyez sur ~INPUT_CONTEXT~ pour sortir votre ~b~Camion~w~.", 0)
  72.                             inrange3 = true
  73.                         end
  74.                     end
  75.                 end
  76.                 inrangeofpool = inrange
  77.                 inrangeofpool3 = inrange3
  78.             end
  79.         end)
  80.     elseif bool == false and #pool_blips > 0 then
  81.         for i,b in ipairs(pool_blips) do
  82.             if DoesBlipExist(b.blip) then
  83.                 SetBlipAsMissionCreatorBlip(b.blip,false)
  84.                 Citizen.InvokeNative(0x86A652570E5F25DD, Citizen.PointerValueIntInitialized(b.blip))
  85.             end
  86.         end
  87.         pool_blips = {}
  88.     end
  89. end
  90.  
  91. RegisterNetEvent("job:f_GetIdentifier")
  92. AddEventHandler("job:f_GetIdentifier", function(plate)
  93.     job.plate = plate
  94. end)
  95.  
  96. AddEventHandler("playerSpawned", function()
  97.     TriggerServerEvent("job:GetIdentifier")
  98. end)
  99.  
  100. local ShowMsgtime = { msg = "", time = 0 }
  101.  
  102. local myjob = 0
  103.  
  104. RegisterNetEvent("check:getJobs")
  105. AddEventHandler("check:getJobs", function(job)
  106.   myjob = job
  107. end)
  108.  
  109. Citizen.CreateThread(function()
  110.   while true do
  111.     Citizen.Wait(0)
  112.     if ShowMsgtime.time ~= 0 then
  113.       drawTxtpool(ShowMsgtime.msg, 0, 1, 0.5, 0.8, 0.6, 255, 255, 255, 255)
  114.       ShowMsgtime.time = ShowMsgtime.time - 1
  115.     end
  116.   end
  117. end)
  118.  
  119. Citizen.CreateThread(function()
  120.     while true do
  121.         Citizen.Wait(0)
  122.         if IsControlJustPressed(1,38) and inrangeofpool3 then
  123.             TriggerServerEvent("love:jobs")
  124.             Wait(100)
  125.             if jobId == 8 then
  126.                 SetPedComponentVariation(GetPlayerPed(-1), 11, 123, 1, 0)
  127.                 SetPedComponentVariation(GetPlayerPed(-1), 8, 15, 0, 0)
  128.                 SetPedComponentVariation(GetPlayerPed(-1), 4, 17, 6, 0)
  129.                 SetPedComponentVariation(GetPlayerPed(-1), 6, 8, 0, 0)
  130.                 SetPedComponentVariation(GetPlayerPed(-1), 3, 0, 0, 0)
  131.                 --TriggerServerEvent('CheckPoolVehi')
  132.                 --TriggerServerEvent('SetPlateJob')
  133.                 --local car = 0xC703DB5F
  134.                 Wait(100)
  135.                 --local car = GetHashKey("boxville2")
  136.                 local car = 0xF21B33BE
  137.                 -- VOITURE PAR DÉFAUT
  138.                 local cplate = job.plate
  139.                 Citizen.CreateThread(function()
  140.                     Citizen.Wait(10)
  141.  
  142.  
  143.                     RequestModel(car)
  144.                     while not HasModelLoaded(car) do
  145.                         Citizen.Wait(0)
  146.                     end
  147.                     veh = CreateVehicle(car, 729.268, -878.351, 24.95, 0.0, true, false)
  148.                     SetEntityVelocity(veh, 2000)
  149.                     SetVehicleNumberPlateText(veh, cplate)
  150.                     SetVehicleOnGroundProperly(veh)
  151.                     SetVehicleHasBeenOwnedByPlayer(veh,true)
  152.                     local id = NetworkGetNetworkIdFromEntity(veh)
  153.                     SetNetworkIdCanMigrate(id, true)
  154.                     SetVehRadioStation(veh, "OFF")
  155.                     SetVehicleColours(veh, 64,64)
  156.                     SetVehicleLivery(veh, 3)
  157.                     SetPedIntoVehicle(GetPlayerPed(-1),  veh,  -1)
  158.                     DrawNotif("Véhicule sorti, bonne route")
  159.                 end)
  160.                 clientjobID = 45 -- Piscine
  161.                 inrangeofpool3 = false
  162.                 inrange3 = false
  163.             else
  164.                 ShowMsgtime.msg = '~r~ Vous devez faire partie de Wood Postal !'
  165.                 ShowMsgtime.time = 150
  166.             end
  167.         end
  168.     end
  169. end)
  170.  
  171. onJobPool = 0
  172.  
  173. daily = {flag = {}, blip = {}, veh = {}, coords = {cx={}, cy={}, cz={}}}
  174.  
  175. function StartJobPool()
  176.     showLoadingPromtpool("Chargement du métier.", 2000, 3)
  177.     daily.coords.cx[1], daily.coords.cy[1], daily.coords.cz[1] = 235.45,169.848,105.159
  178.     daily.coords.cx[2], daily.coords.cy[2], daily.coords.cz[2] = -568.184,269.787,83.0197
  179.     daily.coords.cx[3], daily.coords.cy[3], daily.coords.cz[3] = 326.769,167.723,103.588
  180.     daily.coords.cx[4], daily.coords.cy[4], daily.coords.cz[4] = -595.879,272.688,82.177
  181.     daily.coords.cx[5], daily.coords.cy[5], daily.coords.cz[5] = 397.248,139.171,102.365
  182.     daily.coords.cx[6], daily.coords.cy[6], daily.coords.cz[6] = 425.859,99.6317,100.215
  183.     daily.coords.cx[7], daily.coords.cy[7], daily.coords.cz[7] = -599.469,248.928,82.1279
  184.     daily.coords.cx[8], daily.coords.cy[8], daily.coords.cz[8] = -1674.65,-583.977,33.6717
  185.     daily.coords.cx[9], daily.coords.cy[9], daily.coords.cz[9] = 446.15,88.5822,98.9998
  186.     daily.coords.cx[10], daily.coords.cy[10], daily.coords.cz[10] = -175.76,-426.468,43.0024
  187.     daily.coords.cx[11], daily.coords.cy[11], daily.coords.cz[11] = 458.276,119.761,98.9606
  188.     daily.coords.cx[12], daily.coords.cy[12], daily.coords.cz[12] = -1439.64,-721.375,23.7175
  189.     daily.coords.cx[13], daily.coords.cy[13], daily.coords.cz[13] = 529.179,100.898,96.3299
  190.     daily.coords.cx[14], daily.coords.cy[14], daily.coords.cz[14] = -1232.77,-1074.81,8.40506
  191.     daily.coords.cx[15], daily.coords.cy[15], daily.coords.cz[15] = 541.25,89.2674,96.2956
  192.     daily.coords.cx[16], daily.coords.cy[16], daily.coords.cz[16] = -1214.45,-1128.62,7.81709
  193.     daily.coords.cx[17], daily.coords.cy[17], daily.coords.cz[17] = 535.988,36.738,94.5939
  194.     daily.coords.cx[18], daily.coords.cy[18], daily.coords.cz[18] = -1195.69,-1185.49,7.6919
  195.     daily.coords.cx[19], daily.coords.cy[19], daily.coords.cz[19] = 573.777,226.8,103.078
  196.     daily.coords.cx[20], daily.coords.cy[20], daily.coords.cz[20] = -846.418,-855.868,19.329
  197.     daily.coords.cx[21], daily.coords.cy[21], daily.coords.cz[21] = 380.882,-94.5883,66.9924
  198.     daily.coords.cx[22], daily.coords.cy[22], daily.coords.cz[22] = -852.531,-678.64,27.8488
  199.     daily.coords.cx[23], daily.coords.cy[23], daily.coords.cz[23] = 304.077,-77.837,70.2108
  200.     daily.coords.cx[24], daily.coords.cy[24], daily.coords.cz[24] = -980.928,-423.809,37.8326
  201.     daily.coords.cx[25], daily.coords.cy[25], daily.coords.cz[25] = 194.763,-36.159,68.5332
  202.     daily.coords.cx[26], daily.coords.cy[26], daily.coords.cz[26] = -958.352,-332.094,38.0002
  203.     daily.coords.cx[27], daily.coords.cy[27], daily.coords.cz[27] = 241.397,-58.9975,69.6277
  204.     daily.coords.cx[28], daily.coords.cy[28], daily.coords.cz[28] = -923.66,-233.452,39.6942
  205.     daily.coords.cx[29], daily.coords.cy[29], daily.coords.cz[29] = 106.732,-9.90871,69.9294
  206.     daily.coords.cx[30], daily.coords.cy[30], daily.coords.cz[30] = -871.61,-173.059,37.9131
  207.     daily.coords.cx[31], daily.coords.cy[31], daily.coords.cz[31] = -148.786,-399.819,33.7018
  208.     daily.coords.cx[32], daily.coords.cy[32], daily.coords.cz[32] = -480.825,-11.6149,45.2819
  209.     daily.coords.cx[33], daily.coords.cy[33], daily.coords.cz[33] = -227.558,-655.966,33.383
  210.     daily.coords.cx[34], daily.coords.cy[34], daily.coords.cz[34] = -283.379,-53.6171,49.399
  211.     daily.coords.cx[35], daily.coords.cy[35], daily.coords.cz[35] = -252.495,-739.14,33.1254
  212.     daily.coords.cx[36], daily.coords.cy[36], daily.coords.cz[36] = -238.685,107.071,69.6672
  213.     daily.coords.cx[37], daily.coords.cy[37], daily.coords.cz[37] = -204.108,-869.71,29.349
  214.     daily.coords.cx[38], daily.coords.cy[38], daily.coords.cz[38] = -524.266,119.939,63.1203
  215.     daily.coords.cx[39], daily.coords.cy[39], daily.coords.cz[39] = -122.324,-932.79,29.2428
  216.     daily.coords.cx[40], daily.coords.cy[40], daily.coords.cz[40] = -634.541,1139.442,57.2331
  217.     daily.coords.cx[41], daily.coords.cy[41], daily.coords.cz[41] = -28.8422,-984.235,29.2709
  218.     daily.coords.cx[42], daily.coords.cy[42], daily.coords.cz[42] = -650.367,-682.177,31.2195
  219.     daily.coords.cx[43], daily.coords.cy[43], daily.coords.cz[43] = 246.394,-1065.58,29.293
  220.     daily.coords.cx[44], daily.coords.cy[44], daily.coords.cz[44] = -1211.86,-1388.16,4.007759
  221.     daily.coords.cx[45], daily.coords.cy[45], daily.coords.cz[45] = 361.951,-1066.06,29.3747
  222.     daily.coords.cx[46], daily.coords.cy[46], daily.coords.cz[46] = -1294.17,-1162.71,5.02509
  223.     daily.coords.cx[47], daily.coords.cy[47], daily.coords.cz[47] = 391.956,-971.926,29.4412
  224.     daily.coords.cx[48], daily.coords.cy[48], daily.coords.cz[48] = -650.558,-753.544,26.2033
  225.     daily.coords.cx[49], daily.coords.cy[49], daily.coords.cz[49] = 254.579,-1537.2,29.2916
  226.     daily.coords.cx[50], daily.coords.cy[50], daily.coords.cz[50] = -661.078,-849.675,24.4355
  227.     daily.coords.cx[51], daily.coords.cy[51], daily.coords.cz[51] = 788.421,-771.345,26.4402
  228.     daily.coords.cx[52], daily.coords.cy[52], daily.coords.cz[52] = -651.074,-942.226,21.9754
  229.     daily.coords.cx[53], daily.coords.cy[53], daily.coords.cz[53] = 788.421,-771.345,26.4402
  230.     daily.coords.cx[54], daily.coords.cy[54], daily.coords.cz[54] = -555.688,-686.642,33.2313
  231.     daily.coords.cx[55], daily.coords.cy[55], daily.coords.cz[55] = 296.323,-230.526,53.9902   
  232.     daily.coords.cx[56], daily.coords.cy[56], daily.coords.cz[56] = 1283.96,-684.764,65.4217
  233.     daily.coords.cx[57], daily.coords.cy[57], daily.coords.cz[57] = -122.324,-932.79,29.2428
  234.     daily.coords.cx[58], daily.coords.cy[58], daily.coords.cz[58] = -711.911,-670.229,30.484
  235.     daily.coords.cx[59], daily.coords.cy[59], daily.coords.cz[59] = -189.883,-53.7102,51.4818
  236.     daily.coords.cx[60], daily.coords.cy[60], daily.coords.cz[60] = -738.509,-691.201,30.291
  237.     daily.coords.cx[61], daily.coords.cy[61], daily.coords.cz[61] = -232.935,-972.664,29.2884
  238.     daily.coords.cx[62], daily.coords.cy[62], daily.coords.cz[62] = -752.196,-784.596,24.7846
  239.     daily.coords.cx[63], daily.coords.cy[63], daily.coords.cz[63] = -202.304,-1489.92,31.4542
  240.     daily.veh[1] = GetVehiclePedIsUsing(GetPlayerPed(-1))
  241.     daily.flag[1] = 1
  242.     daily.flag[2] = GetRandomIntInRange(1, 88)
  243.     Wait(2000)
  244.     DrawMissionTextpool("Conduisez et allez vider les ~h~~y~boîtes aux lettres~w~.", 10000)
  245.     onJobPool = 1
  246. end
  247.  
  248. function DrawMissionTextpool(m_text, showtime)
  249.     ClearPrints()
  250.     SetTextEntry_2("STRING")
  251.     AddTextComponentString(m_text)
  252.     DrawSubtitleTimed(showtime, 1)
  253. end
  254.  
  255. function showLoadingPromtpool(showText, showTime, showType)
  256.     Citizen.CreateThread(function()
  257.         Citizen.Wait(0)
  258.         N_0xaba17d7ce615adbf("STRING") -- set type
  259.         AddTextComponentString(showText) -- sets the text
  260.         N_0xbd12f8228410d9b4(showType) -- show promt (types = 3)
  261.         Citizen.Wait(showTime) -- show time
  262.         N_0x10d373323e5b9c0d() -- remove promt
  263.     end)
  264. end
  265.  
  266. function DrawNotif(text)
  267.     SetNotificationTextEntry("STRING")
  268.     AddTextComponentString(text)
  269.     DrawNotification(false, false)
  270. end
  271.  
  272. function ShowInfoJobPool(text, state)
  273.     SetTextComponentFormat("STRING")
  274.     AddTextComponentString(text)
  275.     DisplayHelpTextFromStringLabel(0, state, 0, -1)
  276. end
  277.  
  278. function StopJobPool()
  279.     if daily.blip[1] ~= nil and DoesBlipExist(daily.blip[1]) then
  280.         Citizen.InvokeNative(0x86A652570E5F25DD,Citizen.PointerValueIntInitialized(daily.blip[1]))
  281.         daily.blip[1] = nil
  282.     end
  283.     onJobPool = 0
  284.     clientjobID = 0
  285.     daily.veh[1] = nil
  286.     daily.flag[1] = nil
  287.     daily.flag[2] = nil
  288. end
  289.  
  290. Citizen.CreateThread(function()
  291.     while true do
  292.         Wait(0)
  293.         if onJobPool == 0 then
  294.             if (clientjobID == 45) then -- JOB pool
  295.                 if IsPedSittingInAnyVehicle(GetPlayerPed(-1)) then
  296.                     --if IsVehicleModel(GetVehiclePedIsUsing(GetPlayerPed(-1)), GetHashKey("boxville2", _r)) then
  297.                     if IsVehicleModel(GetVehiclePedIsUsing(GetPlayerPed(-1)), 0xF21B33BE) then
  298.                         TriggerServerEvent("love:jobs")
  299.                         Wait(100)
  300.                         if jobId == 8 then
  301.                             StartJobPool(1)
  302.                         else
  303.                             ShowMsgtime.msg = '~r~ Vous devez faire de Wood Postal !'
  304.                             ShowMsgtime.time = 150
  305.                         end
  306.                     end
  307.                 end
  308.             end
  309.         elseif onJobPool == 1 then
  310.             if DoesEntityExist(daily.veh[1]) and IsVehicleDriveable(daily.veh[1], 0) then
  311.  
  312.                 if daily.flag[1] == 1 then
  313.                     daily.flag[2] = GetRandomIntInRange(1, 88)
  314.                     daily.blip[1] = AddBlipForCoord(daily.coords.cx[daily.flag[2]],daily.coords.cy[daily.flag[2]],daily.coords.cz[daily.flag[2]])
  315.                     N_0x80ead8e2e1d5d52e(daily.blip[1])
  316.                     SetBlipRoute(daily.blip[1], 1)
  317.                     distance = GetDistanceBetweenCoords(GetEntityCoords(GetPlayerPed(-1)), daily.coords.cx[daily.flag[2]],daily.coords.cy[daily.flag[2]],daily.coords.cz[daily.flag[2]], true)
  318.                     daily.flag[1] = 2
  319.                 end
  320.                 if daily.flag[1] == 2 then
  321.                     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
  322.                         --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)
  323.                     else
  324.                         if daily.blip[1] ~= nil and DoesBlipExist(daily.blip[1]) then
  325.                             Citizen.InvokeNative(0x86A652570E5F25DD,Citizen.PointerValueIntInitialized(daily.blip[1]))
  326.                             daily.blip[1] = nil
  327.                         end
  328.                         if IsPedInAnyVehicle(LocalPed(), true) == false then
  329.                             ShowInfoJobPool("Appuyez sur ~INPUT_CONTEXT~ pour ~b~récupérer~w~ le courrier.", 0)
  330.                             if IsControlJustPressed(1,38) then
  331.                                 local dict = "pickup_object"
  332.                                 local anim = "pickup_low"
  333.                                 RequestAnimDict(dict)
  334.  
  335.                                 while not HasAnimDictLoaded(dict) do
  336.                                     Citizen.Wait(0)
  337.                                 end
  338.  
  339.                                 local myPed = PlayerPedId()
  340.                                 local animation = anim
  341.                                 local flags = 16 -- only play the animation on the upper body
  342.  
  343.                                 TaskPlayAnim(myPed, dict, animation, 8.0, -8, -1, flags, 0, 0, 0, 0)
  344.                                 Wait(2000)
  345.                                 DrawMissionTextpool("~h~Vous avez ~g~récupérer~w~ les courriers !", 5000)
  346.                                 TriggerServerEvent('job:success', distance)
  347.                                 --TriggerServerEvent('CheckPool')
  348.                                 Wait(1000)
  349.                                 daily.flag[1] = 1
  350.                                 daily.flag[2] = GetRandomIntInRange(1, 88)
  351.                             end
  352.                         end
  353.                     end
  354.                 end
  355.  
  356.                 if GetDistanceBetweenCoords(GetEntityCoords(GetPlayerPed(-1)), GetEntityCoords(daily.veh[1]), true) > 350.0001 then
  357.                     StopJobPool(1)
  358.                     DrawNotif("~r~Retournez dans votre véhicule pour reprendre votre travail")
  359.                 else
  360.  
  361.                 end
  362.  
  363.             else
  364.                 StopJobPool(1)
  365.                 DrawMissionTextpool("Votre camion est ~h~~r~hors-service~w~.", 5000)
  366.             end
  367.         end
  368.     end
  369.  
  370. end)
  371.  
  372. AddEventHandler('playerSpawned', function(spawn)
  373.     ShowpoolBlips(true)
  374. end)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement