Need help. How do you put your custom weapon in undefined's pointshop?
8 replies, posted
OK so I tried adding my SWEP to the pointshop, it shows on the pointshop that its there, but when you bit it.... Nothing happens. I can't post the code right now as I am on my phone. I'll post it on Monday though. But if someone could answer the problem without it great!
Anyone?
I helped a friend with their TTT and setting this up. It's pretty straight forward. But, bumping within 12 hours is a bit much. Someone will answer in time :-)
Under lua/items/weapons/ - Just create a new file and follow their pattern. If you buy an item and it doesn't spawn, it means that weapon doesn't exist in the entities folder or you don't have it period. Make sure the weapon class name is right.
Example:
Say you want to add a new weapon, and that weapons lua file name, or folder name, which exists in the gamemodename/entities/weapons/ folder and is named weapon_my_weapon.lua or weapon_my_weapon/shared.lua. You'd make a new file under lua/items/weapons/... and call it whatever you want - preferably something which identifies it, my_weapon.lua.
Use this code:
[lua]ITEM.Name = 'My Weapon'
ITEM.Price = 200 -- Give it a price
ITEM.Model = 'models/weapons/W_pistol.mdl' -- This is what it will look like in the menu
ITEM.WeaponClass = 'weapon_my_weapon'
ITEM.SingleUse = true -- Is it not persistent? Do they have to buy a new one each time they want one?
function ITEM:OnBuy(ply)
ply:Give(self.WeaponClass)
ply:SelectWeapon(self.WeaponClass)
end
function ITEM:OnSell(ply)
ply:StripWeapon(self.WeaponClass)
end[/lua]
If this answer solves your question, please feel free to mark this topic solved in the upper left corner next to the reply button.
I'll test after I get home tomorrow. Thanks for the help, hope it works!
so here is what i have but the issue is that it wont spawn the player with it every round can you help me?
[CODE]ITEM.Name = 'sg550(get every round)'
ITEM.Price = 1000 -- Give it a price
ITEM.Model = 'models/weapons/w_snip_sg550.mdl' -- This is what it will look like in the menu
ITEM.WeaponClass = 'weapon_ttt_sg550'
ITEM.SingleUse = false -- Is it not persistent? Do they have to buy a new one each time they want one?
function ITEM:OnBuy(ply)
ply:Give(self.WeaponClass)
ply:SelectWeapon(self.WeaponClass)
end
function ITEM:OnSell(ply)
ply:StripWeapon(self.WeaponClass)
end[/CODE]
You must make sure they are not already spawning with something or that that something gets stripped.
yea they don't i made sure of that but id like at the start of a ttt round for them to have the weapon
can someone help me please
Sorry to bump but I think I may be of some service.
I'm not sure if this works, but you can try copying the files of the sg500 and renaming it something that you can remember.
Go into shared.lua and change [code] SWEP.Slot = 2[/code] to [code] SWEP.Slot = 7 [/code]
Sorry, you need to Log In to post a reply to this thread.