Don't allow 'give health 0' or even less.

Giving the player < -1 health and increasing it to something above 0
without closing the console breaks the player state.
This commit is contained in:
Yamagi Burmeister 2019-04-27 19:19:03 +02:00
parent eaaf6c43d4
commit 47520a0020
1 changed files with 2 additions and 1 deletions

View File

@ -230,6 +230,7 @@ Cmd_Give_f(edict_t *ent)
if (gi.argc() == 3) if (gi.argc() == 3)
{ {
ent->health = atoi(gi.argv(2)); ent->health = atoi(gi.argv(2));
ent->health = ent->health < 1 ? 1 : ent->health;
} }
else else
{ {