public OnPlayerTakeDamage(playerid, issuerid, Float:amount, weaponid, bodypart)
{
if(0 == weaponid && PlayerInfo[issuerid][pStrength] != 0)
{
new strength = PlayerInfo[issuerid][pStrength]*2;
GivePlayerHealth(playerid, -strength);
}
else if(1 == weaponid && PlayerInfo[issuerid][pStrength] != 0)
{
new strength = PlayerInfo[issuerid][pStrength]*3;
GivePlayerHealth(playerid, -strength);
}
else if((2 >= weaponid <= 15) && PlayerInfo[issuerid][pStrength] != 0)
{
new strength = PlayerInfo[issuerid][pStrength]*4;
GivePlayerHealth(playerid, -strength);
}
if((0 <= weaponid <= 46) || weaponid == 53)
{
PlayerInfo[playerid][pHits] ++;
if(BODY_PART_TORSOd <= bodypart <= BODY_PART_HEADd) Damage[playerid][(bodypart - 3)][weaponid]++;
if(bodypart == BODY_PART_LEFT_LEG || bodypart == BODY_PART_RIGHT_LEG) StartPlayerInjury(playerid);
}
if(PlayerIsWounded(playerid))
{
SetPlayerHealth(playerid, 25.0);
}
return 1;
}
public OnPlayerShootPlayer(Shooter,Target,Float:HealthLost,Float:ArmourLost)
{
new Float:armour;
GetPlayerArmour(Target, armour);
new weapon = GetWeaponHolding(Shooter);
if(PlayerHoldingWeapon(Shooter, 23) && TazerActive{Shooter})
{
if(!Tazed{Target})
{
GivePlayerHealth(Target, HealthLost);
SetPlayerArmour(Target, armour+ArmourLost);
FreezePlayer(Target);
OnPlayAnim(Target, "PARACHUTE", "FALL_skyDive_DIE", 4.0, 0, 0, 0, 1, 0);
Tazed{Target} = true;
SetTimerEx("SetUnTazed", 15000, false, "i", Target);
}
else
{
GivePlayerHealth(Target, HealthLost);
SetPlayerArmour(Target, armour+ArmourLost);
}
}
else if(PlayerHoldingWeapon(Shooter, 25) && RubberActive{Shooter})
{
if(!Tazed{Target})
{
GivePlayerHealth(Target, HealthLost);
SetPlayerArmour(Target, armour+ArmourLost);
FreezePlayer(Target);
OnPlayAnim(Target, "SWEET", "Sweet_injuredloop", 4.0, 1, 0, 0, 1, 0);
Tazed{Target} = true;
SetTimerEx("SetUnTazed", 30000, false, "i", Target);
}
else
{
GivePlayerHealth(Target, HealthLost);
SetPlayerArmour(Target, armour+ArmourLost);
}
}
else if(PlayerHoldingWeapon(Shooter, 41) && CopDuty{Shooter})
{
GivePlayerHealth(Target, HealthLost+0.5);
if(armour > 0)
{
SetPlayerArmour(Target, armour+ArmourLost+1.0);
}
}
else if(weapon == 24 || weapon == 30 || weapon == 31 || weapon == 34 || weapon == 25 || weapon == 29 || weapon == 28 || weapon == 32 || weapon == 33 || weapon == 34)
{
if(GetWorld(Shooter) == GetWorld(Target))
{
if(IsPlayerAimingTargetBodyPart(Shooter, Target, 1)) // BODY_PART_HEAD
{
DoDamage(Target, 1, GetPlayerWeapon(Shooter));
}
else if(IsPlayerAimingTargetBodyPart(Shooter, Target, 2)) // BODY_PART_TORSO
{
DoDamage(Target, 2, GetPlayerWeapon(Shooter));
}
else if(IsPlayerAimingTargetBodyPart(Shooter, Target, 3)) // BODY_PART_LEGS
{
DoDamage(Target, 3, GetPlayerWeapon(Shooter));
}
}
}
return 1;
}
public OnPlayerTakeDamage(playerid, issuerid, Float: amount, weaponid, bodypart) { if(issuerid != INVALID_PLAYER_ID && weaponid == 24 && bodypart == 3) { new Float:phealth; GetPlayerHealth(playerid, phealth); SetPlayerHealth(playerid, phealth-50); SendClientMessage(issuerid, COLOR_ORANGERED, "HIT: Torso (-50)"); } }
Consider using OnPlayerWeaponShoot instead
https://sampwiki.blast.hk/wiki/OnPlayerWeaponShot and disable native weapon damage between players. |
excuse, but you won't prompt as to disconnect a standard loss? At me many variables which aren't present in onplayerweaponshot are used in onplayershootplayer.
|