PDA

View Full Version : Bug OnPlayerTakeDamage


Dima_Tkach
31/12/2011, 11:04 PM
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?

coole210
31/12/2011, 11:32 PM
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.

Dima_Tkach
31/12/2011, 11:50 PM
Checked on an AK-47 and M4 - works.
Okey.Topic - closed.