• Custom weapon skins
    2 replies, posted
Hello, I want to use custom weapon skins. It should be the following: - People can buy a deagle skin in pointshop - They equip this pointshop item - They equip a weapon and get this new weapon skin I tried to write a function in the deagle script but the world model of the deagle looks very wired, also if you equip a deagle you get a normal usp skin and this error [ERROR] gamemodes/terrortown/entities/weapons/weapon_zm_revolver.lua:163: attempt to index global 'SWEP' (a nil value) Here is the important part: function SWEP:Equip(ply) if ply:PS_HasItem('deagle') then SWEP.ViewModel = "models/weapons/v_pist_deagon.mdl" SWEP.WorldModel = "models/weapons/w_pist_deagon.mdl" else SWEP.ViewModel = "models/weapons/cstrike/c_pist_deagle.mdl" SWEP.WorldModel = "models/weapons/w_pist_deagle.mdl" end end It is not possible to use this function like I did?
SWEP is an initiator variable, kind of like GM. They're only used on game-mode startup. Change SWEP inside of any functions to self, so self.ViewModel, etc... Although you shouldn't need to set the view-model every time someone equips the weapon ( there are fallbacks for CSS models too, so if a client doesn't have them, they'll automatically use a lower-quality model ).
Ah okay it works if I switch the SWEP to self, thank you. I will mark this thread as solved =)
Sorry, you need to Log In to post a reply to this thread.