SetSubMaterial on weapon (world model)

How can I get the weapon of a player as entity? (w_model)
I want to be able to use SetSubMaterial() on the model.

GetActiveWeapon() did not work. :confused:

Thanks in advance

Heres how me and Tomelyr do it: https://github.com/Tomelyr/SkinShop/blob/master/lua/autorun/sh_skinshop.lua

Thank you very much!
It worked <3