How to work "Physgun_drawbeam" (hiding menu)

Hello,i wonna know how work the cvar “physgun_drawbeam”,i wonna know that for do a addon

And how to do for change the material of that