View Full Version : Bug OnPlayerTakeDamage

01/01/2012, 12:04 AM
public OnPlayerTakeDamage(playerid, issuerid, Float:amount, weaponid)
if(issuerid != INVALID_PLAYER_ID)
new rand = 10 + random(10);
new Float:health;
GetPlayerHealth(playerid, health);
if(weaponid == 24) SetPlayerHealth(playerid,health-rand);
if(weaponid == 22) SetPlayerHealth(playerid,health-rand);
return 1;

That is done like this, but the effect is not so, it takes hp, but then adds back.
What is wrong?

01/01/2012, 12:32 AM
This script does:

if the player takes damage from a real person, and weapon is ID 24/22, Set their health to CURRENT HEALTH-(Random(0-9)+10)

Let's say random becomes 8, the player will lose 18 health. Possible outcomes of random: 0-9 (maximum value is never counted)

I have no clue what you needed help with, I just responded by telling you what the script you have provided actually does.

01/01/2012, 12:50 AM
Checked on an AK-47 and M4 - works.
Okey.Topic - closed.