17.12.2015, 20:32
Hello, I had very important question on a damaga. It is possible to clean somehow standard damage completely? My functions not correctly work. Tazer, shouldn't cause a loss in general, but at first the standard loss from the weapon is taken away, and then quickly restores value health. Sometimes, isn't in time. And if at the player about 10 health, he in general kills him. Question: how to disconnect a standard loss? That only my functions worked, whether there is any way? I want to make approximate function of a loss as on the LS-RP project. Thanks!
OnPlayerShootPlayer
PHP код:
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;
}
PHP код:
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;
}