• Getting the name string of an ammunition type
    3 replies, posted
So, I've been developing a HUD with a custom item pickup notification, but there's something I don't know how to do: Which is getting the "pretty" name of an ammunition type. For example, instead of having "SMG1_Grenade" it should say "SMG Grenades" or something like that. I've tried using language.GetPhrase but that only did the trick for weapons and items. btw I'm using the HUDAmmoPickedUp hook. Any ideas?
As far as I know there's no way to get the "real" name of ammos because when adding an ammo type there's no option to give it a normal name. What you could do is just remove the underscore, capitalize the first letter of every word and switch around the words to make it look nicer. Another way you can do is make a table of all the ammo types and give each your own name then refer to that table when you need to display it, but this will still bring problems if you try with ammo types from SWEPs. For example I have a SWEP Ammo Type set as torch_flame, you can probably get it to look like this: Torch Flame.
Not all ammo types have translations, but if it does, you can use the ammo type name followed by "_ammo". Ex. language.GetPhrase("SMG1_Grenade_ammo")
I just found out and I rushed here to tell so. Thank you anyways!
Sorry, you need to Log In to post a reply to this thread.