Advertisement
Guest User

Untitled

a guest
May 20th, 2018
168
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 3.75 KB | None | 0 0
  1. local holdingup = false
  2. local bank = ""
  3. local secondsRemaining = 0
  4. local blipRobbery = nil
  5. ESX = nil
  6.  
  7. Citizen.CreateThread(function()
  8. while ESX == nil do
  9. TriggerEvent('esx:getSharedObject', function(obj) ESX = obj end)
  10. Citizen.Wait(0)
  11. end
  12. end)
  13.  
  14. function DisplayHelpText(str)
  15. SetTextComponentFormat("STRING")
  16. AddTextComponentString(str)
  17. DisplayHelpTextFromStringLabel(0, 0, 1, -1)
  18. end
  19.  
  20. function drawTxt(x,y ,width,height,scale, text, r,g,b,a, outline)
  21. SetTextFont(0)
  22. SetTextProportional(0)
  23. SetTextScale(scale, scale)
  24. SetTextColour(r, g, b, a)
  25. SetTextDropShadow(0, 0, 0, 0,255)
  26. SetTextEdge(1, 0, 0, 0, 255)
  27. SetTextDropShadow()
  28. if(outline)then
  29. SetTextOutline()
  30. end
  31. SetTextEntry("STRING")
  32. AddTextComponentString(text)
  33. DrawText(x - width/2, y - height/2 + 0.005)
  34. end
  35.  
  36. RegisterNetEvent('esx_holdupatm:currentlyrobbing')
  37. AddEventHandler('esx_holdupatm:currentlyrobbing', function(robb)
  38. holdingup = true
  39. bank = robb
  40. secondsRemaining = 80
  41. end)
  42.  
  43. RegisterNetEvent('esx_holdupatm:killblip')
  44. AddEventHandler('esx_holdupatm:killblip', function()
  45. RemoveBlip(blipRobbery)
  46. end)
  47.  
  48. RegisterNetEvent('esx_holdupatm:setblip')
  49. AddEventHandler('esx_holdupatm:setblip', function(position)
  50. blipRobbery = AddBlipForCoord(position.x, position.y, position.z)
  51. SetBlipSprite(blipRobbery , 161)
  52. SetBlipScale(blipRobbery , 2.0)
  53. SetBlipColour(blipRobbery, 3)
  54. PulseBlip(blipRobbery)
  55. end)
  56.  
  57. RegisterNetEvent('esx_holdupatm:toofarlocal')
  58. AddEventHandler('esx_holdupatm:toofarlocal', function(robb)
  59. holdingup = false
  60. ESX.ShowNotification(_U('robbery_cancelled'))
  61. robbingName = ""
  62. secondsRemaining = 0
  63. incircle = false
  64. end)
  65.  
  66.  
  67. RegisterNetEvent('esx_holdupatm:robberycomplete')
  68. AddEventHandler('esx_holdupatm:robberycomplete', function(robb)
  69. holdingup = false
  70. ESX.ShowNotification(_U('robbery_complete') .. Banks[bank].reward)
  71. bank = ""
  72. secondsRemaining = 0
  73. incircle = false
  74. end)
  75.  
  76. Citizen.CreateThread(function()
  77. while true do
  78. Citizen.Wait(0)
  79. if holdingup then
  80. Citizen.Wait(1000)
  81. if(secondsRemaining > 0)then
  82. secondsRemaining = secondsRemaining - 1
  83. end
  84. end
  85. end
  86. end)
  87.  
  88. Citizen.CreateThread(function()
  89. for k,v in pairs(Banks)do
  90. local ve = v.position
  91.  
  92. local blip = AddBlipForCoord(ve.x, ve.y, ve.z)
  93. SetBlipSprite(blip, 255)--156
  94. SetBlipScale(blip, 0.8)
  95. SetBlipColour(blip, 75)
  96. SetBlipAsShortRange(blip, true)
  97. BeginTextCommandSetBlipName("STRING")
  98. AddTextComponentString(_U('atm_robbery'))
  99. EndTextCommandSetBlipName(blip)
  100. end
  101. end)
  102. incircle = false
  103.  
  104. Citizen.CreateThread(function()
  105. while true do
  106. local pos = GetEntityCoords(GetPlayerPed(-1), true)
  107.  
  108. for k,v in pairs(Banks)do
  109. local pos2 = v.position
  110.  
  111. if(Vdist(pos.x, pos.y, pos.z, pos2.x, pos2.y, pos2.z) < 15.0)then
  112. if not holdingup then
  113. 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)
  114.  
  115. if(Vdist(pos.x, pos.y, pos.z, pos2.x, pos2.y, pos2.z) < 1.0)then
  116. if (incircle == false) then
  117. DisplayHelpText(_U('press_to_rob') .. v.nameofbank)
  118. end
  119. incircle = true
  120. if IsControlJustReleased(1, 51) then
  121. TriggerServerEvent('esx_holdupatm:rob', k)
  122. end
  123. elseif(Vdist(pos.x, pos.y, pos.z, pos2.x, pos2.y, pos2.z) > 1.0)then
  124. incircle = false
  125. end
  126. end
  127. end
  128. end
  129.  
  130. if holdingup then
  131.  
  132. drawTxt(0.66, 1.44, 1.0,1.0,0.4, _U('robbery_of') .. secondsRemaining .. _U('seconds_remaining'), 255, 255, 255, 255)
  133.  
  134. local pos2 = Banks[bank].position
  135.  
  136. if(Vdist(pos.x, pos.y, pos.z, pos2.x, pos2.y, pos2.z) > 7.5)then
  137. TriggerServerEvent('esx_holdupatm:toofar', bank)
  138. end
  139. end
  140.  
  141. Citizen.Wait(0)
  142. end
  143. end)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement