Hey, I'm trying to change the way a weapon works, but I know nothing about coding. What I'm trying to change is that, when the weapon is equipped, the player and the gun become invisible. I want them to stay visible.
Within the code, there's a "deploy" section. I'll assume that's what I want, and the code looks like this:
[code]function SWEP:Deploy()
if (SERVER) then
self.Owner:SetMaterial("sprites/heatwave")
self.Weapon:SetMaterial("sprites/heatwave")
self.Owner:Fire("addoutput", "rendermode 11", 0)
self.Weapon:Fire("alpha", 0, 0)
self.Owner:Fire("alpha", 0, 0)
self.Weapon:SetKeyValue("renderamt", "0")
self.Owner:SetKeyValue("renderamt", "0")
end
return true
end[/code]I thought if I changed the set material part to something else, it'd change something, but it didn't seem to. Does anyone know what I can change to make the player and the weapon not invisible?
you could use [url]http://wiki.garrysmod.com/?title=Entity.SetColor[/url] and make the last value 0. you will want to make sure that on the holster function you restore them to full which is (255,255,255,255)
[lua]
function SWEP:Deploy()
self.Owner:SetColor(Color(0,0,0,0))
end
function SWEP:Holster()
self.Owner:SetColor(Color(255,255,255,255))
end
[/lua]
I dont know what the gun would be. I assumed it is just self. So you would just add the lines: self:SetColor(0,0,0,0) etc..
Alright, I got it working, thanks you guys.
Sorry, you need to Log In to post a reply to this thread.