[T1 Request] AmmoHUD

join a hovok server, hit i and look at the weapons. Type into conosle:

Code:
echo(getItemType("this havok weapon")); //with the appropriate name substituted inside the quotes

it should return a number ex: 21. Then lookup "this havok weapon"'s ammotype (from inventory list) and record both values (number and name of ammo).

do this for all the weapons you want the hud to work with, and post them here in this format:

Code:
21, "grenade ammo"
23, "mine"
...etc
 
ok

for the shotgun we have:
The gun itself is 28, "Shotgun"
The ammo is 27, "Shotgun Shells"


for Hyper Spinfusor we have:
The gun itself is 66, "Hyper Spinfusor"
The ammo is 62, "Hyper Disc"



All the other havoc guns I added to the code work except for these 2, which are mounted the same
 
Last edited:
add the following where you see similiar stuff. i did not include the whole script because you edited it.

Code:
else if(%weapon == 28)
{
	HUD::AddTextLine("AmmoHUD","<F2>" @ getItemCount("Shotgun Shells"));
        return "0.2";
}
else if(%weapon == 66)
{
	HUD::AddTextLine("AmmoHUD","<F2>" @ getItemCount("Hyper Disc"));
	return "0.2";
}
 
still not working, this is what my code looks like:

Code:
//AMMO HUD by HotCheese
// HaVoC 1.5.9c Support By: KiLLeR2001

function AmmoHUD::Update()
{       %weapon = getMountedItem(0);
        if (%weapon == 21)
                HUD::AddTextLine("AmmoHUD","<F2>" @ getItemCount("Disc"));
        //if it's a cg we gotta make it update faster to keep up with the rate of fire
        else if (%weapon == 13) {
                HUD::AddTextLine("AmmoHUD","<F2>" @ getItemCount("Bullet"));
                return ".1";
        }
        else if (%weapon == 17)
                HUD::AddTextLine("AmmoHUD","<F2>" @ getItemCount("Grenade Ammo"));
        else if (%weapon == 19)
		    HUD::AddTextLine("AmmoHUD","<F2>" @ getItemCount("Mortar Ammo"));
	  else if (%weapon == 15)
		    HUD::AddTextLine("AmmoHUD","<F2>" @ getItemCount("Plasma Bolt"));
	  else if (%weapon == 65)
		    HUD::AddTextLine("AmmoHUD","<F2>" @ getItemCount("Disc"));
	  else if (%weapon == 30)
		    HUD::AddTextLine("AmmoHUD","<F2>" @ getItemCount("Bullet"));
	  else if (%weapon == 32)
		    HUD::AddTextLine("AmmoHUD","<F2>" @ getItemCount("Plasma Bolt"));
        else if (%weapon == 69)
                HUD::AddTextLine("AmmoHUD","<F2>" @ getItemCount("Grenade Ammo"));
        else if (%weapon == 79)
		    HUD::AddTextLine("AmmoHUD","<F2>" @ getItemCount("Mortar Ammo"));
        else if (%weapon == 75)
		    HUD::AddTextLine("AmmoHUD","<F2>" @ getItemCount("Rockets"));
        else if (%weapon == 76)
		    HUD::AddTextLine("AmmoHUD","<F2>" @ getItemCount("Rockets"));
        else if (%weapon == 77)
		    HUD::AddTextLine("AmmoHUD","<F2>" @ getItemCount("EMPGrenadeAmmo"));
        else if (%weapon == 81)
		    HUD::AddTextLine("AmmoHUD","<F2>" @ getItemCount("Magnum Bullets"));
        else if (%weapon == 83)
		    HUD::AddTextLine("AmmoHUD","<F2>" @ getItemCount("Poison Dart"));
        else if (%weapon == 85)
		    HUD::AddTextLine("AmmoHUD","<F2>" @ getItemCount("Railgun Bolt"));
        else if (%weapon == 86)
		    HUD::AddTextLine("AmmoHUD","<F2>" @ getItemCount("Sniper Bullet"));
	  else if (%weapon == 28)
        {
                 HUD::AddTextLine("AmmoHUD","<F2>" @ getItemCount("Shotgun Shells"));
                 return ".1";
        }
        else if (%weapon == 66)
        {
                 HUD::AddTextLine("AmmoHUD","<F2>" @ getItemCount("Hyper Disc"));
                 return ".1";
        }
        else
		    HUD::AddTextLine("AmmoHUD","<f2>");
	  return ".1";
}

function AmmoHUD::Create() {
	  HUD::New("AmmoHUD","AmmoHUD::Update","50%-24 50%+24 24 16");
        HUD::Display("AmmoHUD");
}
AmmoHUD::Create();
 
Last edited:
use the shotgun and type echo(GetMountedItem(0)); do same for hyper disc and make sure it returns 28 and 66.

i see nothing wrong with the code iteself though. you may want to use a higher number than .1 as the final return though.
 
w00t I got it too work! Thanks for your help Puw <3


Thats strange though, when I typed:

Code:
echo(getItemType("Shotgun"));

I got 28, but when i typed:

Code:
echo(getMountedItem(0));

while having hyper/shotgun drawn out, I got:

29 for shotgun (instead of 28) and
68 for Hyper (instead of 66) :\
 
Back
Top