Is there a way to make crowbar replacements a buyable thing? Like in the pointshop you could buy a new "crowbar look"?
Also, how exactly do I get this to work? [url]http://www.garrysmod.org/downloads/?a=view&id=75969[/url]
[QUOTE=spocksgirl94;42894911]Is there a way to make crowbar replacements a buyable thing? Like in the pointshop you could buy a new "crowbar look"?
Also, how exactly do I get this to work? [url]http://www.garrysmod.org/downloads/?a=view&id=75969[/url][/QUOTE]
Try this code. Remember to replace the models in this code with yours.
[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]
I did that and it was just errors/ still gave me the crow bar
Did you actually make a weapon called weapon_zm_sledgehammer?
[QUOTE=NiandraLades;42898244]Did you actually make a weapon called weapon_zm_sledgehammer?[/QUOTE]
Nah I took it from a previous post, but I've used the code though.
[editline]17th November 2013[/editline]
[QUOTE=spocksgirl94;42897808]I did that and it was just errors/ still gave me the crow bar[/QUOTE]
Try putting the models/materials in a folder then in the addons folder or just in the server directory I always forget.
[QUOTE=spocksgirl94;42897808]I did that and it was just errors/ still gave me the crow bar[/QUOTE]
it's like you dont even read what you're given
it was example code
[QUOTE=spocksgirl94;42897808]I did that and it was just errors/ still gave me the crow bar[/QUOTE]
I read your post, so I also tried everything i could. The results are the same for me.
[QUOTE=zerothefallen;42898983]it's like you dont even read what you're given
it was example code[/QUOTE]
No I used that code and changed it to my stuff and it didn't work.
[QUOTE=NiandraLades;42898244]Did you actually make a weapon called weapon_zm_sledgehammer?[/QUOTE]
This post was aimed at the person asking for help, by the way. Maybe the reason it's not giving it to you is because it doesn't exist?
Also it's a bad idea to remove loadout weapons from players during the prep phase in TTT because it will just give it right back to them.
Sorry, you need to Log In to post a reply to this thread.