Advertisement
Guest User

asdasd

a guest
Oct 21st, 2019
172
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 15.48 KB | None | 0 0
  1. local hudStatus = true
  2. local thirst = 100
  3. local hunger = 100
  4. local health = 100
  5. local armor = 100
  6. local voipLevel = 50
  7. local myStamina = 0
  8. local usingSeatbelt = false
  9. local isTalking = false
  10. local myOxygen = 10.0
  11.  
  12. local hour = 0
  13. local minute = 0
  14.  
  15. DecorRegister('voipRange', 3)
  16. DecorSetInt(GetPlayerPed(-1), 'voipRange', 2)
  17.  
  18. Citizen.CreateThread(function()
  19. while true do
  20. Citizen.Wait(100)
  21. local currentVOIP = DecorGetInt(PlayerPedId(), 'voipRange')
  22. if currentVOIP ~= nil then
  23. if currentVOIP >= 1 then
  24. voipLevel = 33.3*currentVOIP
  25. end
  26. end
  27. end
  28. end)
  29.  
  30. -- Hud Bars
  31. Citizen.CreateThread(function()
  32. while true do
  33. Citizen.Wait(5)
  34. if hudStatus then
  35. curstresslevel = math.ceil(stresslevel / 100)
  36.  
  37. if curstresslevel > 100 then curstresslevel = 100 end
  38. -- Background
  39. DrawRect(0.0853, 0.9800, 0.1430, 0.025, 81, 81, 84, 255)
  40. -- Health
  41. DrawRect(0.0148 + (0.07)/2, 0.9740, 0.07, 0.008595, 188,188,188,80)
  42. if health >= 0 then
  43. DrawRect(0.0148 + (health/1428.52142857)/2, 0.9740, health/1428.52142857, 0.008595, 55,185,55,177)
  44. end
  45. -- Armour
  46.  
  47. DrawRect(0.0865 + (0.069)/2, 0.9740, 0.069, 0.008595, 188,188,188,80)
  48.  
  49. if IsPedSwimmingUnderWater(PlayerPedId()) then
  50. if myOxygen >= 0.0 then
  51. DrawRect(0.0865 + (myOxygen/1449.22536232)/2, 0.9740, myOxygen/1449.22536232, 0.008595, 115,115,255,177)
  52. end
  53. else
  54. DrawRect(0.0865 + (armor/1449.22536232)/2, 0.9740, armor/1449.22536232, 0.008595, 115,115,255,177)
  55. end
  56.  
  57. -- Thrist
  58. --DrawRect(0.0506 + (0.034)/2, 0.9860, 0.034, 0.008595, 188,188,188,80)
  59. DrawRect(0.0506 + (0.034)/2, 0.9860, 0.035, 0.008595, 188,188,188,80)
  60. --DrawRect(0.0506 + (thirst/2898.50072464)/2, 0.9860, thirst/2898.50072464, 0.008595, 75,75,255,177)
  61. DrawRect(0.0506 + (thirst/2898.50072464)/2, 0.9860, thirst/2898.50072464, 0.008595, 75,75,255,177)
  62. -- Hunger
  63. --DrawRect(0.0148 + (0.035)/2, 0.9860, 0.035, 0.008595, 188,188,188,80)
  64. DrawRect(0.0148 + (0.035)/2, 0.9860, 0.035, 0.008595, 188,188,188,80)
  65. --DrawRect(0.0148 + (hunger/2857.09285714)/2, 0.9860, hunger/2857.09285714, 0.008595, 55,185,55,177)
  66. DrawRect(0.0148 + (hunger/2857.09285714)/2, 0.9860, hunger/2857.09285714, 0.008595, 55,185,55,177)
  67.  
  68. -- VOIP
  69. DrawRect(0.0863 + (0.035)/2, 0.9860, 0.035, 0.008595, 188,188,188,80)
  70. DrawRect(0.0863 + (curstresslevel/2857.22536232)/2, 0.9860, curstresslevel/2857.22536232, 0.008595, 200, 5, 5,155)
  71.  
  72. -- Talking
  73. if isTalking then
  74. --DrawRect(0.0863 + (100/2857.22536232)/2, 0.9860, 100/2857.22536232, 0.008595, 255, 55, 155,155)
  75. end
  76.  
  77. DrawRect(0.1218 + (0.034)/2, 0.9860, 0.034, 0.008595, 188,188,188,80)
  78. DrawRect(0.1218 + (myStamina/2857.22536232)/2, 0.9860, myStamina/2857.22536232, 0.008595, 255,255,55,80)
  79. else
  80. Citizen.Wait(500)
  81. end
  82. end
  83. end)
  84.  
  85. Citizen.CreateThread(function()
  86. while true do
  87. Citizen.Wait(100)
  88. hudStatus = true
  89. if hudStatus then
  90. CalculateTimeToDisplay()
  91. health = GetEntityHealth(PlayerPedId())-100
  92. armor = GetPedArmour(PlayerPedId())
  93. isTalking = NetworkIsPlayerTalking(PlayerId())
  94. myStamina = 100-GetPlayerSprintStaminaRemaining(PlayerId())-3
  95. myOxygen = GetPlayerUnderwaterTimeRemaining(PlayerId())*10-3
  96. end
  97. end
  98. end)
  99.  
  100. Citizen.CreateThread(function()
  101. while true do
  102. Citizen.Wait(1000)
  103. TriggerEvent('esx_status:getStatus', 'hunger', function(status)
  104. if status.val >= 1000000 then
  105. hunger = 100
  106. else
  107. hunger = status.val/10000
  108. end
  109. end)
  110.  
  111. TriggerEvent('esx_status:getStatus', 'thirst', function(status)
  112. if status.val >= 1000000 then
  113. thirst = 100
  114. else
  115. thirst = status.val/10000
  116. end
  117. end)
  118. end
  119. end)
  120.  
  121.  
  122.  
  123.  
  124.  
  125. local zoneNames = {
  126. AIRP = "Los Santos International Airport",
  127. ALAMO = "Alamo Sea",
  128. ALTA = "Alta",
  129. ARMYB = "Fort Zancudo",
  130. BANHAMC = "Banham Canyon Dr",
  131. BANNING = "Banning",
  132. BAYTRE = "Baytree Canyon",
  133. BEACH = "Vespucci Beach",
  134. BHAMCA = "Banham Canyon",
  135. BRADP = "Braddock Pass",
  136. BRADT = "Braddock Tunnel",
  137. BURTON = "Burton",
  138. CALAFB = "Calafia Bridge",
  139. CANNY = "Raton Canyon",
  140. CCREAK = "Cassidy Creek",
  141. CHAMH = "Chamberlain Hills",
  142. CHIL = "Vinewood Hills",
  143. CHU = "Chumash",
  144. CMSW = "Chiliad Mountain State Wilderness",
  145. CYPRE = "Cypress Flats",
  146. DAVIS = "Davis",
  147. DELBE = "Del Perro Beach",
  148. DELPE = "Del Perro",
  149. DELSOL = "La Puerta",
  150. DESRT = "Grand Senora Desert",
  151. DOWNT = "Downtown",
  152. DTVINE = "Downtown Vinewood",
  153. EAST_V = "East Vinewood",
  154. EBURO = "El Burro Heights",
  155. ELGORL = "El Gordo Lighthouse",
  156. ELYSIAN = "Elysian Island",
  157. GALFISH = "Galilee",
  158. GALLI = "Galileo Park",
  159. golf = "GWC and Golfing Society",
  160. GRAPES = "Grapeseed",
  161. GREATC = "Great Chaparral",
  162. HARMO = "Harmony",
  163. HAWICK = "Hawick",
  164. HORS = "Vinewood Racetrack",
  165. HUMLAB = "Humane Labs and Research",
  166. JAIL = "Bolingbroke Penitentiary",
  167. KOREAT = "Little Seoul",
  168. LACT = "Land Act Reservoir",
  169. LAGO = "Lago Zancudo",
  170. LDAM = "Land Act Dam",
  171. LEGSQU = "Legion Square",
  172. LMESA = "La Mesa",
  173. LOSPUER = "La Puerta",
  174. MIRR = "Mirror Park",
  175. MORN = "Morningwood",
  176. MOVIE = "Richards Majestic",
  177. MTCHIL = "Mount Chiliad",
  178. MTGORDO = "Mount Gordo",
  179. MTJOSE = "Mount Josiah",
  180. MURRI = "Murrieta Heights",
  181. NCHU = "North Chumash",
  182. NOOSE = "N.O.O.S.E",
  183. OCEANA = "Pacific Ocean",
  184. PALCOV = "Paleto Cove",
  185. PALETO = "Paleto Bay",
  186. PALFOR = "Paleto Forest",
  187. PALHIGH = "Palomino Highlands",
  188. PALMPOW = "Palmer-Taylor Power Station",
  189. PBLUFF = "Pacific Bluffs",
  190. PBOX = "Pillbox Hill",
  191. PROCOB = "Procopio Beach",
  192. RANCHO = "Rancho",
  193. RGLEN = "Richman Glen",
  194. RICHM = "Richman",
  195. ROCKF = "Rockford Hills",
  196. RTRAK = "Redwood Lights Track",
  197. SanAnd = "San Andreas",
  198. SANCHIA = "San Chianski Mountain Range",
  199. SANDY = "Sandy Shores",
  200. SKID = "Mission Row",
  201. SLAB = "Stab City",
  202. STAD = "Maze Bank Arena",
  203. STRAW = "Strawberry",
  204. TATAMO = "Tataviam Mountains",
  205. TERMINA = "Terminal",
  206. TEXTI = "Textile City",
  207. TONGVAH = "Tongva Hills",
  208. TONGVAV = "Tongva Valley",
  209. VCANA = "Vespucci Canals",
  210. VESP = "Vespucci",
  211. VINE = "Vinewood",
  212. WINDF = "Ron Alternates Wind Farm",
  213. WVINE = "West Vinewood",
  214. ZANCUDO = "Zancudo River",
  215. ZP_ORT = "Port of South Los Santos",
  216. ZQ_UAR = "Davis Quartz"
  217. }
  218.  
  219. local showCompass = true
  220. local lastStreet = nil
  221. local lastStreetName = ""
  222. local zone = "Unknown";
  223.  
  224. function getCardinalDirectionFromHeading(heading)
  225. if heading >= 315 or heading < 45 then
  226. return "North Bound"
  227. elseif heading >= 45 and heading < 135 then
  228. return "West Bound"
  229. elseif heading >=135 and heading < 225 then
  230. return "South Bound"
  231. elseif heading >= 225 and heading < 315 then
  232. return "East Bound"
  233. end
  234. end
  235.  
  236. Citizen.CreateThread(function()
  237. local x, y, z = table.unpack(GetEntityCoords(GetPlayerPed(-1), true))
  238. local currentStreetHash, intersectStreetHash = GetStreetNameAtCoord(x, y, z, currentStreetHash, intersectStreetHash)
  239. currentStreetName = GetStreetNameFromHashKey(currentStreetHash)
  240. intersectStreetName = GetStreetNameFromHashKey(intersectStreetHash)
  241. zone = tostring(GetNameOfZone(x, y, z))
  242. playerStreetsLocation = zoneNames[tostring(zone)]
  243.  
  244. if not zone then
  245. zone = "UNKNOWN"
  246. zoneNames['UNKNOWN'] = zone
  247. elseif not zoneNames[tostring(zone)] then
  248. local undefinedZone = zone .. " " .. x .. " " .. y .. " " .. z
  249. zoneNames[tostring(zone)] = "Undefined Zone"
  250. end
  251.  
  252. if intersectStreetName ~= nil and intersectStreetName ~= "" then
  253. playerStreetsLocation = currentStreetName .. " | " .. intersectStreetName .. " | " .. zoneNames[tostring(zone)]
  254. elseif currentStreetName ~= nil and currentStreetName ~= "" then
  255. playerStreetsLocation = currentStreetName .. " | " .. zoneNames[tostring(zone)]
  256. else
  257. playerStreetsLocation = zoneNames[tostring(zone)]
  258. end
  259.  
  260. while true do
  261. Citizen.Wait(2000)
  262.  
  263. local x, y, z = table.unpack(GetEntityCoords(GetPlayerPed(-1), true))
  264. local currentStreetHash, intersectStreetHash = GetStreetNameAtCoord(x, y, z, currentStreetHash, intersectStreetHash)
  265. currentStreetName = GetStreetNameFromHashKey(currentStreetHash)
  266. intersectStreetName = GetStreetNameFromHashKey(intersectStreetHash)
  267. zone = tostring(GetNameOfZone(x, y, z))
  268. playerStreetsLocation = zoneNames[tostring(zone)]
  269.  
  270. if not zone then
  271. zone = "UNKNOWN"
  272. zoneNames['UNKNOWN'] = zone
  273. elseif not zoneNames[tostring(zone)] then
  274. local undefinedZone = zone .. " " .. x .. " " .. y .. " " .. z
  275. zoneNames[tostring(zone)] = "Undefined Zone"
  276. end
  277.  
  278. if intersectStreetName ~= nil and intersectStreetName ~= "" then
  279. playerStreetsLocation = currentStreetName .. " | " .. intersectStreetName .. " | " .. zoneNames[tostring(zone)]
  280. elseif currentStreetName ~= nil and currentStreetName ~= "" then
  281. playerStreetsLocation = currentStreetName .. " | " .. zoneNames[tostring(zone)]
  282. else
  283. playerStreetsLocation = zoneNames[tostring(zone)]
  284. end
  285.  
  286. end
  287. end)
  288.  
  289.  
  290. Citizen.CreateThread(function()
  291.  
  292. while true do
  293. Citizen.Wait(1)
  294. if IsPedInAnyVehicle(PlayerPedId(), false) then
  295.  
  296. local Mph = GetEntitySpeed(GetVehiclePedIsIn(GetPlayerPed(-1), false)) * 2.236936
  297. local fuel = GetVehicleFuelLevel(GetVehiclePedIsIn(GetPlayerPed(-1), false))
  298.  
  299.  
  300. drawTxt(0.667, 1.424, 1.0,1.0,0.55 , "~w~" .. math.ceil(Mph), 255, 255, 255, 200) -- INT: kmh
  301. drawTxt(0.685, 1.432, 1.0,1.0,0.3, "~w~ mp/h", 255, 255, 255, 200) -- TXT: kmh
  302.  
  303. drawTxt(0.714, 1.424, 1.0,1.0,0.55 , "~w~" .. math.ceil(fuel), 255, 255, 255, 200) -- INT: kmh
  304. drawTxt(0.732, 1.432, 1.0,1.0,0.3, "~w~ Fuel", 255, 255, 255, 200) -- TXT: kmh
  305.  
  306. if usingSeatbelt then
  307. DisableControlAction(0, 75)
  308. drawTxt(0.757, 1.429, 1.0,1.0,0.4 , "~g~ BELT", 255, 255, 255, 200) -- INT: kmh
  309. else
  310. drawTxt(0.757, 1.429, 1.0,1.0,0.4, "~r~ BELT", 255, 255, 255, 200) -- TXT: kmh
  311. end
  312.  
  313. drawTxt(0.668, 1.395, 1.0,1.0,0.33 ,"" .. hour .. ":" .. minute, 255, 255, 255, 200)
  314.  
  315. SetTextFont(4)
  316. SetTextProportional(1)
  317. SetTextScale(0.0, 0.43)
  318. SetTextColour(255, 255, 255, 200)
  319. SetTextDropshadow(0, 0, 0, 0, 200)
  320. SetTextEdge(1, 0, 0, 0, 200)
  321. SetTextDropShadow()
  322. SetTextOutline()
  323. SetTextEntry("STRING")
  324.  
  325. if showCompass then
  326. compass = getCardinalDirectionFromHeading(math.floor(GetEntityHeading(GetPlayerPed(-1)) + 0.5))
  327. lastStreetName = compass .. " | " .. playerStreetsLocation
  328. end
  329.  
  330. AddTextComponentString(lastStreetName)
  331. DrawText(0.168, 0.964)
  332. else
  333. Citizen.Wait(2000)
  334. end
  335. end
  336. end)
  337.  
  338. function drawTxt(x,y ,width,height,scale, text, r,g,b,a)
  339. SetTextFont(4)
  340. SetTextProportional(0)
  341. SetTextScale(scale, scale)
  342. SetTextColour(r, g, b, a)
  343. SetTextDropShadow(0, 0, 0, 0,255)
  344. SetTextEdge(2, 0, 0, 0, 255)
  345. SetTextDropShadow()
  346. SetTextOutline()
  347. SetTextEntry("STRING")
  348. AddTextComponentString(text)
  349. DrawText(x - width/2, y - height/2 + 0.005)
  350. end
  351.  
  352.  
  353.  
  354. function CalculateTimeToDisplay()
  355. hour = GetClockHours()
  356. minute = GetClockMinutes()
  357. local type = 'AM'
  358.  
  359. if hour == 1 or hour == 2 or hour == 3 or hour == 4 or hour == 5 or hour == 6 or hour == 7 or hour == 8 or hour == 9 or hour == 10 or hour == 11 or hour == 0 then
  360. type = 'AM'
  361. else
  362. type = 'PM'
  363. end
  364.  
  365. if hour <= 9 then
  366. hour = "0" .. hour
  367. end
  368. if minute <= 9 then
  369. minute = "0" .. minute
  370. end
  371. minute = minute..' '..type
  372. end
  373.  
  374.  
  375.  
  376.  
  377. --========================================================================================--
  378. --==================================== Seat Belt =========================================--
  379. --========================================================================================--
  380. local speedBuffer = {}
  381. local velBuffer = {}
  382. local wasInCar = false
  383. local carspeed = 0
  384. local speed = 0
  385.  
  386. Citizen.CreateThread(function()
  387. Citizen.Wait(500)
  388. while true do
  389. local ped = GetPlayerPed(-1)
  390. local car = GetVehiclePedIsIn(ped)
  391. if car ~= 0 and (wasInCar or IsCar(car)) then
  392. wasInCar = true
  393. speedBuffer[2] = speedBuffer[1]
  394. speedBuffer[1] = GetEntitySpeed(car)
  395. if speedBuffer[2] ~= nil and GetEntitySpeedVector(car, true).y > 1.0 and speedBuffer[2] > 18.00 and (speedBuffer[2] - speedBuffer[1]) > (speedBuffer[2] * 0.465) and usingSeatbelt == false then
  396. local co = GetEntityCoords(ped, true)
  397. local fw = Fwv(ped)
  398. SetEntityCoords(ped, co.x + fw.x, co.y + fw.y, co.z - 0.47, true, true, true)
  399. SetEntityVelocity(ped, velBuffer[2].x-10/2, velBuffer[2].y-10/2, velBuffer[2].z-10/4)
  400. Citizen.Wait(1)
  401. SetPedToRagdoll(ped, 1000, 1000, 0, 0, 0, 0)
  402. end
  403. velBuffer[2] = velBuffer[1]
  404. velBuffer[1] = GetEntityVelocity(car)
  405.  
  406. if IsControlJustPressed(0, 29) then
  407. if usingSeatbelt == false then
  408. usingSeatbelt = true
  409. TriggerEvent('notification', 'Seatbelt Enabled')
  410. else
  411. usingSeatbelt = false
  412. TriggerEvent('notification', 'Seatbelt Disabled', 2)
  413. end
  414. end
  415.  
  416.  
  417. elseif wasInCar then
  418. wasInCar = false
  419. usingSeatbelt = false
  420. speedBuffer[1], speedBuffer[2] = 0.0, 0.0
  421. end
  422. Citizen.Wait(5)
  423. speed = math.floor(GetEntitySpeed(GetVehiclePedIsIn(GetPlayerPed(-1), false)) * 2.236936)
  424. end
  425. end)
  426.  
  427. function IsCar(veh)
  428. local vc = GetVehicleClass(veh)
  429. return (vc >= 0 and vc <= 7) or (vc >= 9 and vc <= 12) or (vc >= 17 and vc <= 20)
  430. end
  431.  
  432. function Fwv(entity)
  433. local hr = GetEntityHeading(entity) + 90.0
  434. if hr < 0.0 then hr = 360.0 + hr end
  435. hr = hr * 0.0174533
  436. return { x = math.cos(hr) * 2.0, y = math.sin(hr) * 2.0 }
  437. end
  438. -------------------------stress
  439. local stresslevel = 0
  440.  
  441. RegisterNetEvent("client:updateStress")
  442. AddEventHandler("client:updateStress",function(newStress)
  443. stresslevel = newStress
  444. end)
  445.  
  446. local stressDisabled = false
  447. RegisterNetEvent("client:disableStress")
  448. AddEventHandler("client:disableStress",function(stressNew)
  449. stressDisabled = stressNew
  450. end)
  451.  
  452. RegisterNetEvent("client:newStress")
  453. AddEventHandler("client:newStress",function(positive,alteredValue)
  454. print("hello dick 1")
  455. if stressDisabled then
  456. return
  457. end
  458. print(" cock balls : )")
  459. if positive then
  460. TriggerEvent("DoShortHudText",'Stress Gained',6)
  461. else
  462. TriggerEvent("DoShortHudText",'Stress Relieved',6)
  463. end
  464.  
  465. --TriggerServerEvent("server:alterStress",positive,alteredValue)
  466. end)
  467.  
  468. Citizen.CreateThread(function()
  469. while true do
  470. if stresslevel > 10000 then
  471. ShakeGameplayCam('SMALL_EXPLOSION_SHAKE', 0.2)
  472. elseif stresslevel > 7500 then
  473. ShakeGameplayCam('SMALL_EXPLOSION_SHAKE', 0.1)
  474. elseif stresslevel > 4500 then
  475. ShakeGameplayCam('SMALL_EXPLOSION_SHAKE', 0.07)
  476. elseif stresslevel > 2000 then
  477. ShakeGameplayCam('SMALL_EXPLOSION_SHAKE', 0.02)
  478. end
  479. Citizen.Wait(2000)
  480. end
  481. end)
  482.  
  483. RegisterCommand("stress", function(source, args, raw)
  484. TriggerEvent("client:updateStress",1000)
  485. end)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement