mirror of
https://github.com/alliedmodders/amxmodx.git
synced 2024-12-25 06:15:37 +03:00
Fix user_slap/amx_slap unexpected behavior using large negative damage (bug 4975, r=joropito)
Former-commit-id: 1e4d0e216e
This commit is contained in:
parent
38fb271c83
commit
17a8e7f56e
@ -1540,8 +1540,12 @@ static cell AMX_NATIVE_CALL user_slap(AMX *amx, cell *params) /* 2 param */
|
|||||||
|
|
||||||
if (index < 1 || index > gpGlobals->maxClients)
|
if (index < 1 || index > gpGlobals->maxClients)
|
||||||
return 0;
|
return 0;
|
||||||
|
|
||||||
int power = abs((int)params[2]);
|
int power = (int)params[2];
|
||||||
|
|
||||||
|
if (power < 0)
|
||||||
|
power = 0;
|
||||||
|
|
||||||
CPlayer* pPlayer = GET_PLAYER_POINTER_I(index);
|
CPlayer* pPlayer = GET_PLAYER_POINTER_I(index);
|
||||||
|
|
||||||
if (pPlayer->ingame && pPlayer->IsAlive())
|
if (pPlayer->ingame && pPlayer->IsAlive())
|
||||||
|
@ -605,7 +605,7 @@ public cmdSlap(id, level, cid)
|
|||||||
|
|
||||||
read_argv(2, spower, 31)
|
read_argv(2, spower, 31)
|
||||||
|
|
||||||
new damage = str_to_num(spower)
|
new damage = clamp( str_to_num(spower), 0)
|
||||||
|
|
||||||
user_slap(player, damage)
|
user_slap(player, damage)
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user