Hi everyone,
I have just a simple question, I work on a function which save the job and the inventory of a player when he disconnect. For the job, no problem, but I juste have a question about the weapons...
I use the function GetWeapons() which return a table of weapon, like that:
[LUA]1 Weapon [371][keys]
2 Weapon [376][weapon_physcannon]
3 Weapon [404][gmod_camera]
4 Weapon [405][gmod_tool]
6 Weapon [427][weapon_physgun]
7 Weapon [428][weapon_keypadchecker]
8 Weapon [485][door_ram]
9 Weapon [540][arrest_stick]
10 Weapon [547][unarrest_stick]
11 Weapon [548][stunstick]
12 Weapon [549][weaponchecker][/LUA]
But my problem is that for some hours, I try to retrieve only the name of the weapon, and I can not do it because I don't really understand the structure of this table, someone has an idea ? Please :D
Thank you !
You mean the "nice" name of the class name? Nice name is ent.PrintName ( works only for Lua weapons ), class name is ent:GetClass(). ( what you see in the second [] brackets, works on all weapons )
In fact, I just want "weapon_physcannon" for example :) That why I think it's very simple...
Then you should use this
language.GetPhrase()
Hum, I don't want to translate or modify anything, I just want to retrieve "gmod_tool", "weapon_physcannon", etc from my table
As I said, if you want the class name, just use ent:GetClass()
[code]
for id, ent in pairs( Entity(1):GetWeapons() ) do
print( id, ent, ent:GetClass() )
end
[/code]
Ok, thank you Captain ! I'm going to test that !
Sorry, you need to Log In to post a reply to this thread.