try using pan_create
I've done it in liteC and I think it should work in c_script:
panel game_panel;
string panelDefinition = "";
inside some function:
str_cpy(panelDefinition,"bmap= main_panel;flags = VISIBLE, OVERLAY;digits (58, 560, 5, digi_font, 1, health);");
if(weapon1.visible == on)
{
str_cat(panelDefinition,"digits (620, 560, 5, digi_font, 1, current_ammo);");
}
game_panel = pan_create(panelDefinition,10);
If it doesn't work (I'm not sure about the "panel gamepanel;" line)you can always just make two panels and switch the second one on and of depending on weapon1.visible.