OnPlayerTakeDamage.
#1

Hi,

Код:
public OnPlayerTakeDamage(playerid, issuerid, Float:amount, weaponid)
{
	if( issuerid == playerid)
	{
	            GetPlayerHealth( playerid, HealthSave[ playerid ] );
		    SetPlayerHealth( playerid, HealthSave[ playerid ]+amount );
	}
        return 1;
}
I want to do if player take damage from his self ex: fall down from house. Then player will get his lose hp. Is it work?

Sorry for my bad english.
Reply
#2

try this

pawn Код:
public OnPlayerTakeDamage(playerid, issuerid, Float:amount, weaponid)
{
    if( issuerid == INVALID_PLAYER_ID)
    {
                GetPlayerHealth( playerid, HealthSave[ playerid ] );
            SetPlayerHealth( playerid, HealthSave[ playerid ]+amount );
    }
        return 1;
}
Reply
#3

Thanks i will try. Please test it if you can.
Reply
#4

It's
PHP код:
if(issuerid != INVALID_PLAYER_ID
Reply
#5

pawn Код:
if(issuerid == playerid)
IS not possible. do what Khaled said.
Reply
#6

Never mind.
Reply
#7

Код:
if(issuerid != INVALID_PLAYER_ID)
if i use this, when i do damage to myself it will this callback will be called (OnPlayerTakeDamage) and this check will work?
Reply
#8

How will you "damage" yourself?
you cannot shoot yourself, by falling and vehicle collision I think it's auto.
Reply
#9

if(issuerid == INVALID_PLAYER_ID)

use this .... if there is no valid issuerid it will read the code below this line.
Reply
#10

EV007, IT IS !=

if you wantt it if NO VALID, then put the freakin !=
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)