GetActiveWeapon() ?

Uhm. I want to make a if.
When the player has a physcannon it returns end
i tried:
client = client or LocalPlayer( );
local waffe = client:GetActiveWeapon()
if(waffe == ‘Weapon [33]’ ) then return; end

But does not work.
please Help.

if LocalPlayer():GetActiveWeapon():GetClass() == “weapon_physcannon” then return end

I might be wrong on the name “weapon_physcannon” you will have to check that.

also need to put a check if the active weapon is valid or youll get spam when the player dies (found that out the hard way :confused: )

me = LocalPlayer()
if me:GetActiveWeapon():IsValid() && me:GetActiveWeapon():GetPrintName() == “PHYSICS GUN” then return end

No that does not Work. I need it for a Hud. I made a RoundedBox and width by the Ammo from the Player.
But every Gun have other Clips. So i have to multiply many times and so on. Thats The reason why i Need it.
And the Both codes Above does not work.
Is there a Function the gives out the Maximal Ammo or sth?


[lua]local Player = LocalPlayer();
local Weapon = Player:GetActiveWeapon();
if( Weapon:IsValid() && Weapon:GetClass() == “weapon_physcannon” ) then
Player:ChatPrint( “I have a Gravity Gun!” );

Hey. Thank you for your help. 5 Minutes after your Post. (I Copied the Ifs ,if by if)
When i was ready, i found a much easier way.
if( Weapon:IsValid() && Weapon:GetClass() == “weapon_smg1” ) then
max = 45
local prim = client:GetActiveWeapon():Clip1()
test = 200 / max
test2= prim * test
and the rounded box get the width of test2. yay, that works now.
or you can make it like that. ( I tooked my Calculator and entered 200 / the Max CLip Size of the gun.
if( Weapon:IsValid() && Weapon:GetClass() == “weapon_smg1” ) then
ammo = prim * 4.4444444444444444444444444444444

the is sure the Easier way :smiley:
But i have a Problem, that doe snot looks good :smiley:
When i got the SMG and a clipsize of 2 or 1, the both Sides of the rounded Box, are uhm… my english is bad… when it looks like that with full magazin (-----------------) with 1 or 2 |)(| So… please help :smiley: