• How to add weapons to itemshop Prop hunt
    27 replies, posted
hello i am trying to add the M9K M14sp Sniper to the item shop in prop hunt server. I am as far as getting the tab to display but neither the weapon model or the weapon its self will show. here is my code (relevant) so far and creates no errors. what else do i need to add to add it to the server as a purchasable weapon. <code> ITEM.Name = 'M14 Sniper' ITEM.Price = 10 ITEM.Model = 'models/weapons/w_snip_m14sp.mdl' ITEM.WeaponClass = 'weapon_equip1' ITEM.SingleUse = true function ITEM:OnBuy(ply) ply:Give(self.WeaponClass) ply:SelectWeapon(self.WeaponClass) end function ITEM:OnSell(ply) ply:StripWeapon(self.WeaponClass) end </code> autorun <code> if SERVER then resource.AddSingleFile( "models/weapons/w_snip_m14sp.mdl" ) resource.AddSingleFile( "models/weapons/w_snip_m14sp.dx80.vtx" ) resource.AddSingleFile( "models/weapons/w_snip_m14sp.dx90.vtx" ) resource.AddSingleFile( "models/weapons/w_snip_m14sp.phy" ) resource.AddSingleFile( "models/weapons/w_snip_m14sp.sw.vtx" ) resource.AddSingleFile( "models/weapons/w_snip_m14sp.vvd" ) resource.AddSingleFile( "models/weapons/w_snip_m14sp.xbox.vtx" ) resource.AddSingleFile( "models/weapons/v_snip_m14sp.mdl" ) resource.AddSingleFile( "models/weapons/v_snip_m14sp.dx80.vtx" ) resource.AddSingleFile( "models/weapons/v_snip_m14sp.dx90.vtx" ) resource.AddSingleFile( "models/weapons/v_snip_m14sp.phy" ) resource.AddSingleFile( "models/weapons/v_snip_m14sp.sw.vtx" ) resource.AddSingleFile( "models/weapons/v_snip_m14sp.vvd" ) resource.AddSingleFile( "models/weapons/v_snip_m14sp.xbox.vtx" ) resource.AddSingleFile( "materials/vgui/entities/m14sp.vtf" ) resource.AddSingleFile( "materials/vgui/hud/m9k_m14sp.vmt" ) resource.AddSingleFile( "materials/vgui/entities/m9k_m14sp.vmt" ) </code> the rest of the auto run files is standard from M9K this may be obvious to some but please understand i have only started learning this stuff today and a little help goes a long way.
somehow got things working o.0 but when i buy said item i cannot use it in game (modle shows correct and such things but i cant use it. any help on this ?
Do you actually have a weapon installed on the server with that name
yes both client and server. v_snip_m14_sp.mdl and w_snip_m14_sp.mdl from the M9K weapons pack. i can get it to show in game just not use it after i have bought it
Oh, I meant an actual weapon/swep folder, not just the models
hummm ... there is suppose to be a swep folder ... for prop hunt ? i thought sweps were for spawnable weapons (like map weapons) not for the item shop.
Go into prop_hunt/entities/weapons and that's where you should be placing custom weapons for the gamemode
SWEPs are scripted weapons, not just models.
by scripted weapons you are talking about weapons that shoot correct. just dont want to misinterpret what SWEPs are
[QUOTE=AceScottie;43438187]by scripted weapons you are talking about weapons that shoot correct. just dont want to misinterpret what SWEPs are[/QUOTE] They can also be melee weapons as well. A SWEP is any kind of weapon that is scripted.
ok well they are sweps. that im sure of. i can use them in Sandbox and shoot them as normal. but i just cant get them in prop hunt. im trying to add the USAS 12 from the M9K heavy weapons pack.
Did you add the SWEP to prophunt/entities/weapons?
i think so. i added the some folder from addons to gmod\garrysmod\gamemodes\prop_hunt\entities\weapons\heavy weapons
What's in heavyweapons?
this would be a lot easier if there was a tutorial lol [editline]6th January 2014[/editline] in the folder the is lua, materials, models, sound and addon.txt
That's not how to add SWEPs. Just link the addon and I'll put the proper structure in for you.
thanks. [url]http://steamcommunity.com/sharedfiles/filedetails/?id=128091208[/url]
[url]https://www.dropbox.com/s/6d6sz9155gk19p0/m9k.rar[/url]
thank. can you run me through on where to put all this stuff. I'm guessing addons goes to addons and the entities goes to entities. or do i drop it all into entities ?
Just drop those folders in your GarrysModDS/garrysmod folder. It's pretty self-explanatory.
ok i have done that what else is there to do as i still cant use them after i purchased them from shop
weapon_equip1 is not a valid class. The class name should be m9k_something.
its set to weapon_m9k_usas at the moment. is that correct ? [editline]6th January 2014[/editline] from what i have taken from the code SWEP.Gun = ("m9k_usas") killicon.Add( "m9k_usas", "vgui/hud/m9k_usas", icol ) its called the m9k_usas which is what i have it called in pointshop code ITEM.WeaponClass = 'weapon_m9k_usas' yet it still dose not work. as far as i can tell the auto run code is correct and the pointshop code is correct and i can only guess the prop_hunt/entities/weapons are correct. so what else am i missing. what else is left to do.
Try typing give m9k_usas in console.
yep give m9k_usas works fine and gives me the USAS 12 shotgun point show still not giving me it though (console when i buy it) Attempted to create unknown entity type weapon_m9k_usas! NULL Ent in GiveNamedItem!
because you put weapon_ in front of it classes have to EXIST before you can use them
thanks that solved it. sorry for all the noob questions. im a 3d modeler so not brill at programming :)
[QUOTE=code_gs;43440387][url]https://www.dropbox.com/s/6d6sz9155gk19p0/m9k.rar[/url][/QUOTE] How did you get this set up ? im not seeing it in my server addon folder and i would like to know for future reference. Never mind i got it :) forgot you edited the addon file structure.
Sorry, you need to Log In to post a reply to this thread.