Advertisement
Guest User

taxi.lua

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