Advertisement
Guest User

Untitled

a guest
Dec 14th, 2018
69
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 4.69 KB | None | 0 0
  1. vRP = Proxy.getInterface("vRP")
  2.  
  3. local holdingup = false
  4. local store = ""
  5. local secondsRemaining = 0
  6.  
  7. function holdup_DisplayHelpText(str)
  8. SetTextComponentFormat("STRING")
  9. AddTextComponentString(str)
  10. DisplayHelpTextFromStringLabel(0, 0, 1, -1)
  11. end
  12.  
  13. function holdup_drawTxt(x,y ,width,height,scale, text, r,g,b,a, outline)
  14. SetTextFont(0)
  15. SetTextProportional(0)
  16. SetTextScale(scale, scale)
  17. SetTextColour(r, g, b, a)
  18. SetTextDropShadow(0, 0, 0, 0,255)
  19. SetTextEdge(1, 0, 0, 0, 255)
  20. SetTextDropShadow()
  21. if(outline)then
  22. SetTextOutline()
  23. end
  24. SetTextEntry("STRING")
  25. AddTextComponentString(text)
  26. DrawText(x - width/2, y - height/2 + 0.005)
  27. end
  28.  
  29. local stores = {}
  30.  
  31. RegisterNetEvent('es_holdup:initstores')
  32. AddEventHandler('es_holdup:initstores', function(client_stores)
  33. stores = client_stores
  34. end)
  35.  
  36. RegisterNetEvent('es_holdup:currentlyrobbing')
  37. AddEventHandler('es_holdup:currentlyrobbing', function(robb, timeRemaining)
  38. store = robb
  39. secondsRemaining = timeRemaining
  40. holdingup = true
  41. end)
  42.  
  43. RegisterNetEvent('es_holdup:toofarlocal')
  44. AddEventHandler('es_holdup:toofarlocal', function(robb)
  45. holdingup = false
  46. TriggerEvent('chatMessage', 'SYSTEM', {255, 0, 0}, "Le braquage a été annulé, vous ne recevrez rien.")
  47. store = ""
  48. secondsRemaining = 0
  49. incircle = false
  50. end)
  51.  
  52. RegisterNetEvent('es_holdup:playerdiedlocal')
  53. AddEventHandler('es_holdup:playerdiedlocal', function(robb)
  54. holdingup = false
  55. TriggerEvent('chatMessage', 'SYSTEM', {255, 0, 0}, "Le braquage a été annulé, vous êtes mort ...")
  56. store = ""
  57. secondsRemaining = 0
  58. incircle = false
  59. end)
  60.  
  61. RegisterNetEvent('es_holdup:robberycomplete')
  62. AddEventHandler('es_holdup:robberycomplete', function(reward)
  63. holdingup = false
  64. TriggerEvent('chatMessage', 'SYSTEM', {255, 0, 0}, "Braquage terminé vous avez eu : ^2" .. reward)
  65. store = ""
  66. secondsRemaining = 0
  67. incircle = false
  68. end)
  69.  
  70. Citizen.CreateThread(function()
  71. while true do
  72. if holdingup then
  73. Citizen.Wait(1000)
  74. if(secondsRemaining > 0)then
  75. secondsRemaining = secondsRemaining - 1
  76. else
  77. holdingup = false
  78. TriggerServerEvent("es_holdup:robberydone",store)
  79. end
  80. end
  81.  
  82. Citizen.Wait(0)
  83. end
  84. end)
  85.  
  86. Citizen.CreateThread(function()
  87. while true do
  88. local pos = GetEntityCoords(GetPlayerPed(-1), true)
  89. if holdingup then
  90. -- wanted only when holding up
  91. for k,v in pairs(stores)do
  92. local pos2 = v.position
  93.  
  94. if(Vdist(pos.x, pos.y, pos.z, pos2.x, pos2.y, pos2.z) < 15.0)then
  95. if IsPlayerWantedLevelGreater(PlayerId(),0) or ArePlayerFlashingStarsAboutToDrop(PlayerId()) then
  96. local wanted = GetPlayerWantedLevel(PlayerId())
  97. Citizen.Wait(5000)
  98. SetPlayerWantedLevel(PlayerId(), wanted, 0)
  99. SetPlayerWantedLevelNow(PlayerId(), 0)
  100. end
  101. end
  102. end
  103. end
  104. Citizen.Wait(0)
  105. end
  106. end)
  107.  
  108. --[[Citizen.CreateThread(function()
  109. for k,v in pairs(stores)do
  110. local ve = v.position
  111.  
  112. local blip = AddBlipForCoord(ve.x, ve.y, ve.z)
  113. SetBlipSprite(blip, 52)
  114. SetBlipScale(blip, 0.8)
  115. SetBlipAsShortRange(blip, true)
  116. BeginTextCommandSetBlipName("STRING")
  117. AddTextComponentString("Robbable Store")
  118. EndTextCommandSetBlipName(blip)
  119. end
  120. end)]]
  121. incircle = false
  122.  
  123. Citizen.CreateThread(function()
  124. while true do
  125. local pos = GetEntityCoords(GetPlayerPed(-1), true)
  126.  
  127. if holdingup then
  128. SetPlayerWantedLevel(PlayerId(), 5, 0)
  129. SetPlayerWantedLevelNow(PlayerId(), 0)
  130.  
  131. holdup_drawTxt(0.66, 1.44, 1.0,1.0,0.4, "Braquage de magasin : ~r~" .. secondsRemaining .. "~w~ secondes restante", 255, 255, 255, 255)
  132.  
  133. local pos2 = stores[store].position
  134.  
  135. local ped = GetPlayerPed(-1)
  136.  
  137. if vRP.isInComa() then
  138. TriggerServerEvent('es_holdup:playerdied', store)
  139. elseif(Vdist(pos.x, pos.y, pos.z, pos2.x, pos2.y, pos2.z) > 15)then
  140. TriggerServerEvent('es_holdup:toofar', store)
  141. end
  142. else
  143. for k,v in pairs(stores)do
  144. local pos2 = v.position
  145.  
  146. if(Vdist(pos.x, pos.y, pos.z, pos2.x, pos2.y, pos2.z) < 15.0)then
  147. if not holdingup then
  148. DrawMarker(1, v.position.x, v.position.y, v.position.z - 1, 0, 0, 0, 0, 0, 0, 1.0001, 1.0001, 1.5001, 1555, 0, 0,255, 0, 0, 0,0)
  149.  
  150. if(Vdist(pos.x, pos.y, pos.z, pos2.x, pos2.y, pos2.z) < 2.0)then
  151. if (incircle == false) then
  152. holdup_DisplayHelpText("Press ~INPUT_CONTEXT~ pour braqué ~b~" .. v.nameofstore .. "~w~")
  153. end
  154. incircle = true
  155. if(IsControlJustReleased(1, 51))then
  156. TriggerServerEvent('es_holdup:rob', k)
  157. end
  158. elseif(Vdist(pos.x, pos.y, pos.z, pos2.x, pos2.y, pos2.z) > 2.0)then
  159. incircle = false
  160. end
  161. end
  162. end
  163. end
  164. end
  165.  
  166. Citizen.Wait(0)
  167. end
  168. end)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement