Changing material of weapons?

Well I’ve been working on a crysis suit mod all morning and have ran into a problem with the cloak suit…For the cloak suit all I do is change the material to one a bit more cloak-like…but the weapon doesn’t change.

I know changing weapon mat can be done easily…but I don’t want to actually have to edit the weapon. I would say just simply get the weapon then change the material but I want to be able to switch weapons and them all to stay that material.
So, if someone could teach me how to do this or show me how to do this it would be nice :stuck_out_tongue:

Btw the cloak suit, and all the other suits, are activated via console command…so it would have to be able to be added to the function for the con command

[editline]09:35PM[/editline]

Oh and also, side question how could I check if a player dies without using GM:DoPlayerDeath…or can that also be used outside of a Gamemode file?

For your second question what you’re looking for is hooks.

Using **[Hook.Add

http://wiki.garrysmod.com/favicon.ico](http://wiki.garrysmod.com/?title=Hook.Add)** you can use any gamemode hook anywhere in your code.

[editline]05:03PM[/editline]

Oh and LocalPlayer():GetViewModel() should give you the viewmodel entity the player uses, you can then simply change the material.

**[Player.GetViewModel

http://wiki.garrysmod.com/favicon.ico](http://wiki.garrysmod.com/?title=Player.GetViewModel)**

[editline]05:04PM[/editline]

And to detect when a player dies you should be using **[Gamemode.PlayerDeath

http://wiki.garrysmod.com/favicon.ico](wiki.garrysmod.com/?title=Gamemode.PlayerDeath)**.

You can’t change the textures of held weapons, for some reason. They only change texture when dropped. Instead, you need to draw over the weapon (With 3d2d) unless there is a method I missed.

Damn, so that totally eliminates the point of having cloak for now… Because I really do not feel like doing 3d2d ._.

Hmm well can you at least change the alpha of it? I guess not… Maybe you could strip that weapon from the player, spawn a new one with the right material and or color then give it to the player and have him switch to it?

I actually thought about that but I have been trying to get a crysis type quick menu working so I haven’t had time to test it.