• Pointshop Weapons skins
    13 replies, posted
Hey, i want put Weapon Skins in my Pointshop. Like crowbar -> Lightsward or something like that. So now my question, did anyone have a Pointshop Item code for this ?
You'd have to replace the crowbar with another SWEP using another model. Also, if you want something custom done for you, pay a coder on [url]http://coderhire.com[/url] instead.
What's the gamemode?
I have a TTT Server with a Pointshop.
Try: [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 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[/CODE] Taken from: [url]http://facepunch.com/showthread.php?t=1286904&p=41388387&viewfull=1#post41388387[/url]
[QUOTE=Aeternal;44809380]Try: [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 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[/CODE] Taken from: [url]http://facepunch.com/showthread.php?t=1286904&p=41388387&viewfull=1#post41388387[/url][/QUOTE] That's only if they have a separate SWEP. What you should do is just set the model instead of having a separate SWEP for every skin.
I try it with this code. I take a Katana SWEP and put the Crowbar code in it. Change the DMG a bit. But it dont work at the moment. I will test it later. At the moment i am at work.
I have a little bug with the Pointshop Weapon Skins. When i join the server, sometimes i have the Crowbar (Katana Skin) in my hand while i am spectating the round....
[code] ITEM.Name = 'Sledgehammer' ITEM.Price = 1500 ITEM.Model = 'models/weapons/w_sledgehammer.mdl' ITEM.WeaponClass = 'weapon_zm_sledgehammer' function ITEM:OnEquip(ply) ply:StripWeapon('weapon_zm_improvised') if not ply:IsSpec() then ply:Give(self.WeaponClass) ply:SelectWeapon(self.WeaponClass) end end function ITEM:OnHolster(ply) ply:StripWeapon(self.WeaponClass) if not ply:IsSpec() then ply:Give('weapon_zm_improvised') ply:SelectWeapon('weapon_zm_improvised') end end [/code]
Ok i use this code [CODE]ITEM.Name = 'Sledgehammer' ITEM.Price = 1500 ITEM.Model = 'models/weapons/w_sledgehammer.mdl' ITEM.WeaponClass = 'weapon_zm_sledgehammer' function ITEM:OnEquip(ply) ply:StripWeapon('weapon_zm_improvised') if not ply:IsSpec() then ply:Give(self.WeaponClass) ply:SelectWeapon(self.WeaponClass) end end function ITEM:OnHolster(ply) ply:StripWeapon(self.WeaponClass) if not ply:IsSpec() then ply:Give('weapon_zm_improvised') ply:SelectWeapon('weapon_zm_improvised') end end[/CODE] There are only one little problem left. I have a Katana skin, and sometimes the weapon random switch to the katana....
Could probably just change the code in the crow bar to add something along the lines of crowbar [code] if self.owner:PS_HasItem: ("crowbarnewtexture") then SWEP.ViewModel = "models/weapons/c_sledgehammer.mdl" else SWEP.ViewModel = "models/weapons/c_crowbar.mdl" end [/code] Not actual code per say, just the work around type of idea. Hopefully you see where I'm getting at. Or better yet if you have a lot of them code of item [code] ITEM.WeaponClass = 'weapon_zm_sledgehammer' function ITEM:OnEquip(ply) CBarRep = Sledge end function ITEM:OnHolster(ply) CBarRep = default end [/code] Again not actual code but hopefully you see where it's heading. You'd then have it reference to that such that SWEP.WorldModel = CBarRep Etc.
That dont fix the random weapon change problem
Did nobody know how to fix this problem ?
[QUOTE=code_gs;44811035]That's only if they have a separate SWEP. What you should do is just set the model instead of having a separate SWEP for every skin.[/QUOTE] Code_gs made a suggestion, but I am not sure how you'd do that. Try looking for a pre-draw hook for your SWEP it may be helpful. I am curious about how to do this and will try some things tonight. [url]http://wiki.garrysmod.com/page/Category:WEAPON_Hooks[/url] - These may help [url]http://wiki.garrysmod.com/page/WEAPON/PreDrawViewModel[/url] [url]http://wiki.garrysmod.com/page/WEAPON/DrawWorldModel[/url]
Sorry, you need to Log In to post a reply to this thread.