• [PointShop] What does the ITEM.WeaponClass function do?
    5 replies, posted
Currently using _Undefined's PS, and I'm trying to add weapons to the weapons tab. When I originally had the pointshop, the weapons in this tab weren't correct. The weapon name would say a rifle, but insead you would get a deagle. So I went through every weapon, checked the weapon I got, and the weapon name so I can simply go into the /garrysmod/addons/pointshop-master/lua/pointshop/items.weapons and change the ITEM.Name to what you were actually given. So now I'm going to add more weapons (newton launcher, more secondaries, and primaries, etc), but I'm going back to the other examples and all of the ITEM.WeaponClass functions are different then what they should be. I can't find this function in the documentation on the PS site, and I'm not sure I wanna test out different names for files only to find out the WeaponClass is what causes it to break. For example, here's my rifle, which shows a rifle in the pointshop, and it gives you a rifle when you buy it: [CODE]ITEM.Name = 'Rifle' ITEM.Price = 100000 ITEM.Model = 'models/weapons/w_snip_scout.mdl' ITEM.WeaponClass = 'weapon_357' 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] I was previously showing a deagle or some secondary weapon, but it gave me a rifle. So I changed the Model and Name, and made it work. But I left the WeaponClass alone. Moving forward, what SHOULD the WeaponClass actually say? Or does this not matter?
That would be the actual weapon that is given when you buy the item. I think this is the list of default weapons: weapon_357 weapon_alyxgun weapon_annabelle weapon_ar2 weapon_brickbat weapon_bugbait weapon_citizenpackage weapon_citizensuitcase weapon_crossbow weapon_crowbar weapon_extinguisher weapon_frag weapon_physcannon weapon_physgun weapon_pistol weapon_rpg weapon_shotgun weapon_smg1 weapon_stunstick If you have a custom swep for that rifle, you would need to use the name of it under the ITEM.WeaponClass
So by default, "weapon_357" is a rifle? Not sure I'm understanding. So if I wanted to do a TTT newton launcher, I would need to use "weapon_ttt_push" which is the file name for the Newton launcher under /garrysmod/gamemodes/terrortown/entities/weapons/push.lua In theory this would work. But I'm not sure how the rifle works, or the other guns that have a mismatched WeaponClass
[QUOTE=allofmywut;47536520]So by default, "weapon_357" is a rifle? Not sure I'm understanding. So if I wanted to do a TTT newton launcher, I would need to use "weapon_ttt_push" which is the file name for the Newton launcher under /garrysmod/gamemodes/terrortown/entities/weapons/push.lua In theory this would work. But I'm not sure how the rifle works, or the other guns that have a mismatched WeaponClass[/QUOTE] No, the 357 is a revolver, did you not buy the weapon to check??? The second part should work though.
No that's what I'm saying.. when I buy THIS particular item from the pointshop I get a rifle. But the weapon class, as you can see, is set to the weapon_357. So I'm saying, is the defauilt rifle described as a 357 (hangun)? I bought the weapon already. Works fine now. But I would imagine the ITEM.WeaponClass would need to be "weapon_ttt_rifle" for it to functions properly. But for some reason, "weapon_357" works as a rifle too.. I'll go ahead and start using the "weapon_ttt_name" for the ITEM.WeaponClass, but I'm still puzzled as to how the defaulted items worked with such mismatched weaponclasses to begin with. I can grab the other weapon classes, if anyone wants to see.
UPDATE: I got everything working correctly with the models and the weapon class. For anyone else looking for this help, you can use: 1. World.Model in the /garrysmod/gamemodes/terrortown/entities/weapons/weapon_name.lua file for the ITEM.Model which gives you what the model looks like in the PS 2. The root file name for the ITEM.WeaponClass. I previously created a file of names for another thread so you can find a list of file names in the below link. [url]http://pastebin.com/8Gr2vN3D[/url] To keep it all together, here's an example I added to my PS [CODE]ITEM.Name = 'Binoculars' --Display name ITEM.Price = 1000000 --Price ITEM.Model = 'models/props/cs_office/paper_towels.mdl' --What shows up in PS preview ITEM.WeaponClass = 'weapon_ttt_binoculars' --The weapon itself that is received in inventory ITEM.SingleUse = true --One time buy or perma function ITEM:OnBuy(ply) ply:Give(self.WeaponClass) ply:SelectWeapon(self.WeaponClass) end function ITEM:OnSell(ply) ply:StripWeapon(self.WeaponClass) end[/CODE] Hope this helped anyone else.
Sorry, you need to Log In to post a reply to this thread.