Ammo variables for active gun and also, making tables... all in lua
1 replies, posted
Ok, so I'm trying to code a hud (the fact that it is on DarkRP is not the point here, its the hud and weapons that i need help with) in a particular way so that i get the following results:
1. That disgusting HEV suit hud disappears. That shit is ugly as all fuck, and we all know it. It clashes with the rest of my hud too.
2. The section of hud the ammo and weapon name is displayed on MUST NOT appear when it displays a gun that doesnt take ammo (i tried making a table but im hopeless at that, i can still do it with ridiculously long if statements)
3. The hud doesn't encounter a few million Scripting errors when the player is dead (aka not holding any weapon) (i tried making it just not even try if the value of LocalPlayer():GetActiveWeapon() == nil but that did jack shit.)
4. This is a big one. The ammo. I need to know what to call apon for the following details: Ammo in current clip, ammo per clip (optional) and total ammo stored for that gun.
Also, if at all possible, is there a way i can check on total ammo of non active weapons? IE if i have weapon_smg1 out (which uses smg ammo.. duh) and say i have 20 pistol ammo, i want to make a little tab that reads how much ammo i have for all gun types... but this is entirely optional.
Once again, I'm not asking for anyone to do this for me, just to give me what i need to call apon for the active weapons ammo details, and maybe also how to make a table so i can rename those annoying weapons that print their name as stuff like #HL2_GravityGun or #GMOD_Physgun or even just make particular weapons such as weapons that dont use ammo to just not cause the hud to draw.
I should note, I am a noob at lua coding, i know how to read it, spot certain things and modify stuff to combine the best of two things... and I know how to use draw.RoundedBox and draw.SimpleText (which for some reason, spams the console with some errors regarding text size on connect for about a second)
AND TO ADMINS! Please, if i got this in the wrong section, if you must ban me, can you at least point me in the right direction for this? The last time I got banned for posting in the wrong section (by garry himself), I wasn't even told where the right section was... which doesn't help me.
1) [url]http://wiki.garrysmod.com/page/GM/HUDShouldDraw[/url]
2) if ( LocalPlayer():GetActiveWeapon().ClipSize >= 0 ) then
3) if ( LocalPlayer().GetActiveWeapon && IsValid(LocalPlayer():GetActiveWeapon()) then
4) [url]http://wiki.garrysmod.com/page/Weapon/Clip1[/url] & SWEP.ClipSize & [url]http://wiki.garrysmod.com/page/Player/GetAmmoCount[/url]
Sorry, you need to Log In to post a reply to this thread.