I just made players invisible and removed their shadow. I was wondering is there a way I can make the weapons invisible as well?
Yes, you can make weapons invisible.
[editline]27th September 2013[/editline]
Actually you might want to use
Well I know how to use set color with players or props. But how do I set the color on what ever weapon the player is holding?
GetActiveWeapon returns the folder name of the entity.
local CurrentWeapon = ply:GetActiveWeapon():GetClass() CurrentWeapon:SetColor( Color( 255, 255, 255, 0 ) )
Don’t call :GetClass()
I am working on a cloaking gadget, I can make my current weapon I’m holding invisible when I hit PrimaryAttack but not the weapons you switch to after that. I have this in the SWEP:PrimaryAttack
timer.Create( "InvisibleWeapons", .1, 0, function() local CurrentWeapon = self.Owner:GetActiveWeapon() CurrentWeapon:SetColor( Color( 255, 255, 255, 0 ) ) print( CurrentWeapon ) end)
Loop through all player weapons and hide them. Player:GetWeapons
Sorry to be an idiot but I am getting this error:
[ERROR] Line 3: bad argument #1 to ‘GetWeapon’ (string expected, got no value)
timer.Create( "InvisibleWeapons", .1, 0, function() for k,v in pairs(self.Owner:GetWeapon()) do v:SetColor( Color( 255, 255, 255, 0 ) ) end end)
You need an s
Well it fixed the error, but now it just does nothing from what i can tell. Any ideas?
Just changing the alpha doesn’t actually work.
You would also have to make sure the rendering mode is set to allow alpha. But, it gets reset every frame so it would just be best to change the material to one that is invisible or do something else.
SetRenderMode is not reset every frame. It is permanent until changed.
Try using ent:SetNoDraw(true)
I used v:SetRenderMode( RENDERMODE_TRANSALPHA )
I should have known that but you know how it is when you have been looking at code for an extended period of time :p.
Thanks for the help everyone