• Crowbar Replacements - Pointshop
    10 replies, posted
-Solved-
[CODE]ITEM.Name = 'Sledgehammer' // change this to whatever name you want ITEM.Price = 600 // change this to whatever price you want ITEM.Model = 'models/weapons/w_sledgehammer.mdl' // change this to what shop 'icon' you want ITEM.WeaponClass = 'weapon_zm_sledgehammer' //change this to name for item you want to replace the crowbar with function ITEM:OnEquip(ply) ply:StripWeapon('weapon_zm_improvised') ply:Give(self.WeaponClass) ply:SelectWeapon(self.WeaponClass) end function ITEM:OnHolster(ply) ply:StripWeapon(self.WeaponClass) ply:Give('weapon_zm_improvised') ply:SelectWeapon('weapon_zm_improvised') end[/code]
Thanks, I will try this.
[QUOTE=NiandraLades;41364695][CODE]ITEM.Name = 'Sledgehammer' // change this to whatever name you want ITEM.Price = 600 // change this to whatever price you want ITEM.Model = 'models/weapons/w_sledgehammer.mdl' // change this to what shop 'icon' you want ITEM.WeaponClass = 'weapon_zm_sledgehammer' //change this to name for item you want to replace the crowbar with function ITEM:OnEquip(ply) ply:StripWeapon('weapon_zm_improvised') ply:Give(self.WeaponClass) ply:SelectWeapon(self.WeaponClass) end function ITEM:OnHolster(ply) ply:StripWeapon(self.WeaponClass) ply:Give('weapon_zm_improvised') ply:SelectWeapon('weapon_zm_improvised') end[/code][/QUOTE] Shouldn't there be some call for when a player spawns?
[QUOTE]Shouldn't there be some call for when a player spawns?[/QUOTE] Ye thats what I am thinking, that didnt work. It only give you it for one round then goes.
Why not just set color? On the swep init, call if the person has the item and get the color set? The send to others, like darkrp arrest sticks?
[QUOTE=sparky99456;41379625]Ye thats what I am thinking, that didnt work. It only give you it for one round then goes.[/QUOTE] Hang on, I have a function you want to add to make this spawn when the player spawns. I, uh, have noticed a bug with this function (most noticable with ammo) where if any player spawns, all players owning this item will go through the player spawn function. Hopefully, this won't matter. [lua] function ITEM:PlayerSpawn(ply) ply:StripWeapon('weapon_zm_improvised') ply:Give(self.WeaponClass) ply:SelectWeapon(self.WeaponClass) end [/lua] [editline]10th July 2013[/editline] Theres actually more required here. Let me put it all together. [lua] ITEM.Name = 'Sledgehammer' // change this to whatever name you want ITEM.Price = 600 // change this to whatever price you want ITEM.Model = 'models/weapons/w_sledgehammer.mdl' // change this to what shop 'icon' you want ITEM.WeaponClass = 'weapon_zm_sledgehammer' //change this to name for item you want to replace the crowbar with ITEM.SingleUse = false // makes it persist every time. This does sometimes bug out, a good suggestion would be to add more weapons before this weapon that work similar, may give a workaround to your issue. function ITEM:OnEquip(ply) ply:StripWeapon('weapon_zm_improvised') ply:Give(self.WeaponClass) ply:SelectWeapon(self.WeaponClass) end function ITEM:OnHolster(ply) ply:StripWeapon(self.WeaponClass) ply:Give('weapon_zm_improvised') ply:SelectWeapon('weapon_zm_improvised') end function ITEM:PlayerSpawn(ply) ply:StripWeapon('weapon_zm_improvised') ply:Give(self.WeaponClass) ply:SelectWeapon(self.WeaponClass) end [/lua] [editline]10th July 2013[/editline] had to ninja edit, missed a line... [editline]10th July 2013[/editline] [QUOTE=andreblue;41387746]Why not just set color? On the swep init, call if the person has the item and get the color set? The send to others, like darkrp arrest sticks?[/QUOTE] Not sure where you got colors from... the way im seeing the question, he just wants an entirely new swep to replace the crowbar through the use of pointshop.
[QUOTE=Redfiend;41388387]Hang on, I have a function you want to add to make this spawn when the player spawns. I, uh, have noticed a bug with this function (most noticable with ammo) where if any player spawns, all players owning this item will go through the player spawn function. Hopefully, this won't matter. [lua] function ITEM:PlayerSpawn(ply) ply:StripWeapon('weapon_zm_improvised') ply:Give(self.WeaponClass) ply:SelectWeapon(self.WeaponClass) end [/lua] [editline]10th July 2013[/editline] Theres actually more required here. Let me put it all together. [lua] ITEM.Name = 'Sledgehammer' // change this to whatever name you want ITEM.Price = 600 // change this to whatever price you want ITEM.Model = 'models/weapons/w_sledgehammer.mdl' // change this to what shop 'icon' you want ITEM.WeaponClass = 'weapon_zm_sledgehammer' //change this to name for item you want to replace the crowbar with ITEM.SingleUse = false // makes it persist every time. This does sometimes bug out, a good suggestion would be to add more weapons before this weapon that work similar, may give a workaround to your issue. function ITEM:OnEquip(ply) ply:StripWeapon('weapon_zm_improvised') ply:Give(self.WeaponClass) ply:SelectWeapon(self.WeaponClass) end function ITEM:OnHolster(ply) ply:StripWeapon(self.WeaponClass) ply:Give('weapon_zm_improvised') ply:SelectWeapon('weapon_zm_improvised') end function ITEM:PlayerSpawn(ply) ply:StripWeapon('weapon_zm_improvised') ply:Give(self.WeaponClass) ply:SelectWeapon(self.WeaponClass) end [/lua] [editline]10th July 2013[/editline] had to ninja edit, missed a line... [editline]10th July 2013[/editline] Not sure where you got colors from... the way im seeing the question, he just wants an entirely new swep to replace the crowbar through the use of pointshop.[/QUOTE] I swore I saw something about color. He could make one swep and change it there
I'm trying this now and it isn't working, could it be because of updates?
Is the code working cause I would like to use this code for an item in my pointshop too! :D
So basically if I created a weapon that I've used the crowbar script for (just changed the model names), and used the script here it should work right?
Sorry, you need to Log In to post a reply to this thread.