function Item::onPickup(%this,%item,%obj,%amount)
{
if(%obj.variable != 1){commandtoclient(%obj.client,'centerPrint',"\c5Variable not equal to 1.",2);return;}
if(!(%obj.variable2 > 10)){commandtoclient(%obj.client,'centerPrint',"\c5Variable2 not greater than 10.",2);return;}
Parent::onPickup(%this,%item,%obj,%amount);
}
You can either add that code as is, changing variable and variable2 for things you set, or replace "Item" with your weapon/tool's "GunItem", "RocketLauncherItem", etc name.