Hi, i want to add a personnal HUD Ammo to my HUD, what is the code to show ammo?
I don't see in gmod wiki
I'm not quite sure what you mean by "code to show ammo", but if you are looking for the functions that return the amount of ammo:
[img]http://wiki.garrysmod.com/favicon.ico[/img] [url=http://wiki.garrysmod.com/page/Weapon/Clip1]Weapon:Clip1[/url]
[img]http://wiki.garrysmod.com/favicon.ico[/img] [url=http://wiki.garrysmod.com/page/Weapon/Clip2]Weapon:Clip2[/url]
what exactly do u want ur ammo hud to look like, take other games for inspiration
if u want it to just show ammo in the clip and reserve, something like this one:
draw.DrawText( "Clip: "..client:GetActiveWeapon():Clip1(), "ClipFont", ScrW() - 260 , ScrH() - 95, Color( 255, 255, 255, 255 ), TEXT_ALIGN_LEFT)
draw.DrawText( "Reserve: "..client:GetAmmoCount(client:GetActiveWeapon():GetPrimaryAmmoType()), "ReserveFont", ScrW() - 260 , ScrH() - 72, Color( 255, 255, 255, 255 ), TEXT_ALIGN_LEFT)
The "ScrW() - 260 , ScrH() - 95" means the width of the players screen is found and reduced by 260, height is reduced by 95... this is so it works on everyones game incase they have different resolution
also make the fonts different for clip/reserve
surface.CreateFont("ReserveFont", {
font = "Trebuchet24",
size = 33,
weight = 5000,
blursize = 0,
scanlines = 0,
antialias = true,
})
Sorry, you need to Log In to post a reply to this thread.