GMOD is a dead game and is full of wutever custom scripts/weapons/everything ...
Still most GMOD hacks uses the entity's class name for their Weapon ESP.
Example
This image has been resized. Click this bar to view the full image. The original image is sized 1216x268.
GMOD Weapon's real name ESP-c9150f6bc3f0a1959cc8b0347e886ff9-png
But that's disgusting, so please stop.
Instead, the class m4a1_chantico_fire will display M4A1's Chantico's Fire, which is what we see on HUD.
The solution is simple (known since 1936), we have the GetPrintName() method available on CBaseCombatWeapon class.
Just get it's virtual index and you are ok.
But that will work with "default" or imported weapons from Source games (like CSS's AK47).
After debugging, you will notice that your entity class becomes CWeaponSWEP for custom weapons/items.
https://wiki.garrysmod.com/page/Weapon/GetPrintNameThat class override CBaseCombatWeapon::GetPrintName()
So again, find its virtual index, and it's almost over !
Now, in your ESP loop, just check the entity class (is CBaseCombatWeapon or CWeaponSWEP) and cast accordingly, then call GetPrintName.
This image has been resized. Click this bar to view the full image. The original image is sized 865x94.
This image has been resized. Click this bar to view the full image. The original image is sized 700x886.
This image has been resized. Click this bar to view the full image. The original image is sized 1751x1084.