• Problem with WModels finding.
    2 replies, posted
I have a DFrame, which contains a DModelPanel of a certain gun as default. When a player hits on of the arrows on the side I want it to move to another weapon, I'm not quite sure how to do it. It is basically a gun showcase, but there are lots of guns, and it will take a long time to store all the guns WorldModels name in a table(and go through each gun in the folder manually)... Is there a quick efficient way to get a SWEPS WModel by his name, lets say "m9k_m4a1" ?
First time trying this, here's a running example I got working that will list weapon class names and their SWEP.worldModel variable to console. [lua] function WeaponIteration () for k, v in pairs( list.Get( "Weapon" ) ) do local ent = ents.Create( v.ClassName ) print(v.ClassName .. " = " .. tostring(ent.worldModel)) end end concommand.Add("ListWepModels",WeaponIteration) [/lua]
[QUOTE=meka/sniper;44604691]First time trying this, here's a running example I got working that will list weapon class names and their SWEP.worldModel variable to console. [lua] function WeaponIteration () for k, v in pairs( list.Get( "Weapon" ) ) do local ent = ents.Create( v.ClassName ) print(v.ClassName .. " = " .. tostring(ent.worldModel)) end end concommand.Add("ListWepModels",WeaponIteration) [/lua][/QUOTE] Yes! It is working, thank you so much :)
Sorry, you need to Log In to post a reply to this thread.