OnPlayerGiveDamage
#1

Hi,

In this callback when i check damageid health i always get that health how much player have before hit? and then after some time, player health will be different?
Reply
#2

Code:
public OnPlayerGiveDamage(playerid, damagedid, Float: amount, weaponid, bodypart)
{
new Float:Health;
GetPlayerHealth(damagedid, Heath);
}
Situation:

I have 100 HP. Somebody shoot my with deagle and i have to lose 46 HP. When Callback will be called, health will be 100 or 54 (that, because 100-46).
Reply
#3

Your doing it all wrong.

damageid is the ID of the player shot/that took the damage. While, amount is the amount of health they loose.

According to SA-MP Wiki,
playerid The ID of the player that gave damage.
damagedid The ID of the player that received damage.
amount The amount of health/armour damagedid has lost (combined).
weaponid The reason that caused the damage.
bodypart The body part that was hit. (NOTE: This parameter was added in 0.3z. Leave it out if using an older version!)

wiki.sa-mp.com/wiki/OnPlayerGiveDamage
Reply
#4

new string[128], victim[MAX_PLAYER_NAME], attacker[MAX_PLAYER_NAME];
new weaponname[24];
GetPlayerName(playerid, attacker, sizeof (attacker));
GetPlayerName(damagedid, victim, sizeof (victim));

GetWeaponName(weaponid, weaponname, sizeof (weaponname));
format(string, sizeof(string), "%s has made %.0f damage to %s, weapon: %s", attacker, amount, victim, weaponname);
SendClientMessageToAll(0xFFFFFFFF, string);
Reply
#5

UP THREAD.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)