Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- fading = 0
- fading2 = "up"
- local screenWidth,screenHeight = guiGetScreenSize()
- function updateIcons ()
- if getElementData(getLocalPlayer(),"logedin") then
- --fading
- if fading >= 0 and fading2 == "up" then
- fading = fading + 5
- elseif fading <= 255 and fading2 == "down" then
- fading = fading - 5
- end
- --fading math.
- if fading == 0 then
- fading2 = "up"
- elseif fading == 255 then
- fading2 = "down"
- end
- --sound
- dxDrawImage ( screenWidth*0.9325 , screenHeight*0.41, screenHeight*0.075, screenHeight*0.075, "images/dayzicons/sound.png",0,0,0,tocolor(0,255,0))
- local sound = getElementData(getLocalPlayer(),"volume")/20
- if sound > 1 then
- 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))
- end
- --visibly
- dxDrawImage ( screenWidth*0.9325 , screenHeight*0.475, screenHeight*0.075, screenHeight*0.075, "images/dayzicons/eye.png",0,0,0,tocolor(0,255,0))
- local sound = getElementData(getLocalPlayer(),"visibly")/20
- if sound > 1 then
- 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))
- end
- --brokenbone
- if getElementData(getLocalPlayer(),"brokenbone") then
- dxDrawImage ( screenWidth*0.9375 , screenHeight*0.55, screenHeight*0.065, screenHeight*0.065, "images/dayzicons/brokenbone.png",0,0,0,tocolor(255,255,255))
- end
- --bandit
- local humanity = getElementData(getLocalPlayer(),"humanity")
- if humanity > 0 then
- local humanity = getElementData(getLocalPlayer(),"humanity")/9.8
- r,g,b = 255-humanity,humanity,0
- else
- r,g,b = 255,0,0
- end
- dxDrawImage ( screenWidth*0.925 , screenHeight*0.6, screenHeight*0.1, screenHeight*0.1, "images/dayzicons/bandit.png",0,0,0,tocolor(r,g,b))
- --temperature
- local temperature = math.round(getElementData(getLocalPlayer(),"temperature"),2)
- r,g,b = 0,255,0
- if temperature <= 37 then
- value = (37-temperature)*42.5
- r,g,b = 0,255-value,value
- elseif temperature > 37 and temperature < 41 then
- r,g,b = 0,255,0
- elseif temperature == 41 then
- r,g,b = 255,0,0
- end
- if value > 215 then
- 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))
- else
- dxDrawImage ( screenWidth*0.94 , screenHeight*0.7, screenHeight*0.065, screenHeight*0.065, "images/dayzicons/temperature.png",0,0,0,tocolor(r,g,b))
- end
- --thirsty
- r,g,b = 0,255,0
- local thirst = getElementData(getLocalPlayer(),"thirst")*2.55
- r,g,b = 255-thirst,thirst,0
- if thirst < 15 then
- 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))
- else
- dxDrawImage ( screenWidth*0.94 , screenHeight*0.775, screenHeight*0.065, screenHeight*0.065, "images/dayzicons/thirsty.png",0,0,0,tocolor(r,g,b))
- end
- --blood
- r,g,b = 0,255,0
- local blood = getElementData(getLocalPlayer(),"blood")/47.2
- r,g,b = 255-blood,blood,0
- dxDrawImage ( screenWidth*0.94 , screenHeight*0.85, screenHeight*0.065, screenHeight*0.065, "images/dayzicons/blood.png",0,0,0,tocolor(r,g,b))
- if getElementData(getLocalPlayer(),"bleeding") > 0 then
- 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))
- end
- --food
- r,g,b = 0,255,0
- local food = getElementData(getLocalPlayer(),"food")*2.55
- r,g,b = 255-food,food,0
- if food < 15 then
- 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))
- else
- dxDrawImage ( screenWidth*0.94 , screenHeight*0.925, screenHeight*0.065, screenHeight*0.065, "images/dayzicons/food.png",0,0,0,tocolor(r,g,b))
- end
- --Nametags
- local x,y,z = getElementPosition(getLocalPlayer())
- for i,player in ipairs(getElementsByType("player")) do
- setPlayerNametagShowing ( player, false )
- if player ~= getLocalPlayer() then
- local vehicle = getPedOccupiedVehicle(player)
- local px,py,pz = getElementPosition (player)
- local pdistance = getDistanceBetweenPoints3D ( x,y,z,px,py,pz )
- if pdistance <= 2 then
- --Get screenposition
- local sx,sy = getScreenFromWorldPosition ( px, py, pz+0.95, 0.06 )
- if sx and sy then
- --Draw Name
- if getElementData(player,"bandit") then
- text = string.gsub(getPlayerName(player), '#%x%x%x%x%x%x', '' ).." (Bandit)"
- else
- text = string.gsub(getPlayerName(player), '#%x%x%x%x%x%x', '' )
- end
- local w = dxGetTextWidth(text,1.02,"default-bold")
- dxDrawText (text, sx-(w/2), sy, sx-(w/2), sy, tocolor ( 100, 255, 100, 200 ), 1.02, "default-bold" )
- end
- end
- end
- end
- --Vehicletags
- local x,y,z = getElementPosition(getLocalPlayer())
- for i,veh in ipairs(getElementsByType("vehicle")) do
- local px,py,pz = getElementPosition (veh)
- local vehID = getElementModel(veh)
- local vehicle = getPedOccupiedVehicle(getLocalPlayer())
- if veh ~= vehicle then
- if vehID ~= 548 then
- local pdistance = getDistanceBetweenPoints3D ( x,y,z,px,py,pz )
- if pdistance <= 6 then
- --Get screenposition
- local sx,sy = getScreenFromWorldPosition ( px, py, pz+0.95, 0.06 )
- if sx and sy then
- --Draw Vehicle
- local w = dxGetTextWidth(getVehicleName(veh),1.02,"default-bold")
- dxDrawText ( getVehicleName(veh), sx-(w/2), sy, sx-(w/2), sy, tocolor ( 100, 255, 100, 200 ), 1.02, "default-bold" )
- end
- end
- end
- end
- end
- --Vehicle Infos
- local veh = getPedOccupiedVehicle (getLocalPlayer())
- if veh then
- local maxfuel = getElementData(veh,"maxfuel")
- local fuel = getElementData(getElementData(veh,"parent"),"fuel")
- local needengine = getElementData(veh,"needengines")
- local needtires = getElementData(veh,"needtires")
- local needparts = getElementData(veh,"needparts")
- local engine = getElementData(getElementData(veh,"parent"),"Engine_inVehicle") or 0
- local tires = getElementData(getElementData(veh,"parent"),"Tire_inVehicle") or 0
- local parts = getElementData(getElementData(veh,"parent"),"Parts_inVehicle") or 0
- local offset = dxGetFontHeight(1.02,"default-bold")
- local w = dxGetTextWidth(engine.."/"..needengine.." Engine",1.02,"default-bold")
- if engine == needengine then
- r,g,b = 0,255,0
- else
- r,g,b = 255,0,0
- end
- 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" )
- local w = dxGetTextWidth(tires.."/"..needtires.." Tires",1.02,"default-bold")
- if tires == needtires then
- r,g,b = 0,255,0
- else
- r,g,b = 255,0,0
- end
- 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" )
- local w = dxGetTextWidth(parts.."/"..needparts.." Tank Parts",1.02,"default-bold")
- if parts == needparts then
- r,g,b = 0,255,0
- else
- r,g,b = 255,0,0
- end
- 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" )
- local w = dxGetTextWidth("Fuel:"..math.floor(fuel).."/"..maxfuel,1.02,"default-bold")
- if fuel == maxfuel then
- r,g,b = 0,255,0
- elseif fuel < maxfuel/10 then
- r,g,b = 255,0,0
- elseif fuel < maxfuel/4 then
- r,g,b = 255,50,0
- elseif fuel < maxfuel/3 then
- r,g,b = 200,100,0
- elseif fuel < maxfuel/2 then
- r,g,b = 125,200,0
- elseif fuel < maxfuel/1.5 then
- r,g,b = 50,200,0
- end
- 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" )
- end
- if not playerTarget then return end
- local x,y,z = getElementPosition(playerTarget)
- local x,y,distance = getScreenFromWorldPosition (x,y,z+0.5)
- distance = 20
- if getElementData(playerTarget,"bandit") then
- text = string.gsub(getPlayerName(playerTarget), '#%x%x%x%x%x%x', '' ).." (Bandit)"
- else
- text = string.gsub(getPlayerName(playerTarget), '#%x%x%x%x%x%x', '' )
- end
- local w = dxGetTextWidth(text,distance*0.033,"default-bold")
- dxDrawText (text,x-(w/2),y,x-(w/2), y, tocolor ( 100, 255, 100, 200 ), distance*0.033, "default-bold" )
- end
- end
- addEventHandler ( "onClientRender", getRootElement(), updateIcons )
Advertisement
Add Comment
Please, Sign In to add comment