Bug OnPlayerTakeDamage
#1

PHP код:
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?
Reply
#2

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.
Reply
#3

Checked on an AK-47 and M4 - works.
Okey.Topic - closed.
Reply


Forum Jump:


Users browsing this thread: