Guest User

Untitled

a guest
Jul 6th, 2016
131
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 10.28 KB | None | 0 0
  1.  
  2. fading = 0
  3. fading2 = "up"
  4. local screenWidth,screenHeight = guiGetScreenSize()
  5. function updateIcons ()
  6. if getElementData(getLocalPlayer(),"logedin") then
  7. --fading
  8. if fading >= 0 and fading2 == "up" then
  9. fading = fading + 5
  10. elseif fading <= 255 and fading2 == "down" then
  11. fading = fading - 5
  12. end
  13. --fading math.
  14. if fading == 0 then
  15. fading2 = "up"
  16. elseif fading == 255 then
  17. fading2 = "down"
  18. end
  19. --sound
  20. dxDrawImage ( screenWidth*0.9325 , screenHeight*0.41, screenHeight*0.075, screenHeight*0.075, "images/dayzicons/sound.png",0,0,0,tocolor(0,255,0))
  21. local sound = getElementData(getLocalPlayer(),"volume")/20
  22. if sound > 1 then
  23. dxDrawImage ( screenWidth*0.9075 , screenHeight*0.41, screenHeight*0.075, screenHeight*0.075, "images/dayzicons/level_"..sound..".png",0,0,0,tocolor(0,255,0))
  24. end
  25. --visibly
  26. dxDrawImage ( screenWidth*0.9325 , screenHeight*0.475, screenHeight*0.075, screenHeight*0.075, "images/dayzicons/eye.png",0,0,0,tocolor(0,255,0))
  27. local sound = getElementData(getLocalPlayer(),"visibly")/20
  28. if sound > 1 then
  29. dxDrawImage ( screenWidth*0.9075 , screenHeight*0.475, screenHeight*0.075, screenHeight*0.075, "images/dayzicons/level_"..sound..".png",0,0,0,tocolor(0,255,0))
  30. end
  31. --brokenbone
  32. if getElementData(getLocalPlayer(),"brokenbone") then
  33. dxDrawImage ( screenWidth*0.9375 , screenHeight*0.55, screenHeight*0.065, screenHeight*0.065, "images/dayzicons/brokenbone.png",0,0,0,tocolor(255,255,255))
  34. end
  35. --bandit
  36. local humanity = getElementData(getLocalPlayer(),"humanity")
  37. if humanity > 0 then
  38. local humanity = getElementData(getLocalPlayer(),"humanity")/9.8
  39. r,g,b = 255-humanity,humanity,0
  40. else
  41. r,g,b = 255,0,0
  42. end
  43. dxDrawImage ( screenWidth*0.925 , screenHeight*0.6, screenHeight*0.1, screenHeight*0.1, "images/dayzicons/bandit.png",0,0,0,tocolor(r,g,b))
  44. --temperature
  45. local temperature = math.round(getElementData(getLocalPlayer(),"temperature"),2)
  46. r,g,b = 0,255,0
  47. if temperature <= 37 then
  48. value = (37-temperature)*42.5
  49. r,g,b = 0,255-value,value
  50. elseif temperature > 37 and temperature < 41 then
  51. r,g,b = 0,255,0
  52. elseif temperature == 41 then
  53. r,g,b = 255,0,0
  54. end
  55. if value > 215 then
  56. dxDrawImage ( screenWidth*0.94 , screenHeight*0.7, screenHeight*0.065, screenHeight*0.065, "images/dayzicons/temperature.png",0,0,0,tocolor(r,g,b,fading))
  57. else
  58. dxDrawImage ( screenWidth*0.94 , screenHeight*0.7, screenHeight*0.065, screenHeight*0.065, "images/dayzicons/temperature.png",0,0,0,tocolor(r,g,b))
  59. end
  60. --thirsty
  61. r,g,b = 0,255,0
  62. local thirst = getElementData(getLocalPlayer(),"thirst")*2.55
  63. r,g,b = 255-thirst,thirst,0
  64. if thirst < 15 then
  65. dxDrawImage ( screenWidth*0.94 , screenHeight*0.775, screenHeight*0.065, screenHeight*0.065, "images/dayzicons/thirsty.png",0,0,0,tocolor(r,g,b,fading))
  66. else
  67. dxDrawImage ( screenWidth*0.94 , screenHeight*0.775, screenHeight*0.065, screenHeight*0.065, "images/dayzicons/thirsty.png",0,0,0,tocolor(r,g,b))
  68. end
  69. --blood
  70. r,g,b = 0,255,0
  71. local blood = getElementData(getLocalPlayer(),"blood")/47.2
  72. r,g,b = 255-blood,blood,0
  73. dxDrawImage ( screenWidth*0.94 , screenHeight*0.85, screenHeight*0.065, screenHeight*0.065, "images/dayzicons/blood.png",0,0,0,tocolor(r,g,b))
  74. if getElementData(getLocalPlayer(),"bleeding") > 0 then
  75. dxDrawImage ( screenWidth*0.94 , screenHeight*0.85, screenHeight*0.065, screenHeight*0.065, "images/dayzicons/medic.png",0,0,0,tocolor(255,255,255,fading))
  76. end
  77. --food
  78. r,g,b = 0,255,0
  79. local food = getElementData(getLocalPlayer(),"food")*2.55
  80. r,g,b = 255-food,food,0
  81. if food < 15 then
  82. dxDrawImage ( screenWidth*0.94 , screenHeight*0.925, screenHeight*0.065, screenHeight*0.065, "images/dayzicons/food.png",0,0,0,tocolor(r,g,b,fading))
  83. else
  84. dxDrawImage ( screenWidth*0.94 , screenHeight*0.925, screenHeight*0.065, screenHeight*0.065, "images/dayzicons/food.png",0,0,0,tocolor(r,g,b))
  85. end
  86. --Nametags
  87. local x,y,z = getElementPosition(getLocalPlayer())
  88. for i,player in ipairs(getElementsByType("player")) do
  89. setPlayerNametagShowing ( player, false )
  90. if player ~= getLocalPlayer() then
  91. local vehicle = getPedOccupiedVehicle(player)
  92. local px,py,pz = getElementPosition (player)
  93. local pdistance = getDistanceBetweenPoints3D ( x,y,z,px,py,pz )
  94. if pdistance <= 2 then
  95. --Get screenposition
  96. local sx,sy = getScreenFromWorldPosition ( px, py, pz+0.95, 0.06 )
  97. if sx and sy then
  98. --Draw Name
  99. if getElementData(player,"bandit") then
  100. text = string.gsub(getPlayerName(player), '#%x%x%x%x%x%x', '' ).." (Bandit)"
  101. else
  102. text = string.gsub(getPlayerName(player), '#%x%x%x%x%x%x', '' )
  103. end
  104. local w = dxGetTextWidth(text,1.02,"default-bold")
  105. dxDrawText (text, sx-(w/2), sy, sx-(w/2), sy, tocolor ( 100, 255, 100, 200 ), 1.02, "default-bold" )
  106. end
  107. end
  108. end
  109. end
  110. --Vehicletags
  111. local x,y,z = getElementPosition(getLocalPlayer())
  112. for i,veh in ipairs(getElementsByType("vehicle")) do
  113. local px,py,pz = getElementPosition (veh)
  114. local vehID = getElementModel(veh)
  115. local vehicle = getPedOccupiedVehicle(getLocalPlayer())
  116. if veh ~= vehicle then
  117. if vehID ~= 548 then
  118. local pdistance = getDistanceBetweenPoints3D ( x,y,z,px,py,pz )
  119. if pdistance <= 6 then
  120. --Get screenposition
  121. local sx,sy = getScreenFromWorldPosition ( px, py, pz+0.95, 0.06 )
  122. if sx and sy then
  123. --Draw Vehicle
  124. local w = dxGetTextWidth(getVehicleName(veh),1.02,"default-bold")
  125. dxDrawText ( getVehicleName(veh), sx-(w/2), sy, sx-(w/2), sy, tocolor ( 100, 255, 100, 200 ), 1.02, "default-bold" )
  126. end
  127. end
  128. end
  129. end
  130. end
  131. --Vehicle Infos
  132. local veh = getPedOccupiedVehicle (getLocalPlayer())
  133. if veh then
  134. local maxfuel = getElementData(veh,"maxfuel")
  135. local fuel = getElementData(getElementData(veh,"parent"),"fuel")
  136. local needengine = getElementData(veh,"needengines")
  137. local needtires = getElementData(veh,"needtires")
  138. local needparts = getElementData(veh,"needparts")
  139. local engine = getElementData(getElementData(veh,"parent"),"Engine_inVehicle") or 0
  140. local tires = getElementData(getElementData(veh,"parent"),"Tire_inVehicle") or 0
  141. local parts = getElementData(getElementData(veh,"parent"),"Parts_inVehicle") or 0
  142. local offset = dxGetFontHeight(1.02,"default-bold")
  143. local w = dxGetTextWidth(engine.."/"..needengine.." Engine",1.02,"default-bold")
  144. if engine == needengine then
  145. r,g,b = 0,255,0
  146. else
  147. r,g,b = 255,0,0
  148. end
  149. dxDrawText (engine.."/"..needengine.." Engine" ,screenWidth*0.5-w/2 , screenHeight*0,screenWidth*0.5-w/2 , screenHeight*0,tocolor ( r,g,b, 220 ), 1.02, "default-bold" )
  150. local w = dxGetTextWidth(tires.."/"..needtires.." Tires",1.02,"default-bold")
  151. if tires == needtires then
  152. r,g,b = 0,255,0
  153. else
  154. r,g,b = 255,0,0
  155. end
  156. dxDrawText (tires.."/"..needtires.." Tires",screenWidth*0.5-w/2 , screenHeight*0+offset,screenWidth*0.5-w/2 , screenHeight*0+offset,tocolor ( r,g,b, 220 ), 1.02, "default-bold" )
  157. local w = dxGetTextWidth(parts.."/"..needparts.." Tank Parts",1.02,"default-bold")
  158. if parts == needparts then
  159. r,g,b = 0,255,0
  160. else
  161. r,g,b = 255,0,0
  162. end
  163. dxDrawText (parts.."/"..needparts.." Tank Parts",screenWidth*0.5-w/2 , screenHeight*0+offset*2,screenWidth*0.5-w/2 , screenHeight*0+offset, tocolor (r,g,b, 220 ) , 1.02, "default-bold" )
  164. local w = dxGetTextWidth("Fuel:"..math.floor(fuel).."/"..maxfuel,1.02,"default-bold")
  165. if fuel == maxfuel then
  166. r,g,b = 0,255,0
  167. elseif fuel < maxfuel/10 then
  168. r,g,b = 255,0,0
  169. elseif fuel < maxfuel/4 then
  170. r,g,b = 255,50,0
  171. elseif fuel < maxfuel/3 then
  172. r,g,b = 200,100,0
  173. elseif fuel < maxfuel/2 then
  174. r,g,b = 125,200,0
  175. elseif fuel < maxfuel/1.5 then
  176. r,g,b = 50,200,0
  177. end
  178. dxDrawText ("Fuel:"..math.floor(fuel).."/"..maxfuel,screenWidth*0.5-w/2 , screenHeight*0+offset*3,screenWidth*0.5-w/2 , screenHeight*0+offset*2,tocolor ( r,g,b, 220 ), 1.02, "default-bold" )
  179. end
  180. if not playerTarget then return end
  181. local x,y,z = getElementPosition(playerTarget)
  182. local x,y,distance = getScreenFromWorldPosition (x,y,z+0.5)
  183. distance = 20
  184. if getElementData(playerTarget,"bandit") then
  185. text = string.gsub(getPlayerName(playerTarget), '#%x%x%x%x%x%x', '' ).." (Bandit)"
  186. else
  187. text = string.gsub(getPlayerName(playerTarget), '#%x%x%x%x%x%x', '' )
  188. end
  189. local w = dxGetTextWidth(text,distance*0.033,"default-bold")
  190. dxDrawText (text,x-(w/2),y,x-(w/2), y, tocolor ( 100, 255, 100, 200 ), distance*0.033, "default-bold" )
  191. end
  192. end
  193. addEventHandler ( "onClientRender", getRootElement(), updateIcons )
Advertisement
Add Comment
Please, Sign In to add comment