Admigo Posted February 28, 2012 Posted February 28, 2012 Heey all, There is a resource called ivhud that has the hud of gta iv. There is a green ring with health but how can i make it to vehicle health? Codes: function refreshHP() hp=getElementHealth(localP)*1.8/(1+math.max(getPedStat(localP,24)-569,0)/431) --hp conversion to 180 to be max armor=getPedArmor(localP)*1.8 --todo stat dependance on armor end function drawHP() if raceMode and vehicle then hp=getElementHealth(vehicle)*0.18 armor=0 end local degr=360 local hpTempCol if hp<=18 then local ticks=getTickCount()%600 local red=ticks<=300 and 0 or 200 hpTempCol=tocolor(red,0,0,255) end hpTempCol=hpTempCol or hpCol dxDrawImage(x2,y2,l2,h2,'images/ring360.png',0,0,0,hpTempCol,false) if armor~=0 then degr=degr-hp dxDrawImage(x2,y2,l2,h2,'images/ring180.png',math.max(0,degr-1.-- s8) -->,0,0,armorCol,false) degr=degr-armor else degr=degr-hp*2 end --if dmgcount~=0 then local currprog=0 for n=0,6 do local val=180/2^n if math.ceil(val)<=degr then degr=degr-val dxDrawImage(x2,y2,l2,h2,'images/ring'..math.ceil(val)..'.png',val+currprog,0,0,black,false) currprog=currprog+val if degr>=360 then break end end end end Pls Help. Thanks Admigo.
myonlake Posted February 28, 2012 Posted February 28, 2012 local vehicle = getPedOccupiedVehicle(localP) You should be able to do the rest.
myonlake Posted March 1, 2012 Posted March 1, 2012 First of all, that wasn't all of it. Let me give you an example, how do you find out vehicle health? I am in a vehicle, alright. addCommandHandler("vhealth", function(player, cmd) local vehicle = getPedOccupiedVehicle(player) if vehicle then outputChatBox("Vehicle health: " .. tonumber(getElementHealth(vehicle)) .. ".", player, 220, 220, 0, false) else outputChatBox("You're not in a vehicle.", player, 255, 0, 0, false) end end ) Try to use that for your edits on the HUD.
karlis Posted March 6, 2012 Posted March 6, 2012 myonlake, its so useless what you posted... viewtopic.php?f=91&t=40982&p=415922&hilit=ivhud#p415922
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now