Digital Speedometer
by Tim Heldna · 02/16/2007 (9:20 am) · 6 comments
A digital speedometer that displays speed in km/h if you are mounted in (and driving) a vehicle. It works across a network and is completely scripted.
Credits go to Zod and Stefan Lundmark for their assistance in optimizing this code.
Installation
First download the files required by the display: digitalSpeedHud.zip (4 KB)
Extract the font file Digital Numbers 36 (ansi).uft to common/ui/cache
Add the following code to client/ui/customProfiles.cs
Add this to client/init.cs
Place the vehicleHUD.gui file in client/ui
Place the vehicleHUD.cs file in client/scripts
Add this to the Armor::onMount method inside of player.cs
Add this to the Armor::onUnmount method inside of player.cs
That's it. Run your game, mount a vehicle and test it out.

Credits go to Zod and Stefan Lundmark for their assistance in optimizing this code.
Installation
//--------------------------------------
// Digital Speedometer GUI (Client)
//--------------------------------------
new GuiControlProfile ("DigitalNumbers")
{
opaque = false;
fontType = "Digital Numbers";
fontSize = 36;
fontColor = "0 240 25";
};
//--------------------------------------// Digital Speedometer GUI
exec("./ui/vehicleHUD.gui");
exec("./scripts/vehicleHUD.cs");
// Digital Speedometer GUIfunction Armor::onMount(%this,%obj,%vehicle,%node)
{
// Digital Speedometer GUI
// Only show the speedometer for drivers & not passengers
if(%node == 0)
CommandToClient(%obj.client, 'vehicleHUD', "push");
// Digital Speedometer GUI
}function Armor::onUnmount( %this, %obj, %vehicle, %node )
{
// Digital Speedometer GUI
CommandToClient(%obj.client, 'vehicleHUD', "pop");
// Digital Speedometer GUI
}That's it. Run your game, mount a vehicle and test it out.

About the author
Recent Blogs
• BCS Street props• Character Pack - Vince
• Recent Artwork
• Progress of our Weapon Pack
• CD Player
#2
02/20/2007 (12:54 pm)
Slick looking Gui!
#3
02/21/2007 (7:43 pm)
Shutup, GUI's aren't my strong point :P
#4
//
new GuiConsoleTextCtrl() {
canSaveDynamicFields = "0";
Profile = "GuiDefaultProfile";
HorizSizing = "right";
VertSizing = "bottom";
position = "8 480";
Extent = "61 13";
MinExtent = "8 2";
canSave = "1";
Visible = "1";
hovertime = "1000";
expression = "getcontrolobjectspeed();";
};
04/01/2007 (6:34 pm)
Your resource is great, but i settled on this basic gui element, i thought id post it as a quick speedometer alternative.//
new GuiConsoleTextCtrl() {
canSaveDynamicFields = "0";
Profile = "GuiDefaultProfile";
HorizSizing = "right";
VertSizing = "bottom";
position = "8 480";
Extent = "61 13";
MinExtent = "8 2";
canSave = "1";
Visible = "1";
hovertime = "1000";
expression = "getcontrolobjectspeed();";
};
#5
04/10/2007 (7:55 am)
Do the onmount and onunmount changes need to be replaced or added to?
#6
04/10/2007 (9:49 am)
Added to. 
Torque Owner David Byrge