Posts: 737
Threads: 338
Joined: Jan 2013
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?
Posts: 737
Threads: 338
Joined: Jan 2013
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).
Posts: 3,133
Threads: 71
Joined: Dec 2013
Reputation:
0
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
Posts: 737
Threads: 338
Joined: Jan 2013
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);
Posts: 737
Threads: 338
Joined: Jan 2013