Advertisement
Guest User

Untitled

a guest
Nov 20th, 2019
1,486
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 4.38 KB | None | 0 0
  1. local boats = {}
  2.  
  3. boats['boat'] = {
  4. price = 2500,
  5. class = 'dinghy4'
  6. }
  7.  
  8. boats['boat2'] = {
  9. price = 5500,
  10. class = 'TORO'
  11. }
  12.  
  13. boats['boat3'] = {
  14. price = 6000,
  15. class = 'MARQUIS'
  16. }
  17.  
  18. boats['boat4'] = {
  19. price = 7500,
  20. class = 'tug'
  21. }
  22.  
  23. boats['boat5'] = {
  24. price = 4500,
  25. class = 'jetmax'
  26. }
  27.  
  28. boats['boat6'] = {
  29. price = 3500,
  30. class = 'suntrap'
  31. }
  32.  
  33. boats['police'] = {
  34. price = 0,
  35. class = 'predator'
  36. }
  37.  
  38. function OpenBoatsMenu(x, y , z)
  39. local ped = PlayerPedId()
  40. PlayerData = ESX.GetPlayerData()
  41. local elements = {}
  42.  
  43.  
  44. table.insert(elements, {label = '<span style="color:green;">Dinghy</span> <span style="color:red;">2500$</span>', value = 'boat'})
  45. table.insert(elements, {label = '<span style="color:green;">Suntrap</span> <span style="color:red;">3500$</span>', value = 'boat6'})
  46. table.insert(elements, {label = '<span style="color:green;">Jetmax</span> <span style="color:red;">4500$</span>', value = 'boat5'})
  47. table.insert(elements, {label = '<span style="color:green;">Toro</span> <span style="color:red;">5500$</span>', value = 'boat2'})
  48. table.insert(elements, {label = '<span style="color:green;">Marquis</span> <span style="color:red;">6000$</span>', value = 'boat3'})
  49. table.insert(elements, {label = '<span style="color:green;">Tug boat</span> <span style="color:red;">7500$</span>', value = 'boat4'})
  50.  
  51. --If user has police job they will be able to get free Police Predator boat
  52. if PlayerData.job.name == "police" then
  53. table.insert(elements, {label = '<span style="color:green;">Police Predator</span>', value = 'police'})
  54. end
  55.  
  56. ESX.UI.Menu.CloseAll()
  57.  
  58. ESX.UI.Menu.Open(
  59. 'default', GetCurrentResourceName(), 'client',
  60. {
  61. title = 'Rent a boat',
  62. align = 'bottom-right',
  63. elements = elements,
  64. },
  65.  
  66.  
  67. function(data, menu)
  68. -- ORIGINAL BULLSHIT
  69. --[[
  70.  
  71. if data.current.value == 'boat' then
  72. ESX.UI.Menu.CloseAll()
  73.  
  74. TriggerServerEvent("fishing:lowmoney", 2500)
  75. TriggerEvent("chatMessage", 'You rented a boat for', {255,0,255}, '$' .. 2500)
  76. SetPedCoordsKeepVehicle(ped, x, y , z)
  77. TriggerEvent('esx:spawnVehicle', "dinghy4")
  78. end
  79.  
  80. if data.current.value == 'boat2' then
  81. ESX.UI.Menu.CloseAll()
  82.  
  83. TriggerServerEvent("fishing:lowmoney", 5500)
  84. TriggerEvent("chatMessage", 'You rented a boat for', {255,0,255}, '$' .. 5500)
  85. SetPedCoordsKeepVehicle(ped, x, y , z)
  86. TriggerEvent('esx:spawnVehicle', "TORO")
  87. end
  88.  
  89. if data.current.value == 'boat3' then
  90. ESX.UI.Menu.CloseAll()
  91.  
  92. TriggerServerEvent("fishing:lowmoney", 6000)
  93. TriggerEvent("chatMessage", 'You rented a boat for', {255,0,255}, '$' .. 6000)
  94. SetPedCoordsKeepVehicle(ped, x, y , z)
  95. TriggerEvent('esx:spawnVehicle', "MARQUIS")
  96. end
  97.  
  98. if data.current.value == 'boat4' then
  99. ESX.UI.Menu.CloseAll()
  100.  
  101. TriggerServerEvent("fishing:lowmoney", 7500)
  102. TriggerEvent("chatMessage", 'You rented a boat for', {255,0,255}, '$' .. 7500)
  103. SetPedCoordsKeepVehicle(ped, x, y , z)
  104. TriggerEvent('esx:spawnVehicle', "tug")
  105. end
  106.  
  107. if data.current.value == 'boat5' then
  108. ESX.UI.Menu.CloseAll()
  109.  
  110. TriggerServerEvent("fishing:lowmoney", 4500)
  111. TriggerEvent("chatMessage", 'You rented a boat for', {255,0,255}, '$' .. 4500)
  112. SetPedCoordsKeepVehicle(ped, x, y , z)
  113. TriggerEvent('esx:spawnVehicle', "jetmax")
  114. end
  115.  
  116. if data.current.value == 'boat6' then
  117. ESX.UI.Menu.CloseAll()
  118.  
  119. TriggerServerEvent("fishing:lowmoney", 3500)
  120. TriggerEvent("chatMessage", 'You rented a boat for', {255,0,255}, '$' .. 3500)
  121. SetPedCoordsKeepVehicle(ped, x, y , z)
  122. TriggerEvent('esx:spawnVehicle', "suntrap")
  123. end
  124.  
  125.  
  126. if data.current.value == 'police' then
  127. ESX.UI.Menu.CloseAll()
  128.  
  129. TriggerEvent("chatMessage", 'You took out a boat')
  130. SetPedCoordsKeepVehicle(ped, x, y , z)
  131. TriggerEvent('esx:spawnVehicle', "predator")
  132. end
  133. ]]--
  134. -- CLEANER SHIT
  135. if boats[data.current.value] then
  136. local data = boats[data.current.value]
  137.  
  138. if data.price > 0 then
  139. TriggerServerEvent("fishing:lowmoney", data.price)
  140. end
  141.  
  142. TriggerEvent("chatMessage", data.price > 0 and ('You rented a boat for', {255,0,255}, '$' .. 3500) or "You took out a boat")
  143. SetPedCoordsKeepVehicle(ped, x, y , z)
  144. TriggerEvent('esx:spawnVehicle', data.class)
  145. end
  146.  
  147. ESX.UI.Menu.CloseAll()
  148.  
  149.  
  150. end,
  151. function(data, menu)
  152. menu.close()
  153. end
  154. )
  155. end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement