Code:
	
	{$CLEO}
0000: handgun/heavyweapon switcher by ajom
const
    CURRENTWEAPONSLOT = 31@
  
    TRIGGERKEY = 69 // E key
end
CURRENTWEAPONSLOT = 3 // Default to handgun slot
while true
    wait 0
    if 0AB0:   key_pressed TRIGGERKEY
    then
        04B8: get_weapon_data_from_actor $PLAYER_ACTOR slot CURRENTWEAPONSLOT weapon 0@ ammo 1@ model 2@
        if 1@ > 0 // has bullets
        then
            01B9: set_actor $PLAYER_ACTOR armed_weapon_to 0@
            if CURRENTWEAPONSLOT == 3
            then CURRENTWEAPONSLOT = 8 // heavy weapon slot
            else CURRENTWEAPONSLOT = 3 // handgun weapon slot
            end
        end
        while 0AB0:   key_pressed TRIGGERKEY // anti key spam
            wait 0
        end
    end
end 
				 
 
		