Advertisement
Guest User

Untitled

a guest
Oct 19th, 2017
188
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 25.56 KB | None | 0 0
  1.  
  2. local Keys = {
  3.     ["ESC"] = 322, ["F1"] = 288, ["F2"] = 289, ["F3"] = 170, ["F5"] = 166, ["F6"] = 167, ["F7"] = 168, ["F8"] = 169, ["F9"] = 56, ["F10"] = 57,
  4.     ["~"] = 243, ["1"] = 157, ["2"] = 158, ["3"] = 160, ["4"] = 164, ["5"] = 165, ["6"] = 159, ["7"] = 161, ["8"] = 162, ["9"] = 163, ["-"] = 84, ["="] = 83, ["BACKSPACE"] = 177,
  5.     ["TAB"] = 37, ["Q"] = 44, ["W"] = 32, ["E"] = 38, ["R"] = 45, ["T"] = 245, ["Y"] = 246, ["U"] = 303, ["P"] = 199, ["["] = 39, ["]"] = 40, ["ENTER"] = 18,
  6.     ["CAPS"] = 137, ["A"] = 34, ["S"] = 8, ["D"] = 9, ["F"] = 23, ["G"] = 47, ["H"] = 74, ["K"] = 311, ["L"] = 182,
  7.     ["LEFTSHIFT"] = 21, ["Z"] = 20, ["X"] = 73, ["C"] = 26, ["V"] = 0, ["B"] = 29, ["N"] = 249, ["M"] = 244, [","] = 82, ["."] = 81,
  8.     ["LEFTCTRL"] = 36, ["LEFTALT"] = 19, ["SPACE"] = 22, ["RIGHTCTRL"] = 70,
  9.     ["HOME"] = 213, ["PAGEUP"] = 10, ["PAGEDOWN"] = 11, ["DELETE"] = 178,
  10.     ["LEFT"] = 174, ["RIGHT"] = 175, ["TOP"] = 27, ["DOWN"] = 173,
  11.     ["NENTER"] = 201, ["N4"] = 108, ["N5"] = 60, ["N6"] = 107, ["N+"] = 96, ["N-"] = 97, ["N7"] = 117, ["N8"] = 61, ["N9"] = 118
  12. }
  13.  
  14. local lang = 'fr'
  15.  
  16. local txt = {
  17.   ['fr'] = {
  18.         ['getService'] = 'Appuyez sur ~g~E~s~ pour prendre votre service',
  19.         ['dropService'] = 'Appuyez sur ~g~E~s~ pour terminer votre service',
  20.         ['getTaxi'] = 'Appuyez sur ~g~E~s~ pour obtenir un véhicule',
  21.         ['notTax'] = 'Vous n\'êtes pas Taxi',
  22.         ['stopService'] = 'Vous n\'êtes plus en service',
  23.         ['startService'] = 'Début du service'
  24.   }
  25.  
  26. }
  27.  
  28. local isInService = false
  29. local jobId = -1
  30.  
  31.  
  32. --[[
  33. ################################
  34.             THREADS
  35. ################################
  36. --]]
  37.  
  38. Citizen.CreateThread(
  39.     function()
  40.         local x = 903.306
  41.         local y = -169.464
  42.         local z = 74.08
  43.  
  44.         while true do
  45.             Citizen.Wait(1)
  46.  
  47.             local playerPos = GetEntityCoords(GetPlayerPed(-1), true)
  48.  
  49.             if (Vdist(playerPos.x, playerPos.y, playerPos.z, x, y, z) < 100.0) then
  50.                 -- Service
  51.                 DrawMarker(1, x, y, z - 1, 0, 0, 0, 0, 0, 0, 3.0001, 3.0001, 1.5001, 255, 165, 0,165, 0, 0, 0,0)
  52.  
  53.                 if (Vdist(playerPos.x, playerPos.y, playerPos.z, x, y, z) < 2.0) then
  54.                     if isInService then
  55.                         DisplayHelpText(txt[lang]['dropService'])
  56.                     else
  57.                         DisplayHelpText(txt[lang]['getService'])
  58.                     end
  59.  
  60.                     if (IsControlJustReleased(1, 51)) then
  61.                         TriggerServerEvent('es_tx:sv_getJobId')
  62.                     end
  63.                 end
  64.             end
  65.         end
  66. end)
  67.  
  68. Citizen.CreateThread(
  69.     function()
  70.         local x = 908.537
  71.         local y = -175.862
  72.         local z = 74.1722
  73.  
  74.         while true do
  75.             Citizen.Wait(1)
  76.  
  77.             local playerPos = GetEntityCoords(GetPlayerPed(-1), true)
  78.  
  79.             if (Vdist(playerPos.x, playerPos.y, playerPos.z, x, y, z) < 100.0) and isInService and jobId == 5 then
  80.                 -- Service car
  81.                 DrawMarker(1, x, y, z - 1, 0, 0, 0, 0, 0, 0, 3.0001, 3.0001, 1.5001, 255, 165, 0,165, 0, 0, 0,0)
  82.  
  83.                 if (Vdist(playerPos.x, playerPos.y, playerPos.z, x, y, z) < 2.0) then
  84.                     DisplayHelpText(txt[lang]['getTaxi'])
  85.  
  86.                     if (IsControlJustReleased(1, 51)) then
  87.                         SpawnTaxi()
  88.                     end
  89.                 end
  90.             end
  91.         end
  92. end)
  93.  
  94. --[[
  95. ################################
  96.             EVENTS
  97. ################################
  98. --]]
  99.  
  100.  
  101.  
  102. RegisterNetEvent('es_tx:cl_setJobId')
  103. AddEventHandler('es_tx:cl_setJobId',
  104.     function(p_jobId)
  105.         jobId = p_jobId
  106.         GetService()
  107.     end
  108. )
  109.  
  110. --[[
  111. ################################
  112.         BUSINESS METHODS
  113. ################################
  114. --]]
  115.  
  116. function SpawnTaxi()
  117.     Citizen.Wait(0)
  118.     local myPed = GetPlayerPed(-1)
  119.     local player = PlayerId()
  120.     local vehicle = GetHashKey('taxi')
  121.  
  122.     RequestModel(vehicle)
  123.  
  124.     while not HasModelLoaded(vehicle) do
  125.         Wait(1)
  126.     end
  127.  
  128.     local plate = math.random(100, 900)
  129.     local coords = GetOffsetFromEntityInWorldCoords(GetPlayerPed(-1), 0, 5.0, 0)
  130.     local spawned_car = CreateVehicle(vehicle, coords, 908.537, -175.862, 74.1722, true, false)
  131.  
  132.     SetVehicleOnGroundProperly(spawned_car)
  133.     SetVehicleNumberPlateText(spawned_car, "TAXI")
  134.     SetVehicleLivery(spawned_car, 2)
  135.     SetPedIntoVehicle(myPed, spawned_car, - 1)
  136.     SetModelAsNoLongerNeeded(vehicle)
  137.     Citizen.InvokeNative(0xB736A491E64A32CF, Citizen.PointerValueIntInitialized(spawned_car))
  138. end
  139.  
  140.  
  141.  
  142. -- Get job form server
  143. function GetService()
  144.     local playerPed = GetPlayerPed(-1)
  145.  
  146.     if jobId ~= 5 then
  147.     SendNotification(txt[lang]['notTax'])
  148.         return
  149.     end
  150.  
  151.     if isInService then
  152.         SendNotification(txt[lang]['stopService'])
  153.         TriggerServerEvent('es_tx:sv_setService', 0)
  154.         TriggerServerEvent("player:serviceOff","uber")
  155.         --TriggerServerEvent("jobssystem:jobs", 1) --REPASSER EN CHOMEUR A TEST
  156.     else
  157.         SendNotification(txt[lang]['startService'])
  158.         TriggerServerEvent('es_tx:sv_setService', 1)
  159.         TriggerServerEvent("player:serviceOn","uber")
  160.     end
  161.  
  162.     isInService = not isInService
  163.  
  164.    
  165. end
  166.  
  167. --[[
  168. ################################
  169.         USEFUL METHODS
  170. ################################
  171. --]]
  172.  
  173. function DisplayHelpText(str)
  174.     SetTextComponentFormat("STRING")
  175.     AddTextComponentString(str)
  176.     DisplayHelpTextFromStringLabel(0, 0, 1, -1)
  177. end
  178.  
  179. function SendNotification(message)
  180.     SetNotificationTextEntry("STRING")
  181.     AddTextComponentString(message)
  182.     DrawNotification(false, false)
  183. end
  184.  
  185.  
  186.  
  187. function GetPlayers()
  188.     local players = {}
  189.  
  190.     for i = 0, 31 do
  191.         if NetworkIsPlayerActive(i) then
  192.             table.insert(players, i)
  193.         end
  194.     end
  195.  
  196.     return players
  197. end
  198.  
  199. --[[
  200. ################################
  201.         Taxi job
  202. ################################
  203. --]]
  204. -- Configure the coordinates where the taxi cabs should be placed.
  205. local cabs = {
  206.    { hash=0xC703DB5F, x=918.592, y=-166.732, z=74.250, a=100.938 },
  207.    { hash=0xC703DB5F, x=917.207, y=-171.100, z=74.489, a=85.422 },
  208.   }
  209.  
  210.     -- Configure the coordinates where the taxi cabs should be placed.
  211. local peds = {
  212.   {type=4, hash=0xe52e126c, x=894.422, y=-182.196, z=74.700, a=269.449},
  213.   {type=4, hash=0xe52e126c, x=895.422, y=-180.234, z=74.700, a=260.402},
  214.   {type=4, hash=0xe52e126c, x=900.742, y=-174.138, z=73.936, a=265.213},
  215.   }
  216.  
  217. AddEventHandler('onClientMapStart', function()
  218. RequestModel(0xC703DB5F)
  219. while not HasModelLoaded(0xC703DB5F) do
  220.     Wait(1)
  221. end
  222.  
  223. RequestModel(0xe52e126c)
  224. while not HasModelLoaded(0xe52e126c) do
  225.     Wait(1)
  226. end
  227.  
  228. --Set a blip on the map for Downtown Cab
  229. local blips = {
  230.     -- Example {title="", colour=, id=, x=, y=, z=},
  231.         --taxi
  232.     {title="Taxi", colour=15, id=198, x=908.537, y=-175.862, z=74.1722},
  233.  
  234.   }
  235.  
  236. Citizen.CreateThread(function()
  237.  
  238.     for _, info in pairs(blips) do
  239.       info.blip = AddBlipForCoord(info.x, info.y, info.z)
  240.       SetBlipSprite(info.blip, info.id)
  241.       SetBlipDisplay(info.blip, 4)
  242.       SetBlipScale(info.blip, 0.9)
  243.       SetBlipColour(info.blip, info.colour)
  244.       SetBlipAsShortRange(info.blip, true)
  245.       BeginTextCommandSetBlipName("STRING")
  246.       AddTextComponentString(info.title)
  247.       EndTextCommandSetBlipName(info.blip)
  248.     end
  249. end)
  250.  
  251. -- Spawn the taxi cab to DownTown Cab
  252. for _, item in pairs(cabs) do
  253.     cab =  CreateVehicle(item.hash, item.x, item.y, item.z, item.a, false, false)
  254.     SetVehicleOnGroundProperly(cab)
  255. end
  256.  
  257. -- Spawn the gang members to the coordinates (testing)
  258. for _, item in pairs(peds) do
  259.     ped = CreatePed(item.type, item.hash, item.x, item.y, item.z, item.a, false, true)
  260.     GiveWeaponToPed(ped, 0x1B06D571, 2800, false, true)
  261.     SetPedCombatAttributes(ped, 46, true)
  262.     SetPedFleeAttributes(ped, 0, 0)
  263.     SetPedArmour(ped, 100)
  264.     SetPedMaxHealth(ped, 100)
  265.     SetPedRelationshipGroupHash(ped, GetHashKey("GANG_1"))
  266.     TaskStartScenarioInPlace(ped, "WORLD_HUMAN_GUARD_STAND_PATROL", 0, true)
  267.     SetPedCanRagdoll(ped, false)
  268.     SetPedDiesWhenInjured(ped, false)
  269.     end
  270.  
  271. end)
  272.  
  273. onJob = 0
  274.  
  275. jobs = {peds = {}, flag = {}, blip = {}, cars = {}, coords = {cx={}, cy={}, cz={}}}
  276.  
  277. function StartJob(jobid)
  278.     if jobid == 1 then -- taxi
  279.         showLoadingPromt("Loading taxi mission", 2000, 3)
  280.         jobs.coords.cx[1],jobs.coords.cy[1],jobs.coords.cz[1] = 293.476,-590.163,42.7371
  281.         jobs.coords.cx[2],jobs.coords.cy[2],jobs.coords.cz[2] = 253.404,-375.86,44.0819
  282.         jobs.coords.cx[3],jobs.coords.cy[3],jobs.coords.cz[3] = 120.808,-300.416,45.1399
  283.         jobs.coords.cx[4],jobs.coords.cy[4],jobs.coords.cz[4] = -38.4132,-381.576,38.3456
  284.         jobs.coords.cx[5],jobs.coords.cy[5],jobs.coords.cz[5] = -107.442,-614.377,35.6703
  285.         jobs.coords.cx[6],jobs.coords.cy[6],jobs.coords.cz[6] = -252.292,-856.474,30.5626
  286.         jobs.coords.cx[7],jobs.coords.cy[7],jobs.coords.cz[7] = -236.138,-988.382,28.7749
  287.         jobs.coords.cx[8],jobs.coords.cy[8],jobs.coords.cz[8] = -276.989,-1061.18,25.6853
  288.         jobs.coords.cx[9],jobs.coords.cy[9],jobs.coords.cz[9] = -576.451,-998.989,21.785
  289.         jobs.coords.cx[10],jobs.coords.cy[10],jobs.coords.cz[10] = -602.798,-952.63,21.6353
  290.         jobs.coords.cx[11],jobs.coords.cy[11],jobs.coords.cz[11] = -790.653,-961.855,14.8932
  291.         jobs.coords.cx[12],jobs.coords.cy[12],jobs.coords.cz[12] = -912.588,-864.756,15.0057
  292.         jobs.coords.cx[13],jobs.coords.cy[13],jobs.coords.cz[13] = -1069.77,-792.513,18.8075
  293.         jobs.coords.cx[14],jobs.coords.cy[14],jobs.coords.cz[14] = -1306.94,-854.085,15.0959
  294.         jobs.coords.cx[15],jobs.coords.cy[15],jobs.coords.cz[15] = -1468.51,-681.363,26.178
  295.         jobs.coords.cx[16],jobs.coords.cy[16],jobs.coords.cz[16] = -1380.89,-452.7,34.0843
  296.         jobs.coords.cx[17],jobs.coords.cy[17],jobs.coords.cz[17] = -1326.35,-394.81,36.0632
  297.         jobs.coords.cx[18],jobs.coords.cy[18],jobs.coords.cz[18] = -1383.68,-269.985,42.4878
  298.         jobs.coords.cx[19],jobs.coords.cy[19],jobs.coords.cz[19] = -1679.61,-457.339,39.4048
  299.         jobs.coords.cx[20],jobs.coords.cy[20],jobs.coords.cz[20] = -1812.45,-416.917,43.6734
  300.         jobs.coords.cx[21],jobs.coords.cy[21],jobs.coords.cz[21] = -2043.64,-268.291,22.9927
  301.         jobs.coords.cx[22],jobs.coords.cy[22],jobs.coords.cz[22] = -2186.45,-421.595,12.6776
  302.         jobs.coords.cx[23],jobs.coords.cy[23],jobs.coords.cz[23] = -1862.08,-586.528,11.1747
  303.         jobs.coords.cx[24],jobs.coords.cy[24],jobs.coords.cz[24] = -1859.5,-617.563,10.8788
  304.         jobs.coords.cx[25],jobs.coords.cy[25],jobs.coords.cz[25] = -1634.95,-988.302,12.6241
  305.         jobs.coords.cx[26],jobs.coords.cy[26],jobs.coords.cz[26] = -1283.99,-1154.16,5.30998
  306.         jobs.coords.cx[27],jobs.coords.cy[27],jobs.coords.cz[27] = -1126.47,-1338.08,4.63434
  307.         jobs.coords.cx[28],jobs.coords.cy[28],jobs.coords.cz[28] = -867.907,-1159.67,5.00795
  308.         jobs.coords.cx[29],jobs.coords.cy[29],jobs.coords.cz[29] = -847.55,-1141.38,6.27591
  309.         jobs.coords.cx[30],jobs.coords.cy[30],jobs.coords.cz[30] = -722.625,-1144.6,10.2176
  310.         jobs.coords.cx[31],jobs.coords.cy[31],jobs.coords.cz[31] = -575.503,-318.446,34.5273
  311.         jobs.coords.cx[32],jobs.coords.cy[32],jobs.coords.cz[32] = -592.309,-224.853,36.1209
  312.         jobs.coords.cx[33],jobs.coords.cy[33],jobs.coords.cz[33] = -559.594,-162.873,37.7547
  313.         jobs.coords.cx[34],jobs.coords.cy[34],jobs.coords.cz[34] = -534.992,-65.6695,40.634
  314.         jobs.coords.cx[35],jobs.coords.cy[35],jobs.coords.cz[35] = -758.234,-36.6906,37.2911
  315.         jobs.coords.cx[36],jobs.coords.cy[36],jobs.coords.cz[36] = -1375.88,20.9516,53.2255
  316.         jobs.coords.cx[37],jobs.coords.cy[37],jobs.coords.cz[37] = -1320.25,-128.018,48.097
  317.         jobs.coords.cx[38],jobs.coords.cy[38],jobs.coords.cz[38] = -1285.71,294.287,64.4619
  318.         jobs.coords.cx[39],jobs.coords.cy[39],jobs.coords.cz[39] = -1245.67,386.533,75.0908
  319.         jobs.coords.cx[40],jobs.coords.cy[40],jobs.coords.cz[40] = -760.355,285.015,85.0667
  320.         jobs.coords.cx[41],jobs.coords.cy[41],jobs.coords.cz[41] = -626.786,254.146,81.0964
  321.         jobs.coords.cx[42],jobs.coords.cy[42],jobs.coords.cz[42] = -563.609,267.962,82.5116
  322.         jobs.coords.cx[43],jobs.coords.cy[43],jobs.coords.cz[43] = -486.806,271.977,82.8187
  323.         jobs.coords.cx[44],jobs.coords.cy[44],jobs.coords.cz[44] = 88.295,250.867,108.188
  324.         jobs.coords.cx[45],jobs.coords.cy[45],jobs.coords.cz[45] = 234.087,344.678,105.018
  325.         jobs.coords.cx[46],jobs.coords.cy[46],jobs.coords.cz[46] = 434.963,96.707,99.1713
  326.         jobs.coords.cx[47],jobs.coords.cy[47],jobs.coords.cz[47] = 482.617,-142.533,58.1936
  327.         jobs.coords.cx[48],jobs.coords.cy[48],jobs.coords.cz[48] = 762.651,-786.55,25.8915
  328.         jobs.coords.cx[49],jobs.coords.cy[49],jobs.coords.cz[49] = 809.06,-1290.8,25.7946
  329.         jobs.coords.cx[50],jobs.coords.cy[50],jobs.coords.cz[50] = 490.819,-1751.37,28.0987
  330.         jobs.coords.cx[51],jobs.coords.cy[51],jobs.coords.cz[51] = 432.351,-1856.11,27.0352
  331.         jobs.coords.cx[52],jobs.coords.cy[52],jobs.coords.cz[52] = 164.348,-1734.54,28.8982
  332.         jobs.coords.cx[53],jobs.coords.cy[53],jobs.coords.cz[53] = -57.6909,-1501.4,31.1084
  333.         jobs.coords.cx[54],jobs.coords.cy[54],jobs.coords.cz[54] = 52.2241,-1566.65,29.006
  334.         jobs.coords.cx[55],jobs.coords.cy[55],jobs.coords.cz[55] = 310.222,-1376.76,31.4442
  335.         jobs.coords.cx[56],jobs.coords.cy[56],jobs.coords.cz[56] = 181.967,-1332.79,28.8773
  336.         jobs.coords.cx[57],jobs.coords.cy[57],jobs.coords.cz[57] = -74.6091,-1100.64,25.738
  337.         jobs.coords.cx[58],jobs.coords.cy[58],jobs.coords.cz[58] = -887.045,-2187.46,8.13248
  338.         jobs.coords.cx[59],jobs.coords.cy[59],jobs.coords.cz[59] = -749.584,-2296.59,12.4627
  339.         jobs.coords.cx[60],jobs.coords.cy[60],jobs.coords.cz[60] = -1064.83,-2560.66,19.6811
  340.         jobs.coords.cx[61],jobs.coords.cy[61],jobs.coords.cz[61] = -1033.44,-2730.24,19.6868
  341.         jobs.coords.cx[62],jobs.coords.cy[62],jobs.coords.cz[62] = -1018.67,-2732,13.2687
  342.         jobs.coords.cx[63],jobs.coords.cy[63],jobs.coords.cz[63] = 797.354,-174.423,72.708
  343.         jobs.coords.cx[64],jobs.coords.cy[64],jobs.coords.cz[64] = 508.156, -117.908, 60.780
  344.         jobs.coords.cx[65],jobs.coords.cy[65],jobs.coords.cz[65] = 159.458, -27.555, 67.380
  345.         jobs.coords.cx[66],jobs.coords.cy[66],jobs.coords.cz[66] = -36.382, -106.912, 56.982
  346.         jobs.coords.cx[67],jobs.coords.cy[67],jobs.coords.cz[67] = -355.801, -270.404, 33.011
  347.         jobs.coords.cx[68],jobs.coords.cy[68],jobs.coords.cz[68] = -831.196, -76.871, 37.323
  348.         jobs.coords.cx[69],jobs.coords.cy[69],jobs.coords.cz[69] = -1038.707, -214.593, 37,437
  349.         jobs.coords.cx[70],jobs.coords.cy[70],jobs.coords.cz[70] = 1918.448, 3691.410, 32.261
  350.         jobs.coords.cx[71],jobs.coords.cy[71],jobs.coords.cz[71] = 1820.217, 3697.115, 33.493
  351.         jobs.coords.cx[72],jobs.coords.cy[72],jobs.coords.cz[72] = 1619.323, 3827.162, 34.482
  352.         jobs.coords.cx[73],jobs.coords.cy[73],jobs.coords.cz[73] = 1418.628, 3602.243, 34.511
  353.         jobs.coords.cx[74],jobs.coords.cy[74],jobs.coords.cz[74] = 1944.858, 3856.252, 31.741
  354.         jobs.coords.cx[75],jobs.coords.cy[75],jobs.coords.cz[75] = 2285.278, 3839.444, 34.023
  355.         jobs.coords.cx[76],jobs.coords.cy[76],jobs.coords.cz[76] = 2760.945, 3387.813, 55.659
  356.         jobs.coords.cx[77],jobs.coords.cy[77],jobs.coords.cz[77] = 1952.819, 2627.731, 45.368
  357.         jobs.coords.cx[78],jobs.coords.cy[78],jobs.coords.cz[78] = 1051.414, 474.833, 93.653
  358.         jobs.coords.cx[79],jobs.coords.cy[79],jobs.coords.cz[79] = 866.393, 17.635, 78.654
  359.         jobs.coords.cx[80],jobs.coords.cy[80],jobs.coords.cz[80] = 318.985, 167.410, 103.335
  360.         jobs.coords.cx[81],jobs.coords.cy[81],jobs.coords.cz[81] = 88.836, 254.054, 108.236
  361.         jobs.coords.cx[82],jobs.coords.cy[82],jobs.coords.cz[82] = -44.852, 70.414, 72.437
  362.         jobs.coords.cx[83],jobs.coords.cy[83],jobs.coords.cz[83] = -115.496, 84.333, 70.792
  363.         jobs.coords.cx[84],jobs.coords.cy[84],jobs.coords.cz[84] = -384.806, 226.868, 83.548
  364.         jobs.coords.cx[85],jobs.coords.cy[85],jobs.coords.cz[85] = -578.669, 139.085, 61.337
  365.         jobs.coords.cx[86],jobs.coords.cy[86],jobs.coords.cz[86] = -651.334, -584.879, 34.116
  366.         jobs.coords.cx[87],jobs.coords.cy[87],jobs.coords.cz[87] = -571.847, -1195.648, 17.869
  367.         jobs.coords.cx[88],jobs.coords.cy[88],jobs.coords.cz[88] = -1513.271, -670.039, 28.362
  368.         jobs.coords.cx[89],jobs.coords.cy[89],jobs.coords.cz[89] = -1297.484, -654.913, 26.123
  369.         jobs.coords.cx[90],jobs.coords.cy[90],jobs.coords.cz[90] = -1645.546, 144.571, 61.664
  370.         jobs.coords.cx[91],jobs.coords.cy[91],jobs.coords.cz[91] = -1160.618, 744.418, 154.571
  371.         jobs.coords.cx[92],jobs.coords.cy[92],jobs.coords.cz[92] = -798.090, 831.699, 204.351
  372.  
  373.         jobs.cars[1] = GetVehiclePedIsUsing(GetPlayerPed(-1))
  374.         jobs.flag[1] = 0
  375.         jobs.flag[2] = 59+GetRandomIntInRange(1, 61)
  376.         Wait(2000)
  377.         DrawMissionText("Cherches toi des ~h~~y~clients~w~.", 10000)
  378.         onJob = jobid
  379.     end
  380. end
  381.  
  382. function drawTxt(x,y ,width,height,scale, text, r,g,b,a)
  383.     SetTextFont(0)
  384.     SetTextProportional(0)
  385.     SetTextScale(scale, scale)
  386.     SetTextColour(r, g, b, a)
  387.     SetTextDropShadow(0, 0, 0, 0,255)
  388.     SetTextEdge(1, 0, 0, 0, 255)
  389.     SetTextDropShadow()
  390.     SetTextOutline()
  391.     SetTextEntry("STRING")
  392.     AddTextComponentString(text)
  393.     DrawText(x - width/2, y - height/2 + 0.005)
  394. end
  395.  
  396. function DrawMissionText(m_text, showtime)
  397.     ClearPrints()
  398.     SetTextEntry_2("STRING")
  399.     AddTextComponentString(m_text)
  400.     DrawSubtitleTimed(showtime, 1)
  401. end
  402.  
  403. function showLoadingPromt(showText, showTime, showType)
  404.     Citizen.CreateThread(function()
  405.         Citizen.Wait(0)
  406.         N_0xaba17d7ce615adbf("STRING") -- set type
  407.         AddTextComponentString(showText) -- sets the text
  408.         N_0xbd12f8228410d9b4(showType) -- show promt (types = 3)
  409.         Citizen.Wait(showTime) -- show time
  410.         N_0x10d373323e5b9c0d() -- remove promt
  411.     end)
  412. end
  413.  
  414. function StopJob(jobid)
  415.     if jobid == 1 then
  416.         if DoesEntityExist(jobs.peds[1]) then
  417.             local pedb = GetBlipFromEntity(jobs.peds[1])
  418.             if pedb ~= nil and DoesBlipExist(pedb) then
  419.                 SetBlipSprite(pedb, 2)
  420.                 SetBlipDisplay(pedb, 3)
  421.             end
  422.             ClearPedTasksImmediately(jobs.peds[1])
  423.             if DoesEntityExist(jobs.cars[1]) and IsVehicleDriveable(jobs.cars[1], 0) then
  424.                 if IsPedSittingInVehicle(jobs.peds[1], jobs.cars[1]) then
  425.                     TaskLeaveVehicle(jobs.peds[1], jobs.cars[1], 0)
  426.                 end
  427.             end
  428.             Citizen.InvokeNative(0xB736A491E64A32CF,Citizen.PointerValueIntInitialized(jobs.peds[1]))
  429.         end
  430.         if jobs.blip[1] ~= nil and DoesBlipExist(jobs.blip[1]) then
  431.             Citizen.InvokeNative(0x86A652570E5F25DD,Citizen.PointerValueIntInitialized(jobs.blip[1]))
  432.             jobs.blip[1] = nil
  433.         end
  434.         onJob = 0
  435.         jobs.cars[1] = nil
  436.         jobs.peds[1] = nil
  437.         jobs.flag[1] = nil
  438.         jobs.flag[2] = nil
  439.     end
  440. end
  441.  
  442. Citizen.CreateThread(function()
  443.     while true do
  444.         Wait(0)
  445.         if onJob == 0 and isInService then
  446.             if IsControlJustPressed(1, 214) or IsDisabledControlJustPressed(1, 214) and isInService then -- DEL
  447.                 if IsPedSittingInAnyVehicle(GetPlayerPed(-1)) then
  448.                     if IsVehicleModel(GetVehiclePedIsUsing(GetPlayerPed(-1)), GetHashKey("taxi", _r)) then
  449.                         StartJob(1)
  450.                     end
  451.                 end
  452.             end
  453.         elseif onJob == 1 then
  454.             if DoesEntityExist(jobs.cars[1]) and IsVehicleDriveable(jobs.cars[1], 0) then
  455.                 if IsPedSittingInVehicle(GetPlayerPed(-1), jobs.cars[1]) then
  456.                     if DoesEntityExist(jobs.peds[1]) then
  457.                         if IsPedFatallyInjured(jobs.peds[1]) then
  458.                             Citizen.InvokeNative(0xB736A491E64A32CF,Citizen.PointerValueIntInitialized(jobs.peds[1]))
  459.                             local pedb = GetBlipFromEntity(jobs.peds[1])
  460.                             if pedb ~= nil and DoesBlipExist(pedb) then
  461.                                 SetBlipSprite(pedb, 2)
  462.                                 SetBlipDisplay(pedb, 3)
  463.                             end
  464.                             jobs.peds[1] = nil
  465.                             jobs.flag[1] = 0
  466.                             jobs.flag[2] = 59+GetRandomIntInRange(1, 90)
  467.                             if jobs.blip[1] ~= nil and DoesBlipExist(jobs.blip[1]) then
  468.                                 Citizen.InvokeNative(0x86A652570E5F25DD,Citizen.PointerValueIntInitialized(jobs.blip[1]))
  469.                                 jobs.blip[1] = nil
  470.                             end
  471.                             DrawMissionText("Le client est ~r~decede~w~. Files en trouver un autre.", 5000)
  472.                         else
  473.                             if jobs.flag[1] == 1 and jobs.flag[2] > 0 then
  474.                                 Wait(1000)
  475.                                 jobs.flag[2] = jobs.flag[2]-1
  476.                                 if jobs.flag[2] == 0 then
  477.                                     local pedb = GetBlipFromEntity(jobs.peds[1])
  478.                                     if pedb ~= nil and DoesBlipExist(pedb) then
  479.                                         SetBlipSprite(pedb, 2)
  480.                                         SetBlipDisplay(pedb, 3)
  481.                                     end
  482.                                     ClearPedTasksImmediately(jobs.peds[1])
  483.                                     Citizen.InvokeNative(0xB736A491E64A32CF,Citizen.PointerValueIntInitialized(jobs.peds[1]))
  484.                                     jobs.peds[1] = nil
  485.                                     DrawMissionText("Le client en a eu ~r~marre~w~. Trouves en un autre tout de suite.", 5000)
  486.                                     jobs.flag[1] = 0
  487.                                     jobs.flag[2] = 59+GetRandomIntInRange(1, 61)
  488.                                 else
  489.                                     if IsPedSittingInVehicle(GetPlayerPed(-1), jobs.cars[1]) then
  490.                                         if GetDistanceBetweenCoords(GetEntityCoords(GetPlayerPed(-1)), GetEntityCoords(jobs.peds[1]), true) < 8.0001 then
  491.                                             local offs = GetOffsetFromEntityInWorldCoords(GetVehiclePedIsUsing(GetPlayerPed(-1)), 1.5, 0.0, 0.0)
  492.                                             local offs2 = GetOffsetFromEntityInWorldCoords(GetVehiclePedIsUsing(GetPlayerPed(-1)), -1.5, 0.0, 0.0)
  493.                                             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
  494.                                                 TaskEnterVehicle(jobs.peds[1], jobs.cars[1], -1, 2, 2.0001, 1)
  495.                                             else
  496.                                                 TaskEnterVehicle(jobs.peds[1], jobs.cars[1], -1, 1, 2.0001, 1)
  497.                                             end
  498.                                             jobs.flag[1] = 2
  499.                                             jobs.flag[2] = 30
  500.                                         end
  501.                                     end
  502.                                 end
  503.                             end
  504.                             if jobs.flag[1] == 2 and jobs.flag[2] > 0 then
  505.                                 Wait(1000)
  506.                                 jobs.flag[2] = jobs.flag[2]-1
  507.                                 if jobs.flag[2] == 0 then
  508.                                     local pedb = GetBlipFromEntity(jobs.peds[1])
  509.                                     if pedb ~= nil and DoesBlipExist(pedb) then
  510.                                         SetBlipSprite(pedb, 2)
  511.                                         SetBlipDisplay(pedb, 3)
  512.                                     end
  513.                                     ClearPedTasksImmediately(jobs.peds[1])
  514.                                     Citizen.InvokeNative(0xB736A491E64A32CF,Citizen.PointerValueIntInitialized(jobs.peds[1]))
  515.                                     jobs.peds[1] = nil
  516.                                     DrawMissionText("~r~Le client te prend pour un fou~w~. Fiches le camp ou il va appeler les flics.", 5000)
  517.                                     jobs.flag[1] = 0
  518.                                     jobs.flag[2] = 59+GetRandomIntInRange(1, 61)
  519.                                 else
  520.                                     if IsPedSittingInVehicle(jobs.peds[1], jobs.cars[1]) then
  521.                                         local pedb = GetBlipFromEntity(jobs.peds[1])
  522.                                         if pedb ~= nil and DoesBlipExist(pedb) then
  523.                                             SetBlipSprite(pedb, 2)
  524.                                             SetBlipDisplay(pedb, 3)
  525.                                         end
  526.                                         jobs.flag[1] = 3
  527.                                         jobs.flag[2] = GetRandomIntInRange(1, 62)
  528.                                         local street = table.pack(GetStreetNameAtCoord(jobs.coords.cx[jobs.flag[2]],jobs.coords.cy[jobs.flag[2]],jobs.coords.cz[jobs.flag[2]]))
  529.                                         if street[2] ~= 0 and street[2] ~= nil then
  530.                                             local streetname = string.format("~w~Conduisez moi a~y~ %s~w~, a cote de~y~ %s", GetStreetNameFromHashKey(street[1]),GetStreetNameFromHashKey(street[2]))
  531.                                             DrawMissionText(streetname, 5000)
  532.                                         else
  533.                                             local streetname = string.format("~w~On va a~y~ %s", GetStreetNameFromHashKey(street[1]))
  534.                                             DrawMissionText(streetname, 5000)
  535.                                         end
  536.                                         jobs.blip[1] = AddBlipForCoord(jobs.coords.cx[jobs.flag[2]],jobs.coords.cy[jobs.flag[2]],jobs.coords.cz[jobs.flag[2]])
  537.                                         AddTextComponentString(GetStreetNameFromHashKey(street[1]))
  538.                                         N_0x80ead8e2e1d5d52e(jobs.blip[1])
  539.                                         SetBlipRoute(jobs.blip[1], 1)
  540.                                     end
  541.                                 end
  542.                             end
  543.                             if jobs.flag[1] == 3 then
  544.                                 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
  545.                                     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)
  546.                                 else
  547.                                     if jobs.blip[1] ~= nil and DoesBlipExist(jobs.blip[1]) then
  548.                                         Citizen.InvokeNative(0x86A652570E5F25DD,Citizen.PointerValueIntInitialized(jobs.blip[1]))
  549.                                         jobs.blip[1] = nil
  550.                                     end
  551.                                     ClearPedTasksImmediately(jobs.peds[1])
  552.                                     TaskLeaveVehicle(jobs.peds[1], jobs.cars[1], 0)
  553.                                     Citizen.InvokeNative(0xB736A491E64A32CF,Citizen.PointerValueIntInitialized(jobs.peds[1]))
  554.                                     jobs.peds[1] = nil
  555.                                     Wait(6000)
  556.  
  557.                   TriggerServerEvent('taxi:success')
  558.                   DrawMissionText("~g~Client arrivé à bon port!", 5000)
  559.                                     -- pay money on something
  560.                                     Wait(8000)
  561.                                     DrawMissionText("Cherches toi des ~h~~y~clients~w~.", 10000)
  562.                                     jobs.flag[1] = 0
  563.                                     jobs.flag[2] = 59+GetRandomIntInRange(1, 90)
  564.                                 end
  565.                             end
  566.                         end
  567.                     else
  568.  
  569.                         if jobs.flag[1] > 0 then
  570.                             jobs.flag[1] = 0
  571.                             jobs.flag[2] = 59+GetRandomIntInRange(1, 61)
  572.                             DrawMissionText("Vas chercher des ~h~~y~clients~w~.", 10000)
  573.                             if jobs.blip[1] ~= nil and DoesBlipExist(jobs.blip[1]) then
  574.                                 Citizen.InvokeNative(0x86A652570E5F25DD,Citizen.PointerValueIntInitialized(jobs.blip[1]))
  575.                                 jobs.blip[1] = nil
  576.                             end
  577.                         end
  578.                         if jobs.flag[1] == 0 and jobs.flag[2] > 0 then
  579.                             Wait(1000)
  580.                             jobs.flag[2] = jobs.flag[2]-1
  581.                             if jobs.flag[2] == 0 then
  582.                                 local pos = GetEntityCoords(GetPlayerPed(-1))
  583.                                 local rped = GetRandomPedAtCoord(pos['x'], pos['y'], pos['z'], 35.001, 35.001, 35.001, 6, _r)
  584.                                 if DoesEntityExist(rped) then
  585.                                     jobs.peds[1] = rped
  586.                                     jobs.flag[1] = 1
  587.                                     jobs.flag[2] = 19+GetRandomIntInRange(1, 21)
  588.                                     ClearPedTasksImmediately(jobs.peds[1])
  589.                                     SetBlockingOfNonTemporaryEvents(jobs.peds[1], 1)
  590.                                     TaskStandStill(jobs.peds[1], 1000*jobs.flag[2])
  591.                                     DrawMissionText("Le ~g~client~w~ attend. Rejoins le", 5000)
  592.                                     local lblip = AddBlipForEntity(jobs.peds[1])
  593.                                     SetBlipAsFriendly(lblip, 1)
  594.                                     SetBlipColour(lblip, 2)
  595.                                     SetBlipCategory(lblip, 3)
  596.                                 else
  597.                                     jobs.flag[1] = 0
  598.                                     jobs.flag[2] = 59+GetRandomIntInRange(1, 90)
  599.                                     DrawMissionText("Vas chercher des ~h~~y~clients~w~.", 10000)
  600.                                 end
  601.                             end
  602.                         end
  603.                     end
  604.                 else
  605.                     if GetDistanceBetweenCoords(GetEntityCoords(GetPlayerPed(-1)), GetEntityCoords(jobs.cars[1]), true) > 10.0001 then
  606.                         StopJob(1)
  607.                     else
  608.                         DrawMissionText("Retournes dans ta caisse ~y~tout de suite~w~. Ou laisses ta caisse au depot pour  ~r~finir~ ta journee.", 1)
  609.                     end
  610.                 end
  611.             else
  612.                 StopJob(1)
  613.                 DrawMissionText("Le taxi est ~h~~r~detruit~w~.", 5000)
  614.             end
  615.         end
  616.     end
  617. end)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement