Invisible when you're standing still but not when you aren't.
9 replies, posted
So i'm making a swep and I need it so your alpha is 10 when you aren't moving, and 255 when you are. I got this but all it does is make everyone invisible.
[lua] if self.Owner:GetVelocity():Length() == 0 then
self.Owner:SetColor(255, 255, 10)
else
self.Owner:SetColor(255, 255, 255)
end
end[/lua]
also, if you could make the weapon have an alpha of 10 when you don't move aswell. help is appreciated.
Why it would make everyone invisible, I don't know - SetColor( red, green, blua, alpha ) is the proper syntax. You're setting the player's blue to 10.
you missed a 255.
255,255,255,10 and 255,255,255,255.
[editline]12:07PM[/editline]
[QUOTE=Disseminate;19482799]Why it would make everyone invisible, I don't know.[/QUOTE]
The missing alpha value defaults to 0.
yeah, but it does it for everyone.. I'm putting it in my swep in the SWEP.Think() area, why is it doing this :/
[editline]01:25AM[/editline]
it needs to work for one person and only work when you aren't moving
[QUOTE=Lexic;19482804]The missing alpha value defaults to 0.[/QUOTE]
Alpha values default to 255.
Ignore my error at the top of the thread, it was 255 255 255 10. but I copied the wrong version to the thread.
-snip-
[QUOTE=NullPoint;19482996]Alpha values default to 255.[/QUOTE]
They never do when I miss a 255. :saddowns: