OnPlayerTakeDamage.
#1

Hi,

Код:
public OnPlayerTakeDamage(playerid, issuerid, Float:amount, weaponid)
{
if( issuerid != INVALID_PLAYER_ID )
{
GetPlayerHealth( playerid, HealthSave[ issuerid ] );
SetPlayerHealth( playerid, HealthSave[ issuerid ]-floatround( LEVEL[ issuerid ]/2 )  );
}
return 1;
}
Whats bad in this code? when i shoot to player he is invinsible? player level is 1.
Reply
#2

That code makes it so when a player takes damage and the person who caused the damage is not an invalid player, it will heal the person who took damage.

So that'd be why.
Reply
#3

But how it can plus (+) health player if i minus (-) health?

Код:
SetPlayerHealth( playerid, HealthSave[ issuerid ]    ( HERE   -floatround( LEVEL[ issuerid ]/2 )  );
Reply
#4

You're setting the persons health to the shooters health minus 1.. every shot, so you're always just setting his health.
Reply
#5

Ok then how i have to do, i want when i shoot to another player that player will lose hp that how much is my level ( LEVEL variable ) divide by 2.
Reply
#6

Well, its probably working.. but each shot is only taking 1 health away.. so you wont really notice it.. try and set your level to like 20 and then see.
Reply
#7

But my code is not working. When i shoot to another player he get health i can't kill him, when i remove this code all is well.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)