Max armor?

Ok if i do a code like this :


ply:SetArmor(ply:Armor() + 100) 

it will set the players health to current armor + 100 but the problem is if i example already have 200 armor and i use my points on this again it sets my armor to 45 because max armor in Source engine is 255. How can i prevent it to go over 255?

Do a check.


if ply:Armor() > 255 then etc etc end

Thanks i did this :


		if ply:Armor() >= 155 then
		ply:SetArmor( 255 )
		elseif ply:Armor() <= 154 then
		ply:SetArmor(ply:Armor() + 100)