ply:SetWeaponColor not letting me use Color, only Vector
6 replies, posted
I need to make a certain team's gun and player model almost invisible, I tried
[CODE]
ply:SetWeaponColor( Color(0,0,0,10))
ply:SetPlayerColor( Color(0,0,0,10) )
[/CODE]
But it's saying it was expecting a vector not a table,
Why does it change the color, but have to use a vector? it makes no sense.
That's not what these functions are for.
They change the player and physgun colors that you can customize in the Player Model Editor.
[QUOTE=Robotboy655;43588293]That's not what these functions are for.
They change the player and physgun colors that you can customize in the Player Model Editor.[/QUOTE]
Oh..., Well, what function does change the player model and weapon?
Entity:SetColor on both, the player and his weapon, usually Player:GetActiveWeapon()
[editline]19th January 2014[/editline]
Don't forget about RenderMode for transparency.
[QUOTE=Robotboy655;43588344]Entity:SetColor on both, the player and his weapon, usually Player:GetActiveWeapon()
[editline]19th January 2014[/editline]
Don't forget about RenderMode for transparency.[/QUOTE]
Okay, so I did all 10 render modes, only 6 and 10 actually do something to the player, which makes them completely invisible.
[url]http://wiki.garrysmod.com/page/Enums/RENDERMODE[/url]
Alternatively you can still use those functions but like this:
[code]
local pcol=Color(255,0,255)
local wcol=Color(255,255,0)
ply:SetPlayerColor(Vector(pcol.r, pcol.g, pcol.b)/255)
ply:SetWeaponColor(Vector(wcol.r, wcol.g, wcol.b)/255)
[/code]
It's a bit hacky but it'll work.
[editline]19th January 2014[/editline]
Oh sorry just realised you're wanting to change the alpha - the above won't work then for what you need.
[QUOTE=MattJeanes;43588617]Alternatively you can still use those functions but like this:
[code]
local pcol=Color(255,0,255)
local wcol=Color(255,255,0)
ply:SetPlayerColor(Vector(pcol.r, pcol.g, pcol.b)/255)
ply:SetWeaponColor(Vector(wcol.r, wcol.g, wcol.b)/255)
[/code]
It's a bit hacky but it'll work.
[editline]19th January 2014[/editline]
Oh sorry just realised you're wanting to change the alpha - the above won't work then for what you need.[/QUOTE]
I don't quite understand what this does, what's it meant to do?
EDIT:
Oh, yeah, I was confused on how that was gonna change alpha
[editline]19th January 2014[/editline]
God I'm an idiot, I was setting render mode AFTER entity color...
solved. thanks for the help :)
Sorry, you need to Log In to post a reply to this thread.