check my 2 pms for some code examples, but I'll also address your question here as well:
you need some kind of 'check' (an 'if' script), either to prevent from subtracting into the negatives, or afterwards, to return the value back to '= 0', instead of leaving it in the negatives.
the easy one is to jsut return it to zero:
// you fire off your rounds already, getting: player.gun.rounds = -50
if (player.gun.rounds < 0) {
player.gun.rounds = 0
}
but, unfortunately, in using rounds (projectile~ranged combat), you got bit of other issues to deal with... it's not as simple as you liked (see my pm), due to the real life scenerio of it (well if you want it to have this complexity anyways).
since your 'rounds' is your damage, then your damage is going to messed up, as you shot off more rounds than you have, thus doing more damage than you practically can do so, obviously. No magical extra bullets doing magical extra damage, lol.
-----------
orc: 10 HP
player: 1 round (or: 9 rounds)
if: 1 round = 5 damage (or if: 1 round = 1 damage)
then: you can't be shooting off more rounds than 1 (or 9), going into negative rounds
as: you would kill the orc, which you shouldn't be able to do so with only 1 round (or 9 rounds).
---------
unlike melee combat (unless you have 'durability' ~ breakable weapons, or 'fatigue' from swinging the heavy melee weapon), a 'round' is BOTH the number of times you can hit the monster AND determines the damage you do to the monster as well (either as: 1 round = 5 damage or 1 round = 1 damage)