also you could/should carry the PANEL param too,

Code:
function create_entity1(var button_number, PANEL panel_id)
{
   switch(button_number){
      case 1: //button 1
         //do
      break;

      case 2: //button 2
         //do
      break;

      default: //all other buttons not already caught
      break
   }
}

hope this helps