public OnPlayerGiveDamage(playerid, damagedid, Float:amount, weaponid, bodypart)
{
/* new abc_string[128];
format(abc_string, 128, "OnPlayerGiveDamage(%d, %d, %.2f, %d, %d)", playerid, damagedid, amount, weaponid, bodypart);
SendClientMessage(playerid, 0xFFFFFFFF, abc_string);
SendClientMessage(damagedid, 0xFFFFFFFF, abc_string);*/
print("Callback called.");
if(damagedid != INVALID_PLAYER_ID) // Check if the player taking the damage didn't just take damage from other sources
{
print("Damaged passed.");
if(bodypart == 9 && weaponid == 34) // Check if it was the head that was shot and he was also shot with a sniper.. change 34 to weapon of ur choice
{
print("Bodypart, weapon passed.");
if(GetPlayerState(damagedid) == PLAYER_STATE_SPAWNED) // Check if the player is actually spawned..
{
print("Spawn check passed.");
SetPlayerHealth(damagedid, 0.00); // Kill the player
GameTextForPlayer(playerid, "HEAD SHOT!", 1000, 2); // Just aesthetics
GameTextForPlayer(damagedid, "HEAD SHOT!", 1000, 2); // Just aesthetics
}
}
}
return 1;
}
public OnPlayerGiveDamage(playerid, damagedid, Float:amount, weaponid, bodypart)
{
/* new abc_string[128];
format(abc_string, 128, "OnPlayerGiveDamage(%d, %d, %.2f, %d, %d)", playerid, damagedid, amount, weaponid, bodypart);
SendClientMessage(playerid, 0xFFFFFFFF, abc_string);
SendClientMessage(damagedid, 0xFFFFFFFF, abc_string);*/
print("Callback called.");
if(damagedid != INVALID_PLAYER_ID) // Check if the player taking the damage didn't just take damage from other sources
{
print("Damaged passed.");
if(bodypart == 9 && weaponid == 34) // Check if it was the head that was shot and he was also shot with a sniper.. change 34 to weapon of ur choice
{
print("Bodypart, weapon passed.");
SetPlayerHealth(damagedid, 0.00); // Kill the player
GameTextForPlayer(playerid, "HEAD SHOT!", 1000, 2); // Just aesthetics
GameTextForPlayer(damagedid, "HEAD SHOT!", 1000, 2); // Just aesthetics
}
}
return 1;
}
public OnPlayerGiveDamage(playerid, damagedid, Float:amount, weaponid, bodypart)
{
new formatting[128];
format(formatting,128,"you just on bodypart ID: %d",bodypart);
SendClientMessage(playerid,-1,formatting);
return 1;
}
|
are u sure you're not using OnPlayerGiveDamage func in another code?
make sure and also check this. PHP код:
|