Advertisement
Guest User

Untitled

a guest
Jun 9th, 2017
155
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 14.27 KB | None | 0 0
  1.  
  2. local bin_locations = {
  3. {enteringbin = {-322.247,-1545.958,30.01993}, innutile2 = {-322.247,-1545.958,30.01993}, outsidebin= {-326.9868,-1521.877,27.53701}},
  4. }
  5.  
  6. local bin_blips ={}
  7. local inrangeofbin= false
  8. local inrangeofbin3 = false
  9. local currentlocation = nil
  10. local boughtcar = false
  11. local distance = 0
  12.  
  13. local function LocalPed()
  14. return GetPlayerPed(-1)
  15. end
  16.  
  17. function drawTxtbin(text,font,centre,x,y,scale,r,g,b,a)
  18. SetTextFont(font)
  19. SetTextProportional(0)
  20. SetTextScale(scale, scale)
  21. SetTextColour(r, g, b, a)
  22. SetTextDropShadow(0, 0, 0, 0,255)
  23. SetTextEdge(1, 0, 0, 0, 255)
  24. SetTextDropShadow()
  25. SetTextOutline()
  26. SetTextCentre(centre)
  27. SetTextEntry("STRING")
  28. AddTextComponentString(text)
  29. DrawText(x , y)
  30. end
  31.  
  32. function IsPlayerinrangeofbin()
  33. return inrangeofbin
  34. end
  35.  
  36. function IsPlayerinrangeofbin3()
  37. return inrangeofbin3
  38. end
  39.  
  40. function ShowbinBlips(bool)
  41. if bool and #bin_blips == 0 then
  42. for station,pos in pairs(bin_locations) do
  43. local loc = pos
  44. pos = pos.outsidebin
  45. local blip = AddBlipForCoord(pos[1],pos[2],pos[3])
  46. -- 60 58 137
  47. SetBlipSprite(blip,318)
  48. SetBlipColour(blip, 2)
  49. BeginTextCommandSetBlipName("STRING")
  50. AddTextComponentString('Décharge')
  51. EndTextCommandSetBlipName(blip)
  52. SetBlipAsShortRange(blip,true)
  53. SetBlipAsMissionCreatorBlip(blip,true)
  54. table.insert(bin_blips, {blip = blip, pos = loc})
  55. end
  56. Citizen.CreateThread(function()
  57. while #bin_blips > 0 do
  58. Citizen.Wait(0)
  59. local inrange = false
  60. local inrange3 = false
  61. for i,b in ipairs(bin_blips) do
  62. if IsPedInAnyVehicle(LocalPed(), true) == false and GetDistanceBetweenCoords(b.pos.enteringbin[1],b.pos.enteringbin[2],b.pos.enteringbin[3],GetEntityCoords(LocalPed()),true) > 0 then
  63. DrawMarker(0,-315.74,-1531.069,27.09734,0,0,0,0,0,0,2.001,2.0001,0.5001,0,155,255,200,0,0,0,0)
  64. currentlocation = b
  65. if GetDistanceBetweenCoords(-315.74,-1531.069,27.09734,GetEntityCoords(LocalPed()),true) < 3 then
  66. ShowInfoJobBin("Appuyez sur ~INPUT_CONTEXT~ pour sortir votre ~b~Camion~w~.", 0)
  67. inrange3 = true
  68. end
  69. end
  70. end
  71. inrangeofbin = inrange
  72. inrangeofbin3 = inrange3
  73. end
  74. end)
  75. elseif bool == false and #bin_blips > 0 then
  76. for i,b in ipairs(bin_blips) do
  77. if DoesBlipExist(b.blip) then
  78. SetBlipAsMissionCreatorBlip(b.blip,false)
  79. Citizen.InvokeNative(0x86A652570E5F25DD, Citizen.PointerValueIntInitialized(b.blip))
  80. end
  81. end
  82. bin_blips = {}
  83. end
  84. end
  85.  
  86. RegisterNetEvent("job:f_GetIdentifier")
  87. AddEventHandler("job:f_GetIdentifier", function(plate)
  88. job.plate = plate
  89. end)
  90.  
  91. local ShowMsgtime = { msg = "", time = 0 }
  92. local myjob = 0
  93.  
  94. RegisterNetEvent("mine:getJobs")
  95. AddEventHandler("mine:getJobs", function(job)
  96. myjob = job
  97. end)
  98.  
  99. Citizen.CreateThread(function()
  100. while true do
  101. Citizen.Wait(0)
  102. if ShowMsgtime.time ~= 0 then
  103. drawTxtbin(ShowMsgtime.msg, 0, 1, 0.5, 0.8, 0.6, 255, 255, 255, 255)
  104. ShowMsgtime.time = ShowMsgtime.time - 1
  105. end
  106. end
  107. end)
  108.  
  109. Citizen.CreateThread(function()
  110. while true do
  111. Citizen.Wait(0)
  112. if IsControlJustPressed(1,38) and inrangeofbin3 then
  113. TriggerServerEvent("poleemploi:getjobs")
  114. Wait(100)
  115. if myjob == 3 then
  116. SetPedComponentVariation(GetPlayerPed(-1), 11, 56, 0, 0)
  117. SetPedComponentVariation(GetPlayerPed(-1), 8, 59, 0, 0)
  118. SetPedComponentVariation(GetPlayerPed(-1), 3, 99, 0, 0)
  119. SetPedComponentVariation(GetPlayerPed(-1), 4, 36, 0, 0)
  120. SetPedComponentVariation(GetPlayerPed(-1), 6, 12, 6, 0)
  121. --TriggerServerEvent('CheckPoolVehi')
  122. --TriggerServerEvent('SetPlateJob')
  123. --local car = 0xC703DB5F
  124. Wait(100)
  125. local car = GetHashKey("trash")
  126. -- VOITURE PAR DÉFAUT
  127. local cplate = job.plate
  128. Citizen.CreateThread(function()
  129. Citizen.Wait(10)
  130. RequestModel(car)
  131. while not HasModelLoaded(car) do
  132. Citizen.Wait(0)
  133. end
  134. veh = CreateVehicle(car, -324.254, -1530.044, 27.54, 0.0, true, false)
  135. SetEntityVelocity(veh, 2000)
  136. SetVehicleNumberPlateText(veh, cplate)
  137. SetVehicleOnGroundProperly(veh)
  138. SetVehicleHasBeenOwnedByPlayer(veh,true)
  139. local id = NetworkGetNetworkIdFromEntity(veh)
  140. SetNetworkIdCanMigrate(id, true)
  141. SetVehRadioStation(veh, "OFF")
  142. SetVehicleColours(veh,64,64)
  143. SetPedIntoVehicle(GetPlayerPed(-1), veh, -1)
  144. DrawNotif("Véhicule sorti, bonne route")
  145. end)
  146. clientjobID = 46 -- Piscine
  147. inrangeofbin3 = false
  148. inrange3 = false
  149. else
  150. ShowMsgtime.msg = '~r~ Vous devez être éboueur !'
  151. ShowMsgtime.time = 150
  152. end
  153. end
  154. end
  155. end)
  156.  
  157. onJobBin = 0
  158.  
  159. bin = {flag = {}, blip = {}, veh = {}, coords = {cx={}, cy={}, cz={}}}
  160.  
  161. function StartJobBin()
  162. showLoadingPromtbin("Chargement du métier.", 2000, 3)
  163. bin.coords.cx[1],bin.coords.cy[1],bin.coords.cz[1] = -337.6367,-2786.992,4.000239
  164. bin.coords.cx[2],bin.coords.cy[2],bin.coords.cz[2] = 1050.857,-2391.396,29.28452
  165. bin.coords.cx[3],bin.coords.cy[3],bin.coords.cz[3] = 1005.835,-2067.349,30.13629
  166. bin.coords.cx[4],bin.coords.cy[4],bin.coords.cz[4] = 957.2108,-1912.296,30.14571
  167. bin.coords.cx[5],bin.coords.cy[5],bin.coords.cz[5] = 770.9854,-1902.144,28.26986
  168. bin.coords.cx[6],bin.coords.cy[6],bin.coords.cz[6] = 969.3815,-945.3486,41.29815
  169. bin.coords.cx[7],bin.coords.cy[7],bin.coords.cz[7] = 776.6561,-1054.236,26.05088
  170. bin.coords.cx[8],bin.coords.cy[8],bin.coords.cz[8] = 787.1,-1323.691,25.06788
  171. bin.coords.cx[9],bin.coords.cy[9],bin.coords.cz[9] = 1089.071,-449.5304,64.72475
  172. bin.coords.cx[10],bin.coords.cy[10],bin.coords.cz[10] = 617.2553,70.19471,89.7544
  173. bin.coords.cx[11],bin.coords.cy[11],bin.coords.cz[11] = 560.3558,171.2989,99.2312
  174. bin.coords.cx[12],bin.coords.cy[12],bin.coords.cz[12] = 384.0609,238.476,102.0361
  175. bin.coords.cx[13],bin.coords.cy[13],bin.coords.cz[13] = 10.20545,4.926725,69.6499
  176. bin.coords.cx[14],bin.coords.cy[14],bin.coords.cz[14] = 197.3791,-1092.112,28.2783
  177. bin.coords.cx[15],bin.coords.cy[15],bin.coords.cz[15] = 199.9383,-1296.267,28.32153
  178. bin.coords.cx[16],bin.coords.cy[16],bin.coords.cz[16] = 272.633,-1499.289,28.2916
  179. bin.coords.cx[17],bin.coords.cy[17],bin.coords.cz[17] = 263.7913,-1677.058,28.30527
  180. bin.coords.cx[18],bin.coords.cy[18],bin.coords.cz[18] = 224.064,-1836.624,25.95535
  181. bin.coords.cx[19],bin.coords.cy[19],bin.coords.cz[19] = 161.0778,-1876.63,22.9732
  182. bin.coords.cx[20],bin.coords.cy[20],bin.coords.cz[20] = 41.75639,-1879.637,21.21154
  183. bin.coords.cx[21],bin.coords.cy[21],bin.coords.cz[21] = -28.13282,-1640.856,28.29198
  184. bin.coords.cx[22],bin.coords.cy[22],bin.coords.cz[22] = -171.739,-1459.672,30.68687
  185. bin.coords.cx[23],bin.coords.cy[23],bin.coords.cz[23] = -717.054,-1171.374,9.46338
  186. bin.coords.cx[24],bin.coords.cy[24],bin.coords.cz[24] = -1075.155,-1273.394,4.829365
  187. bin.coords.cx[25],bin.coords.cy[25],bin.coords.cz[25] = -1076.804,-1498.936,4.104791
  188. bin.coords.cx[26],bin.coords.cy[26],bin.coords.cz[26] = -1054.713,-1610.139,3.399037
  189. bin.coords.cx[27],bin.coords.cy[27],bin.coords.cz[27] = -1264.468,-1374.695,3.17067
  190. bin.coords.cx[28],bin.coords.cy[28],bin.coords.cz[28] = -1277.544,-1210.355,3.724486
  191. bin.coords.cx[29],bin.coords.cy[29],bin.coords.cz[29] = -1071.163,-1029.759,1.091357
  192. bin.coords.cx[30],bin.coords.cy[30],bin.coords.cz[30] = -1018.297,-1119.402,1.120266
  193. bin.coords.cx[31],bin.coords.cy[31],bin.coords.cz[31] = -1622.477,-1081.264,12.01845
  194. bin.coords.cx[32],bin.coords.cy[32],bin.coords.cz[32] = -1801.939,-410.1487,43.5813
  195. bin.coords.cx[33],bin.coords.cy[33],bin.coords.cz[33] = -1753.204,-377.5302,44.74607
  196. bin.coords.cx[34],bin.coords.cy[34],bin.coords.cz[34] = -964.1352,-185.0301,36.80095
  197. bin.coords.cx[35],bin.coords.cy[35],bin.coords.cz[35] = -1481.334,59.09226,52.53588
  198. bin.coords.cx[36],bin.coords.cy[36],bin.coords.cz[36] = -1629.261,77.69003,60.94693
  199. bin.coords.cx[37],bin.coords.cy[37],bin.coords.cz[37] = -1892.951,185.2168,81.59013
  200. bin.coords.cx[38],bin.coords.cy[38],bin.coords.cz[38] = -1466.232,518.6081,116.9691
  201. bin.coords.cx[39],bin.coords.cy[39],bin.coords.cz[39] = -1298.72,627.9941,136.7925
  202. bin.coords.cx[40],bin.coords.cy[40],bin.coords.cz[40] = -1256.728,653.576,139.9319
  203. bin.coords.cx[41],bin.coords.cy[41],bin.coords.cz[41] = -1177.898,722.7534,150.6435
  204. bin.coords.cx[42],bin.coords.cy[42],bin.coords.cz[42] = -1111.839,775.9818,161.6958
  205. bin.coords.cx[43],bin.coords.cy[43],bin.coords.cz[43] = -979.8621,694.6163,155.8505
  206. bin.coords.cx[44],bin.coords.cy[44],bin.coords.cz[44] = -680.5673,605.562,142.9354
  207. bin.coords.cx[45],bin.coords.cy[45],bin.coords.cz[45] = -619.3099,682.4254,148.8345
  208. bin.coords.cx[46],bin.coords.cy[46],bin.coords.cz[46] = -509.0829,575.6403,118.847
  209. bin.coords.cx[47],bin.coords.cy[47],bin.coords.cz[47] = -345.6455,429.374,109.4156
  210. bin.coords.cx[48],bin.coords.cy[48],bin.coords.cz[48] = -194.7099,419.3295,108.9558
  211. bin.coords.cx[49],bin.coords.cy[49],bin.coords.cz[49] = -215.4222,276.3777,91.04716
  212. bin.coords.cx[50],bin.coords.cy[50],bin.coords.cz[50] = -468.5767,272.7403,82.26152
  213. bin.coords.cx[51],bin.coords.cy[51],bin.coords.cz[51] = -343.4309,103.5678,65.67259
  214. bin.coords.cx[52],bin.coords.cy[52],bin.coords.cz[52] = -287.9857,-95.30598,46.21479
  215. bin.coords.cx[53],bin.coords.cy[53],bin.coords.cz[53] = -359.5632,-145.9291,37.24692
  216. bin.coords.cx[54],bin.coords.cy[54],bin.coords.cz[54] = -147.5077,-747.1575,32.89324
  217. bin.coords.cx[55],bin.coords.cy[55],bin.coords.cz[55] = -246.4445,-1128.171,22.06822
  218. bin.coords.cx[56],bin.coords.cy[56],bin.coords.cz[56] = -294.119,-1357.757,30.31021
  219. bin.coords.cx[57],bin.coords.cy[57],bin.coords.cz[57] = -894.062,-2750.131,12.94431
  220. bin.coords.cx[58],bin.coords.cy[58],bin.coords.cz[58] = -1052.065,-2086.243,12.34221
  221. bin.coords.cx[59],bin.coords.cy[59],bin.coords.cz[59] = -1148.458,-1987.686,12.16035
  222. bin.coords.cx[60],bin.coords.cy[60],bin.coords.cz[60] = -589.994,-1737.421,21.75804
  223. bin.coords.cx[61],bin.coords.cy[61],bin.coords.cz[61] = -240.9282,-1473.415,30.4771
  224. bin.coords.cx[62],bin.coords.cy[62],bin.coords.cz[62] = -171.5853,-1461.888,30.79383
  225. bin.veh[1] = GetVehiclePedIsUsing(GetPlayerPed(-1))
  226. bin.flag[1] = 1
  227. bin.flag[2] = GetRandomIntInRange(1, 62)
  228. Wait(2000)
  229. DrawMissionTextbin("Conduisez et allez ramasser les ~h~~y~poubelles~w~.", 10000)
  230. onJobBin = 1
  231. end
  232.  
  233. function DrawMissionTextbin(m_text, showtime)
  234. ClearPrints()
  235. SetTextEntry_2("STRING")
  236. AddTextComponentString(m_text)
  237. DrawSubtitleTimed(showtime, 1)
  238. end
  239.  
  240. function showLoadingPromtbin(showText, showTime, showType)
  241. Citizen.CreateThread(function()
  242. Citizen.Wait(0)
  243. N_0xaba17d7ce615adbf("STRING") -- set type
  244. AddTextComponentString(showText) -- sets the text
  245. N_0xbd12f8228410d9b4(showType) -- show promt (types = 3)
  246. Citizen.Wait(showTime) -- show time
  247. N_0x10d373323e5b9c0d() -- remove promt
  248. end)
  249. end
  250.  
  251. function DrawNotif(text)
  252. SetNotificationTextEntry("STRING")
  253. AddTextComponentString(text)
  254. DrawNotification(false, false)
  255. end
  256.  
  257. function ShowInfoJobBin(text, state)
  258. SetTextComponentFormat("STRING")
  259. AddTextComponentString(text)
  260. DisplayHelpTextFromStringLabel(0, state, 0, -1)
  261. end
  262.  
  263. function StopJobBin()
  264. if bin.blip[1] ~= nil and DoesBlipExist(bin.blip[1]) then
  265. Citizen.InvokeNative(0x86A652570E5F25DD,Citizen.PointerValueIntInitialized(bin.blip[1]))
  266. bin.blip[1] = nil
  267. end
  268. onJobBin = 0
  269. clientjobID = 0
  270. bin.veh[1] = nil
  271. bin.flag[1] = nil
  272. bin.flag[2] = nil
  273. end
  274.  
  275. Citizen.CreateThread(function()
  276. while true do
  277. Wait(0)
  278. if onJobBin == 0 then
  279. if (clientjobID == 46) then -- JOB pool
  280. if IsPedSittingInAnyVehicle(GetPlayerPed(-1)) then
  281. if IsVehicleModel(GetVehiclePedIsUsing(GetPlayerPed(-1)), GetHashKey("trash", _r)) then
  282. TriggerServerEvent("poleemploi:getjobs")
  283. Wait(100)
  284. if myjob == 3 then
  285. StartJobBin(1)
  286. else
  287. ShowMsgtime.msg = '~r~ Vous devez être éboueur !'
  288. ShowMsgtime.time = 150
  289. end
  290. end
  291. end
  292. end
  293. elseif onJobBin == 1 then
  294. if DoesEntityExist(bin.veh[1]) and IsVehicleDriveable(bin.veh[1], 0) then
  295.  
  296. if bin.flag[1] == 1 then
  297. bin.flag[2] = GetRandomIntInRange(1, 62)
  298. bin.blip[1] = AddBlipForCoord(bin.coords.cx[bin.flag[2]],bin.coords.cy[bin.flag[2]],bin.coords.cz[bin.flag[2]])
  299. N_0x80ead8e2e1d5d52e(bin.blip[1])
  300. SetBlipRoute(bin.blip[1], 1)
  301. distance = GetDistanceBetweenCoords(GetEntityCoords(GetPlayerPed(-1)), bin.coords.cx[bin.flag[2]],bin.coords.cy[bin.flag[2]],bin.coords.cz[bin.flag[2]], true)
  302. bin.flag[1] = 2
  303. end
  304. if bin.flag[1] == 2 then
  305. if GetDistanceBetweenCoords(GetEntityCoords(GetPlayerPed(-1)), bin.coords.cx[bin.flag[2]],bin.coords.cy[bin.flag[2]],bin.coords.cz[bin.flag[2]], true) > 2.0001 then
  306. DrawMarker(1, bin.coords.cx[bin.flag[2]],bin.coords.cy[bin.flag[2]],bin.coords.cz[bin.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)
  307. else
  308. if bin.blip[1] ~= nil and DoesBlipExist(bin.blip[1]) then
  309. Citizen.InvokeNative(0x86A652570E5F25DD,Citizen.PointerValueIntInitialized(bin.blip[1]))
  310. bin.blip[1] = nil
  311. end
  312. if IsPedInAnyVehicle(LocalPed(), true) == false then
  313. ShowInfoJobBin("Appuyez sur ~INPUT_CONTEXT~ pour ~b~ramasser~w~ la poubelle.", 0)
  314. if IsControlJustPressed(1,38) then
  315. local dict = "pickup_object"
  316. local anim = "pickup_low"
  317. RequestAnimDict(dict)
  318.  
  319. while not HasAnimDictLoaded(dict) do
  320. Citizen.Wait(0)
  321. end
  322.  
  323. local myPed = PlayerPedId()
  324. local animation = anim
  325. local flags = 16 -- only play the animation on the upper body
  326.  
  327. TaskPlayAnim(myPed, dict, animation, 8.0, -8, -1, flags, 0, 0, 0, 0)
  328. Wait(2000)
  329. DrawMissionTextbin("~h~Vous avez ~g~ramassé~w~ une poubelle !", 5000)
  330. TriggerServerEvent('job:success', distance)
  331. --TriggerServerEvent('CheckPool')
  332. Wait(2000)
  333. bin.flag[1] = 1
  334. bin.flag[2] = GetRandomIntInRange(1, 62)
  335. end
  336. end
  337. end
  338. end
  339.  
  340. if GetDistanceBetweenCoords(GetEntityCoords(GetPlayerPed(-1)), GetEntityCoords(bin.veh[1]), true) > 350.0001 then
  341. StopJobBin(1)
  342. DrawNotif("~r~Retournez dans votre véhicule pour reprendre votre travail")
  343. else
  344.  
  345. end
  346.  
  347. else
  348. StopJobBin(1)
  349. DrawMissionTextbin("Votre camion est ~h~~r~hors-service~w~.", 5000)
  350. end
  351. end
  352. end
  353. end)
  354.  
  355.  
  356. AddEventHandler('playerSpawned', function(spawn)
  357. ShowbinBlips(true)
  358. end)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement