[T1] Ammo Hud for Andrews konfig

twice

Veteran XV
im working on customizing it and i need a good ammo hud.. slug for some reason yours does not work which i dont understand so if anyone else has some others or some stand alone ones please link me up
 
PHP:
function Ammo::Init()
{
	$Ammo::Colour = 0;
	$Ammo::Type[13] = "Bullet";
	$Ammo::Type[15] = "Plasma Bolt";
	$Ammo::Type[17] = "Grenade Ammo";
	$Ammo::Type[19] = "Mortar Ammo";
	$Ammo::Type[21] = "Disc";
}

function Ammo::Update()
{
	AmmoCount(getMountedItem(0));
	Schedule::Add("Ammo::Update();", 0.1);
}


function AmmoCount(%weaponId)
{
	%ammo = getItemCount($Ammo::Type[%weaponId]);

	if(%ammo)
	{
		control::SetPosition("Ammo_Text", Stripped::getScreenSizeX()/2 - 32, Stripped::getScreenSizeY()/2 + 32);
		control::setValue("Ammo_Text", "<F3>" @ %ammo);
	}
	else
	{
		if ((%weaponId == "13") || (%weaponId == "15") || (%weaponId == "17") || (%weaponId == "19") || (%weaponId == "21"))
		{
			control::SetPosition("Ammo_Text", 475, 350);
			Ammo::Flash();  //Flash Out of Ammo
		}
		else
			control::setValue("Ammo_Text", "");
	}
}

function Ammo::Flash()
{
	if ($Ammo::colour > 2) { $Ammo::colour = 0; }
	control::setValue("Ammo_Text", "<f"@$Ammo::colour@">Out of Ammo!");
	$Ammo::colour++;
}

function Ammo::Show()
{
	control::setVisible("Ammo_Text", TRUE);
}

function Ammo::Hide()
{
	control::setVisible("Ammo_Text", FALSE);
}


function Ammo::Create()
{
	if(!$ConnectedToServer) {
	schedule("Ammo::Create();", 1);
	return;}

	$CountHud = newObject("Ammo_Text", FearGuiFormattedText, Stripped::getScreenSizeX()/2 - 32, Stripped::getScreenSizeY()/2 + 32, 0, 0);

	addToSet(PlayGui, $CountHud);

	Ammo::Update();
}

function Ammo::Destroy()
{
	deleteObject($CountHud);
}

Event::Attach(eventExit, Ammo::Destroy);
Event::Attach(eventConnectionAccepted, Ammo::Destroy);
Event::Attach(eventConnectionAccepted, Ammo::Create);
Event::Attach(eventConnected, Ammo::Init);
** Had to use PHP tags, CODE tags don't seem to work properly...

I quickly ported that over when I still cared about my config. Prolly could clean it up a lot.
Ported a fair bit of other stuff, so just ask if you need.
 
cyclonite said:
Stripped::getScreenSizeX()/2 - 32, Stripped::getScreenSizeY()/2 + 32, 0, 0);

stripped command? what would this function be in andrews
ok problem fixed thx cyc
 
Last edited:
What about a clock hud kinda like the one evita used for 1.5 i woudl port it except i am a fucking idiot in codeland
 
i think slug is the only one in the world who actually takes advantage of my hud system (aka strips an existing script of its hud code and adds his own in)
 
hmm...i need a killpop hud for andrew's config. i might be able to stick the code in the kill.notify.acs.cs with just the bottomprint command or somethin...can someone whip me one up, or tell me how do stick it in kill.notify.acs.cs? =\
 
[meph]DooM! said:
i think slug is the only one in the world who actually takes advantage of my hud system (aka strips an existing script of its hud code and adds his own in)
if you would have done it right the first time.. grr :p lol
I am actually almost done
ill post pics :eek:
 
OK code didnt work and php makes it look fucked...
How can i port this to andrews! (andrew? :) )



// Clock
// Evita
// ported from MrPoops version.

$clock::Xoffset = "54";
$clock::Yoffset = "18";

function Clock::Init() {

if($Clock::Loaded)
return;

$Clock::Loaded = true;

$Clock::Container = newObject("Clock_Container", SimGui::Control, 0, 0, 86, 19);
$Clock::HUD = newObject("Clock_Text", FearGuiFormattedText, 4, 0, 66, 19);

addtoset($Clock::Container, $Clock::HUD);
}

function Clock::Update(%min, %sec) {

$ClockHud::Hour = floor(%min / 60);
$ClockHud::Min = %min % 60;
$ClockHud::Sec = %sec;

$ClockHud::CountingDown = true;

schedule::Add("Clock::Iterate();", 1);

Control::setValue("Clock_Text", "<f2>" @ LZero($ClockHud::Hour) @ ":" @ LZero($ClockHud::Min) @ ":" @ LZero($ClockHud::Sec));
}

function Clock::SetReverse() {

$ClockHud::Hour = $ClockHud::Min = $clockHud::Sec = 0;
$ClockHud::CountingDown = false;
}

function LZero(%number) {

if (%number < 10)
return "0" @ %number;
else
return %number;
}

function Clock::Iterate() {

if(!$Mode::playMode)
return;

if($ClockHud::CountingDown) {

if($ClockHud::Sec > 0) {
$ClockHud::Sec--;
}

else {
$ClockHud::Sec = 59;

if ($ClockHud::Min > 0) {
$ClockHud::Min--;
}

else {
$ClockHud::Min = 59;
$ClockHud::Hour--;
}
}

} else {

if ($ClockHud::Sec < 59) {
$ClockHud::Sec++;
}

else {
$ClockHud::Sec = 0;

if ($ClockHud::Min < 59) {
$ClockHud::Min++;
}

else {
$ClockHud::Min = 0;
$ClockHud::Hour++;
}
}
}

schedule::add("Clock::Iterate();", 1);

Control::setValue("Clock_Text", "<f2>" @ LZero($ClockHud::Hour) @ ":" @ LZero($ClockHud::Min) @ ":" @ LZero($ClockHud::Sec));
}

function Clock::GuiOpen(%gui) {

if(%gui != playGui)
return;

addToSet(playGui, $Clock::Container);

$clock::posX = ($scr_x-$clock::Xoffset);
$clock::posY = ($scr_y-$clock::Yoffset);

control::setPosition("Clock_Container", $clock::posX, $clock::posY);
}

function Clock::GuiClose(%gui) {

if(%gui != playGui)
return;

removeFromSet(playGui, $Clock::Container);
}

function Clock::Set() {

$ClockHud::Hour = $ClockHud::Min = $clockHud::Sec = 0;
schedule("ClockHud::Iterate();", 1);
Control::setValue("Clock_Text", "<f2>" @ LZero($ClockHud::Hour) @ ":" @ LZero($ClockHud::Min) @ ":" @ LZero($ClockHud::Sec));
}

function Clock::Destroy() {

removeFromSet(playGui, $Clock::Container);
deleteObject($Clock::Container);
}

onCall(GuiOpen, Clock::GuiOpen);
onCall(GuiClose, Clock::GuiClose);
onCall(Connected, Clock::Set);
onCall(ExitGame, Clock::Destroy);
onCall(MatchStarted, Clock::SetReverse);
onCall(UpdateTime, Clock::Update);

Clock::Init();
 
Heres what it looks like so far
3232.jpg
 
Back
Top