Code:
cs_add_weapon_ammo( id, weapon, amt=1 )
{
if( is_user_alive( id ) )
{
new bad_weapons_bitsum = ( ( 1 << CSW_KNIFE ) | ( 1 << CSW_HEGRENADE ) | ( 1 << CSW_FLASHBANG ) | ( 1 << CSW_SMOKEGRENADE ) | ( 1 << 2 ) )
if( !( ( 1 << weapon ) & bad_weapons_bitsum ) )
{
new wname[20]
get_weaponname( weapon, wname, 19 )
new iWep = find_ent_by_owner( iWep, wname, id, 0 )
if( iWep )
{
cs_set_weapon_ammo( iWep, cs_get_weapon_ammo( iWep ) + amt )
return iWep;
}
}
}
return 0;
}
// Usage Example
cs_add_weapon_ammo( id, CSW_DEAGLE, 2 )
cs_add_weapon_ammo( id, CSW_AWP, 1 )
__________________