Advertisement
Stivicx

es_taxi

May 13th, 2017
178
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 20.29 KB | None | 0 0
  1. --Server.lua
  2. RegisterServerEvent('taxi:success')
  3. AddEventHandler('taxi:success', function()
  4.   print("Player ID " ..source)
  5.     -- Get the players money amount
  6. TriggerEvent('es:getPlayerFromId', source, function(user)
  7.   total = math.random(100, 500);
  8.   -- update player money amount
  9.   user:addMoney((total + 0.0))
  10.  TriggerClientEvent("es_freeroam:notify", source, "CHAR_BANK_MAZE", 1, "Maze Bank", false, "Your money has been updated to ~g~$".. tonumber(total))
  11.  end)
  12. end)
  13.  
  14. --Client.lua
  15. onJob = 0
  16. local player = PlayerId()
  17.  
  18. -- Configure the coordinates where the taxi cabs should be placed.
  19. local cabs = {
  20.    { hash=0xC703DB5F, x=918.592, y=-166.732, z=74.250, a=100.938 },
  21.    { hash=0xC703DB5F, x=917.207, y=-171.100, z=74.489, a=85.422 },
  22.   }
  23.  
  24.     -- Configure the coordinates where the taxi cabs should be placed.
  25. local peds = {
  26.   {type=4, hash=0xe52e126c, x=894.422, y=-182.196, z=74.700, a=269.449},
  27.   {type=4, hash=0xe52e126c, x=895.422, y=-180.234, z=74.700, a=260.402},
  28.   {type=4, hash=0xe52e126c, x=900.742, y=-174.138, z=73.936, a=265.213},
  29.   }
  30.  
  31. AddEventHandler('onClientMapStart', function()
  32. RequestModel(0xC703DB5F)
  33. while not HasModelLoaded(0xC703DB5F) do
  34.     Wait(1)
  35. end
  36.  
  37. RequestModel(0xe52e126c)
  38. while not HasModelLoaded(0xe52e126c) do
  39.     Wait(1)
  40. end
  41.  
  42. -- Set a blip on the map for Downtown Cab
  43. downtownc = AddBlipForCoord(900.461, -181.466, 73.89)
  44. SetBlipSprite(downtownc, 50)
  45. SetBlipDisplay(downtownc, 3)
  46. SetBlipNameFromTextFile(downtownc, "TXM_BLIP")
  47.  
  48. -- Spawn the taxi cab to DownTown Cab
  49. for _, item in pairs(cabs) do
  50.     cab =  CreateVehicle(item.hash, item.x, item.y, item.z, item.a, false, false)
  51.     SetVehicleOnGroundProperly(cab)
  52. end
  53.  
  54. -- Spawn the gang members to the coordinates (testing)
  55. for _, item in pairs(peds) do
  56.     ped = CreatePed(item.type, item.hash, item.x, item.y, item.z, item.a, false, true)
  57.     GiveWeaponToPed(ped, 0x1B06D571, 2800, false, true)
  58.     SetPedCombatAttributes(ped, 46, true)
  59.     SetPedFleeAttributes(ped, 0, 0)
  60.     SetPedArmour(ped, 100)
  61.     SetPedMaxHealth(ped, 100)
  62.     SetPedRelationshipGroupHash(ped, GetHashKey("GANG_1"))
  63.     TaskStartScenarioInPlace(ped, "WORLD_HUMAN_GUARD_STAND_PATROL", 0, true)
  64.     SetPedCanRagdoll(ped, false)
  65.     SetPedDiesWhenInjured(ped, false)
  66.     end
  67.  
  68. end)
  69.  
  70. jobs = {peds = {}, flag = {}, blip = {}, cars = {}, coords = {cx={}, cy={}, cz={}}}
  71.  
  72. function StartJob(jobid)
  73.     if jobid == 1 then -- taxi
  74.         showLoadingPromt("Loading taxi mission", 2000, 3)
  75.         jobs.coords.cx[1],jobs.coords.cy[1],jobs.coords.cz[1] = 293.476,-590.163,42.7371
  76.         jobs.coords.cx[2],jobs.coords.cy[2],jobs.coords.cz[2] = 253.404,-375.86,44.0819
  77.         jobs.coords.cx[3],jobs.coords.cy[3],jobs.coords.cz[3] = 120.808,-300.416,45.1399
  78.         jobs.coords.cx[4],jobs.coords.cy[4],jobs.coords.cz[4] = -38.4132,-381.576,38.3456
  79.         jobs.coords.cx[5],jobs.coords.cy[5],jobs.coords.cz[5] = -107.442,-614.377,35.6703
  80.         jobs.coords.cx[6],jobs.coords.cy[6],jobs.coords.cz[6] = -252.292,-856.474,30.5626
  81.         jobs.coords.cx[7],jobs.coords.cy[7],jobs.coords.cz[7] = -236.138,-988.382,28.7749
  82.         jobs.coords.cx[8],jobs.coords.cy[8],jobs.coords.cz[8] = -276.989,-1061.18,25.6853
  83.         jobs.coords.cx[9],jobs.coords.cy[9],jobs.coords.cz[9] = -576.451,-998.989,21.785
  84.         jobs.coords.cx[10],jobs.coords.cy[10],jobs.coords.cz[10] = -602.798,-952.63,21.6353
  85.         jobs.coords.cx[11],jobs.coords.cy[11],jobs.coords.cz[11] = -790.653,-961.855,14.8932
  86.         jobs.coords.cx[12],jobs.coords.cy[12],jobs.coords.cz[12] = -912.588,-864.756,15.0057
  87.         jobs.coords.cx[13],jobs.coords.cy[13],jobs.coords.cz[13] = -1069.77,-792.513,18.8075
  88.         jobs.coords.cx[14],jobs.coords.cy[14],jobs.coords.cz[14] = -1306.94,-854.085,15.0959
  89.         jobs.coords.cx[15],jobs.coords.cy[15],jobs.coords.cz[15] = -1468.51,-681.363,26.178
  90.         jobs.coords.cx[16],jobs.coords.cy[16],jobs.coords.cz[16] = -1380.89,-452.7,34.0843
  91.         jobs.coords.cx[17],jobs.coords.cy[17],jobs.coords.cz[17] = -1326.35,-394.81,36.0632
  92.         jobs.coords.cx[18],jobs.coords.cy[18],jobs.coords.cz[18] = -1383.68,-269.985,42.4878
  93.         jobs.coords.cx[19],jobs.coords.cy[19],jobs.coords.cz[19] = -1679.61,-457.339,39.4048
  94.         jobs.coords.cx[20],jobs.coords.cy[20],jobs.coords.cz[20] = -1812.45,-416.917,43.6734
  95.         jobs.coords.cx[21],jobs.coords.cy[21],jobs.coords.cz[21] = -2043.64,-268.291,22.9927
  96.         jobs.coords.cx[22],jobs.coords.cy[22],jobs.coords.cz[22] = -2186.45,-421.595,12.6776
  97.         jobs.coords.cx[23],jobs.coords.cy[23],jobs.coords.cz[23] = -1862.08,-586.528,11.1747
  98.         jobs.coords.cx[24],jobs.coords.cy[24],jobs.coords.cz[24] = -1859.5,-617.563,10.8788
  99.         jobs.coords.cx[25],jobs.coords.cy[25],jobs.coords.cz[25] = -1634.95,-988.302,12.6241
  100.         jobs.coords.cx[26],jobs.coords.cy[26],jobs.coords.cz[26] = -1283.99,-1154.16,5.30998
  101.         jobs.coords.cx[27],jobs.coords.cy[27],jobs.coords.cz[27] = -1126.47,-1338.08,4.63434
  102.         jobs.coords.cx[28],jobs.coords.cy[28],jobs.coords.cz[28] = -867.907,-1159.67,5.00795
  103.         jobs.coords.cx[29],jobs.coords.cy[29],jobs.coords.cz[29] = -847.55,-1141.38,6.27591
  104.         jobs.coords.cx[30],jobs.coords.cy[30],jobs.coords.cz[30] = -722.625,-1144.6,10.2176
  105.         jobs.coords.cx[31],jobs.coords.cy[31],jobs.coords.cz[31] = -575.503,-318.446,34.5273
  106.         jobs.coords.cx[32],jobs.coords.cy[32],jobs.coords.cz[32] = -592.309,-224.853,36.1209
  107.         jobs.coords.cx[33],jobs.coords.cy[33],jobs.coords.cz[33] = -559.594,-162.873,37.7547
  108.         jobs.coords.cx[34],jobs.coords.cy[34],jobs.coords.cz[34] = -534.992,-65.6695,40.634
  109.         jobs.coords.cx[35],jobs.coords.cy[35],jobs.coords.cz[35] = -758.234,-36.6906,37.2911
  110.         jobs.coords.cx[36],jobs.coords.cy[36],jobs.coords.cz[36] = -1375.88,20.9516,53.2255
  111.         jobs.coords.cx[37],jobs.coords.cy[37],jobs.coords.cz[37] = -1320.25,-128.018,48.097
  112.         jobs.coords.cx[38],jobs.coords.cy[38],jobs.coords.cz[38] = -1285.71,294.287,64.4619
  113.         jobs.coords.cx[39],jobs.coords.cy[39],jobs.coords.cz[39] = -1245.67,386.533,75.0908
  114.         jobs.coords.cx[40],jobs.coords.cy[40],jobs.coords.cz[40] = -760.355,285.015,85.0667
  115.         jobs.coords.cx[41],jobs.coords.cy[41],jobs.coords.cz[41] = -626.786,254.146,81.0964
  116.         jobs.coords.cx[42],jobs.coords.cy[42],jobs.coords.cz[42] = -563.609,267.962,82.5116
  117.         jobs.coords.cx[43],jobs.coords.cy[43],jobs.coords.cz[43] = -486.806,271.977,82.8187
  118.         jobs.coords.cx[44],jobs.coords.cy[44],jobs.coords.cz[44] = 88.295,250.867,108.188
  119.         jobs.coords.cx[45],jobs.coords.cy[45],jobs.coords.cz[45] = 234.087,344.678,105.018
  120.         jobs.coords.cx[46],jobs.coords.cy[46],jobs.coords.cz[46] = 434.963,96.707,99.1713
  121.         jobs.coords.cx[47],jobs.coords.cy[47],jobs.coords.cz[47] = 482.617,-142.533,58.1936
  122.         jobs.coords.cx[48],jobs.coords.cy[48],jobs.coords.cz[48] = 762.651,-786.55,25.8915
  123.         jobs.coords.cx[49],jobs.coords.cy[49],jobs.coords.cz[49] = 809.06,-1290.8,25.7946
  124.         jobs.coords.cx[50],jobs.coords.cy[50],jobs.coords.cz[50] = 490.819,-1751.37,28.0987
  125.         jobs.coords.cx[51],jobs.coords.cy[51],jobs.coords.cz[51] = 432.351,-1856.11,27.0352
  126.         jobs.coords.cx[52],jobs.coords.cy[52],jobs.coords.cz[52] = 164.348,-1734.54,28.8982
  127.         jobs.coords.cx[53],jobs.coords.cy[53],jobs.coords.cz[53] = -57.6909,-1501.4,31.1084
  128.         jobs.coords.cx[54],jobs.coords.cy[54],jobs.coords.cz[54] = 52.2241,-1566.65,29.006
  129.         jobs.coords.cx[55],jobs.coords.cy[55],jobs.coords.cz[55] = 310.222,-1376.76,31.4442
  130.         jobs.coords.cx[56],jobs.coords.cy[56],jobs.coords.cz[56] = 181.967,-1332.79,28.8773
  131.         jobs.coords.cx[57],jobs.coords.cy[57],jobs.coords.cz[57] = -74.6091,-1100.64,25.738
  132.         jobs.coords.cx[58],jobs.coords.cy[58],jobs.coords.cz[58] = -887.045,-2187.46,8.13248
  133.         jobs.coords.cx[59],jobs.coords.cy[59],jobs.coords.cz[59] = -749.584,-2296.59,12.4627
  134.         jobs.coords.cx[60],jobs.coords.cy[60],jobs.coords.cz[60] = -1064.83,-2560.66,19.6811
  135.         jobs.coords.cx[61],jobs.coords.cy[61],jobs.coords.cz[61] = -1033.44,-2730.24,19.6868
  136.         jobs.coords.cx[62],jobs.coords.cy[62],jobs.coords.cz[62] = -1018.67,-2732,13.2687
  137.         jobs.coords.cx[63],jobs.coords.cy[63],jobs.coords.cz[63] = 797.354,-174.423,72.708
  138.         jobs.coords.cx[64],jobs.coords.cy[64],jobs.coords.cz[64] = 508.156, -117.908, 60.780
  139.         jobs.coords.cx[65],jobs.coords.cy[65],jobs.coords.cz[65] = 159.458, -27.555, 67.380
  140.         jobs.coords.cx[66],jobs.coords.cy[66],jobs.coords.cz[66] = -36.382, -106.912, 56.982
  141.         jobs.coords.cx[67],jobs.coords.cy[67],jobs.coords.cz[67] = -355.801, -270.404, 33.011
  142.     jobs.coords.cx[68],jobs.coords.cy[68],jobs.coords.cz[68] = -831.196, -76.871, 37.323
  143.     jobs.coords.cx[69],jobs.coords.cy[69],jobs.coords.cz[69] = -1038.707, -214.593, 37,437
  144.         jobs.coords.cx[70],jobs.coords.cy[70],jobs.coords.cz[70] = 1918.448, 3691.410, 32.261
  145.         jobs.coords.cx[71],jobs.coords.cy[71],jobs.coords.cz[71] = 1820.217, 3697.115, 33.493
  146.         jobs.coords.cx[72],jobs.coords.cy[72],jobs.coords.cz[72] = 1619.323, 3827.162, 34.482
  147.         jobs.coords.cx[73],jobs.coords.cy[73],jobs.coords.cz[73] = 1418.628, 3602.243, 34.511
  148.     jobs.coords.cx[74],jobs.coords.cy[74],jobs.coords.cz[74] = 1944.858, 3856.252, 31.741
  149.     jobs.coords.cx[75],jobs.coords.cy[75],jobs.coords.cz[75] = 2285.278, 3839.444, 34.023
  150.     jobs.coords.cx[76],jobs.coords.cy[76],jobs.coords.cz[76] = 2760.945, 3387.813, 55.659
  151.     jobs.coords.cx[77],jobs.coords.cy[77],jobs.coords.cz[77] = 1952.819, 2627.731, 45.368
  152.     jobs.coords.cx[78],jobs.coords.cy[78],jobs.coords.cz[78] = 1051.414, 474.833, 93.653
  153.     jobs.coords.cx[79],jobs.coords.cy[79],jobs.coords.cz[79] = 866.393, 17.635, 78.654
  154.     jobs.coords.cx[80],jobs.coords.cy[80],jobs.coords.cz[80] = 318.985, 167.410, 103.335
  155.     jobs.coords.cx[81],jobs.coords.cy[81],jobs.coords.cz[81] = 88.836, 254.054, 108.236
  156.     jobs.coords.cx[82],jobs.coords.cy[82],jobs.coords.cz[82] = -44.852, 70.414, 72.437
  157.     jobs.coords.cx[83],jobs.coords.cy[83],jobs.coords.cz[83] = -115.496, 84.333, 70.792
  158.     jobs.coords.cx[84],jobs.coords.cy[84],jobs.coords.cz[84] = -384.806, 226.868, 83.548
  159.     jobs.coords.cx[85],jobs.coords.cy[85],jobs.coords.cz[85] = -578.669, 139.085, 61.337
  160.     jobs.coords.cx[86],jobs.coords.cy[86],jobs.coords.cz[86] = -651.334, -584.879, 34.116
  161.     jobs.coords.cx[87],jobs.coords.cy[87],jobs.coords.cz[87] = -571.847, -1195.648, 17.869
  162.     jobs.coords.cx[88],jobs.coords.cy[88],jobs.coords.cz[88] = -1513.271, -670.039, 28.362
  163.     jobs.coords.cx[89],jobs.coords.cy[89],jobs.coords.cz[89] = -1297.484, -654.913, 26.123
  164.     jobs.coords.cx[90],jobs.coords.cy[90],jobs.coords.cz[90] = -1645.546, 144.571, 61.664
  165.     jobs.coords.cx[91],jobs.coords.cy[91],jobs.coords.cz[91] = -1160.618, 744.418, 154.571
  166.     jobs.coords.cx[92],jobs.coords.cy[92],jobs.coords.cz[92] = -798.090, 831.699, 204.351
  167.  
  168.         jobs.cars[1] = GetVehiclePedIsUsing(GetPlayerPed(-1))
  169.         jobs.flag[1] = 0
  170.         jobs.flag[2] = 59+GetRandomIntInRange(1, 61)
  171.         Wait(2000)
  172.         DrawMissionText("Drive around and look for ~h~~y~passengers~w~.", 10000)
  173.         onJob = jobid
  174.     end
  175. end
  176.  
  177. function drawTxt(x,y ,width,height,scale, text, r,g,b,a)
  178.     SetTextFont(0)
  179.     SetTextProportional(0)
  180.     SetTextScale(scale, scale)
  181.     SetTextColour(r, g, b, a)
  182.     SetTextDropShadow(0, 0, 0, 0,255)
  183.     SetTextEdge(1, 0, 0, 0, 255)
  184.     SetTextDropShadow()
  185.     SetTextOutline()
  186.     SetTextEntry("STRING")
  187.     AddTextComponentString(text)
  188.     DrawText(x - width/2, y - height/2 + 0.005)
  189. end
  190.  
  191. function DrawMissionText(m_text, showtime)
  192.     ClearPrints()
  193.     SetTextEntry_2("STRING")
  194.     AddTextComponentString(m_text)
  195.     DrawSubtitleTimed(showtime, 1)
  196. end
  197.  
  198. function showLoadingPromt(showText, showTime, showType)
  199.     Citizen.CreateThread(function()
  200.         Citizen.Wait(0)
  201.         N_0xaba17d7ce615adbf("STRING") -- set type
  202.         AddTextComponentString(showText) -- sets the text
  203.         N_0xbd12f8228410d9b4(showType) -- show promt (types = 3)
  204.         Citizen.Wait(showTime) -- show time
  205.         N_0x10d373323e5b9c0d() -- remove promt
  206.     end)
  207. end
  208.  
  209. function StopJob(jobid)
  210.     if jobid == 1 then
  211.         if DoesEntityExist(jobs.peds[1]) then
  212.             local pedb = GetBlipFromEntity(jobs.peds[1])
  213.             if pedb ~= nil and DoesBlipExist(pedb) then
  214.                 SetBlipSprite(pedb, 2)
  215.                 SetBlipDisplay(pedb, 3)
  216.             end
  217.             ClearPedTasksImmediately(jobs.peds[1])
  218.             if DoesEntityExist(jobs.cars[1]) and IsVehicleDriveable(jobs.cars[1], 0) then
  219.                 if IsPedSittingInVehicle(jobs.peds[1], jobs.cars[1]) then
  220.                     TaskLeaveVehicle(jobs.peds[1], jobs.cars[1], 0)
  221.                 end
  222.             end
  223.             Citizen.InvokeNative(0xB736A491E64A32CF,Citizen.PointerValueIntInitialized(jobs.peds[1]))
  224.         end
  225.         if jobs.blip[1] ~= nil and DoesBlipExist(jobs.blip[1]) then
  226.             Citizen.InvokeNative(0x86A652570E5F25DD,Citizen.PointerValueIntInitialized(jobs.blip[1]))
  227.             jobs.blip[1] = nil
  228.         end
  229.         onJob = 0
  230.         jobs.cars[1] = nil
  231.         jobs.peds[1] = nil
  232.         jobs.flag[1] = nil
  233.         jobs.flag[2] = nil
  234.     end
  235. end
  236.  
  237. Citizen.CreateThread(function()
  238.     while true do
  239.         Wait(0)
  240.         if onJob == 0 then
  241.             if IsControlJustPressed(1, 214) or IsDisabledControlJustPressed(1, 214) then -- DEL
  242.                 if IsPedSittingInAnyVehicle(GetPlayerPed(-1)) then
  243.                     if IsVehicleModel(GetVehiclePedIsUsing(GetPlayerPed(-1)), GetHashKey("taxi", _r)) then
  244.                         StartJob(1)
  245.                     end
  246.                 end
  247.             end
  248.         elseif onJob == 1 then
  249.             if DoesEntityExist(jobs.cars[1]) and IsVehicleDriveable(jobs.cars[1], 0) then
  250.                 if IsPedSittingInVehicle(GetPlayerPed(-1), jobs.cars[1]) then
  251.                     if DoesEntityExist(jobs.peds[1]) then
  252.                         if IsPedFatallyInjured(jobs.peds[1]) then
  253.                             Citizen.InvokeNative(0xB736A491E64A32CF,Citizen.PointerValueIntInitialized(jobs.peds[1]))
  254.                             local pedb = GetBlipFromEntity(jobs.peds[1])
  255.                             if pedb ~= nil and DoesBlipExist(pedb) then
  256.                                 SetBlipSprite(pedb, 2)
  257.                                 SetBlipDisplay(pedb, 3)
  258.                             end
  259.                             jobs.peds[1] = nil
  260.                             jobs.flag[1] = 0
  261.                             jobs.flag[2] = 59+GetRandomIntInRange(1, 90)
  262.                             if jobs.blip[1] ~= nil and DoesBlipExist(jobs.blip[1]) then
  263.                                 Citizen.InvokeNative(0x86A652570E5F25DD,Citizen.PointerValueIntInitialized(jobs.blip[1]))
  264.                                 jobs.blip[1] = nil
  265.                             end
  266.                             DrawMissionText("The client is ~r~dead~w~. Find another one.", 5000)
  267.                         else
  268.                             if jobs.flag[1] == 1 and jobs.flag[2] > 0 then
  269.                                 Wait(1000)
  270.                                 jobs.flag[2] = jobs.flag[2]-1
  271.                                 if jobs.flag[2] == 0 then
  272.                                     local pedb = GetBlipFromEntity(jobs.peds[1])
  273.                                     if pedb ~= nil and DoesBlipExist(pedb) then
  274.                                         SetBlipSprite(pedb, 2)
  275.                                         SetBlipDisplay(pedb, 3)
  276.                                     end
  277.                                     ClearPedTasksImmediately(jobs.peds[1])
  278.                                     Citizen.InvokeNative(0xB736A491E64A32CF,Citizen.PointerValueIntInitialized(jobs.peds[1]))
  279.                                     jobs.peds[1] = nil
  280.                                     DrawMissionText("The client got ~r~tired of waiting~w~. Find another one.", 5000)
  281.                                     jobs.flag[1] = 0
  282.                                     jobs.flag[2] = 59+GetRandomIntInRange(1, 61)
  283.                                 else
  284.                                     if IsPedSittingInVehicle(GetPlayerPed(-1), jobs.cars[1]) then
  285.                                         if GetDistanceBetweenCoords(GetEntityCoords(GetPlayerPed(-1)), GetEntityCoords(jobs.peds[1]), true) < 8.0001 then
  286.                                             local offs = GetOffsetFromEntityInWorldCoords(GetVehiclePedIsUsing(GetPlayerPed(-1)), 1.5, 0.0, 0.0)
  287.                                             local offs2 = GetOffsetFromEntityInWorldCoords(GetVehiclePedIsUsing(GetPlayerPed(-1)), -1.5, 0.0, 0.0)
  288.                                             if GetDistanceBetweenCoords(offs['x'], offs['y'], offs['z'], GetEntityCoords(jobs.peds[1]), true) < GetDistanceBetweenCoords(offs2['x'], offs2['y'], offs2['z'], GetEntityCoords(jobs.peds[1]), true) then
  289.                                                 TaskEnterVehicle(jobs.peds[1], jobs.cars[1], -1, 2, 2.0001, 1)
  290.                                             else
  291.                                                 TaskEnterVehicle(jobs.peds[1], jobs.cars[1], -1, 1, 2.0001, 1)
  292.                                             end
  293.                                             jobs.flag[1] = 2
  294.                                             jobs.flag[2] = 30
  295.                                         end
  296.                                     end
  297.                                 end
  298.                             end
  299.                             if jobs.flag[1] == 2 and jobs.flag[2] > 0 then
  300.                                 Wait(1000)
  301.                                 jobs.flag[2] = jobs.flag[2]-1
  302.                                 if jobs.flag[2] == 0 then
  303.                                     local pedb = GetBlipFromEntity(jobs.peds[1])
  304.                                     if pedb ~= nil and DoesBlipExist(pedb) then
  305.                                         SetBlipSprite(pedb, 2)
  306.                                         SetBlipDisplay(pedb, 3)
  307.                                     end
  308.                                     ClearPedTasksImmediately(jobs.peds[1])
  309.                                     Citizen.InvokeNative(0xB736A491E64A32CF,Citizen.PointerValueIntInitialized(jobs.peds[1]))
  310.                                     jobs.peds[1] = nil
  311.                                     DrawMissionText("~r~The client is not going with you~w~. Find another one.", 5000)
  312.                                     jobs.flag[1] = 0
  313.                                     jobs.flag[2] = 59+GetRandomIntInRange(1, 61)
  314.                                 else
  315.                                     if IsPedSittingInVehicle(jobs.peds[1], jobs.cars[1]) then
  316.                                         local pedb = GetBlipFromEntity(jobs.peds[1])
  317.                                         if pedb ~= nil and DoesBlipExist(pedb) then
  318.                                             SetBlipSprite(pedb, 2)
  319.                                             SetBlipDisplay(pedb, 3)
  320.                                         end
  321.                                         jobs.flag[1] = 3
  322.                                         jobs.flag[2] = GetRandomIntInRange(1, 62)
  323.                                         local street = table.pack(GetStreetNameAtCoord(jobs.coords.cx[jobs.flag[2]],jobs.coords.cy[jobs.flag[2]],jobs.coords.cz[jobs.flag[2]]))
  324.                                         if street[2] ~= 0 and street[2] ~= nil then
  325.                                             local streetname = string.format("~w~Take me to~y~ %s~w~, nearby~y~ %s", GetStreetNameFromHashKey(street[1]),GetStreetNameFromHashKey(street[2]))
  326.                                             DrawMissionText(streetname, 5000)
  327.                                         else
  328.                                             local streetname = string.format("~w~Take me to the~y~ %s", GetStreetNameFromHashKey(street[1]))
  329.                                             DrawMissionText(streetname, 5000)
  330.                                         end
  331.                                         jobs.blip[1] = AddBlipForCoord(jobs.coords.cx[jobs.flag[2]],jobs.coords.cy[jobs.flag[2]],jobs.coords.cz[jobs.flag[2]])
  332.                                         AddTextComponentString(GetStreetNameFromHashKey(street[1]))
  333.                                         N_0x80ead8e2e1d5d52e(jobs.blip[1])
  334.                                         SetBlipRoute(jobs.blip[1], 1)
  335.                                     end
  336.                                 end
  337.                             end
  338.                             if jobs.flag[1] == 3 then
  339.                                 if GetDistanceBetweenCoords(GetEntityCoords(GetPlayerPed(-1)), jobs.coords.cx[jobs.flag[2]],jobs.coords.cy[jobs.flag[2]],jobs.coords.cz[jobs.flag[2]], true) > 4.0001 then
  340.                                     DrawMarker(1, jobs.coords.cx[jobs.flag[2]],jobs.coords.cy[jobs.flag[2]],jobs.coords.cz[jobs.flag[2]]-1.0001, 0, 0, 0, 0, 0, 0, 4.0, 4.0, 2.0, 178, 236, 93, 155, 0, 0, 2, 0, 0, 0, 0)
  341.                                 else
  342.                                     if jobs.blip[1] ~= nil and DoesBlipExist(jobs.blip[1]) then
  343.                                         Citizen.InvokeNative(0x86A652570E5F25DD,Citizen.PointerValueIntInitialized(jobs.blip[1]))
  344.                                         jobs.blip[1] = nil
  345.                                     end
  346.                                     ClearPedTasksImmediately(jobs.peds[1])
  347.                                     TaskLeaveVehicle(jobs.peds[1], jobs.cars[1], 0)
  348.                                     Citizen.InvokeNative(0xB736A491E64A32CF,Citizen.PointerValueIntInitialized(jobs.peds[1]))
  349.                                     jobs.peds[1] = nil
  350.                                     Wait(6000)
  351.  
  352.                   TriggerServerEvent('taxi:success')
  353.                   DrawMissionText("~g~You have delivered the client!", 5000)
  354.                                     -- pay money on something
  355.                                     Wait(8000)
  356.                                     DrawMissionText("Drive around and look for new ~h~~y~customers~w~.", 10000)
  357.                                     jobs.flag[1] = 0
  358.                                     jobs.flag[2] = 59+GetRandomIntInRange(1, 90)
  359.                                 end
  360.                             end
  361.                         end
  362.                     else
  363.  
  364.                         if jobs.flag[1] > 0 then
  365.                             jobs.flag[1] = 0
  366.                             jobs.flag[2] = 59+GetRandomIntInRange(1, 61)
  367.                             DrawMissionText("Drive around and look for ~h~~y~customers~w~.", 10000)
  368.                             if jobs.blip[1] ~= nil and DoesBlipExist(jobs.blip[1]) then
  369.                                 Citizen.InvokeNative(0x86A652570E5F25DD,Citizen.PointerValueIntInitialized(jobs.blip[1]))
  370.                                 jobs.blip[1] = nil
  371.                             end
  372.                         end
  373.                         if jobs.flag[1] == 0 and jobs.flag[2] > 0 then
  374.                             Wait(1000)
  375.                             jobs.flag[2] = jobs.flag[2]-1
  376.                             if jobs.flag[2] == 0 then
  377.                                 local pos = GetEntityCoords(GetPlayerPed(-1))
  378.                                 local rped = GetRandomPedAtCoord(pos['x'], pos['y'], pos['z'], 35.001, 35.001, 35.001, 6, _r)
  379.                                 if DoesEntityExist(rped) then
  380.                                     jobs.peds[1] = rped
  381.                                     jobs.flag[1] = 1
  382.                                     jobs.flag[2] = 19+GetRandomIntInRange(1, 21)
  383.                                     ClearPedTasksImmediately(jobs.peds[1])
  384.                                     SetBlockingOfNonTemporaryEvents(jobs.peds[1], 1)
  385.                                     TaskStandStill(jobs.peds[1], 1000*jobs.flag[2])
  386.                                     DrawMissionText("The ~g~customer~w~ is waiting for you. Drive nearby", 5000)
  387.                                     local lblip = AddBlipForEntity(jobs.peds[1])
  388.                                     SetBlipAsFriendly(lblip, 1)
  389.                                     SetBlipColour(lblip, 2)
  390.                                     SetBlipCategory(lblip, 3)
  391.                                 else
  392.                                     jobs.flag[1] = 0
  393.                                     jobs.flag[2] = 59+GetRandomIntInRange(1, 90)
  394.                                     DrawMissionText("Drive around and look for ~h~~y~customers~w~.", 10000)
  395.                                 end
  396.                             end
  397.                         end
  398.                     end
  399.                 else
  400.                     if GetDistanceBetweenCoords(GetEntityCoords(GetPlayerPed(-1)), GetEntityCoords(jobs.cars[1]), true) > 30.0001 then
  401.                         StopJob(1)
  402.                     else
  403.                         DrawMissionText("Get back in your car to ~y~continue~w~. Or go away from the taxi vehicle to ~r~stop~ the mission.", 1)
  404.                     end
  405.                 end
  406.             else
  407.                 StopJob(1)
  408.                 DrawMissionText("The taxi is ~h~~r~destroyed~w~.", 5000)
  409.             end
  410.         end
  411.     end
  412. end)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement