GetActiveWeapon() ?

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

[/lua]
But does not work.
please Help.
greetings

[lua]
if LocalPlayer():GetActiveWeapon():GetClass() == “weapon_physcannon” then return end
[/lua]

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: )

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

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?

/push

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

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.
[lua]
if( Weapon:IsValid() && Weapon:GetClass() == “weapon_smg1” ) then
max = 45
end
local prim = client:GetActiveWeapon():Clip1()
test = 200 / max
test2= prim * test
[/lua]
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.
[lua]
if( Weapon:IsValid() && Weapon:GetClass() == “weapon_smg1” ) then
ammo = prim * 4.4444444444444444444444444444444
end
[/lua]

the 1.st 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: