Well it has to be clientside, with this:
//#CLIENTSIDE
at the top, and then player.bombs--; should suffice to deplete bombs. Also...
The first if checks if the player's bombs are at 0, if they are, it returns and therefor stops the rest of the function from being executed.
PHP Code:
//#CLIENTSIDE
function onWeaponfired() {
if (player.bombs <= 0) return;
player.bombs--;
freezeplayer(.1);
setani("lay",null);
temp.layx = player.x - int(player.x/64)*64 + .5 + vecx(player.dir)*2;
temp.layy = player.y - int(player.y/64)*64 + 1 + vecy(player.dir)*2;
putbomb(1,layx,layy);
}