17.12.2011, 12:44
pawn Код:
public OnPlayerShootPlayer(Shooter,Target,Float:HealthLost,Float:ArmourLost)
{
if ( Shooter != INVALID_PLAYER_ID )
{
if ( gTeam[Target] == gTeam[Shooter] ) // check if the victim is from the same team as the shooter.
{
new Float:hp;
new Float:ap;
GetPlayerHealth(Target, hp);
SetPlayerHealth(Target, hp + HealthLost);
GetPlayerArmour(Target, ap);
SetPlayerArmour(Target, ap + ArmourLost);
SendClientMessage( Shooter, COLOR_RED, "Team killing is not allowed!" );
}
if ( gTeam[Target] == TEAM_INDIA && gTeam[Shooter] == TEAM_INDPM ) // check if the victim is from the same team as the shooter.
{
new Float:hp;
new Float:ap;
GetPlayerHealth(Target, hp);
SetPlayerHealth(Target, hp + HealthLost);
GetPlayerArmour(Target, ap);
SetPlayerArmour(Target, ap + ArmourLost);
SendClientMessage( Shooter, COLOR_RED, "Team killing is not allowed!" );
}
if ( gTeam[Target] == TEAM_INDPM && gTeam[Shooter] == TEAM_INDIA ) // check if the victim is from the same team as the shooter.
{
new Float:hp;
new Float:ap;
GetPlayerHealth(Target, hp);
SetPlayerHealth(Target, hp + HealthLost);
GetPlayerArmour(Target, ap);
SetPlayerArmour(Target, ap + ArmourLost);
SendClientMessage( Shooter, COLOR_RED, "Team killing is not allowed!" );
}
if ( gTeam[Target] == TEAM_USA && gTeam[Shooter] == TEAM_USPM ) // check if the victim is from the same team as the shooter.
{
new Float:hp;
new Float:ap;
GetPlayerHealth(Target, hp);
SetPlayerHealth(Target, hp + HealthLost);
GetPlayerArmour(Target, ap);
SetPlayerArmour(Target, ap + ArmourLost);
SendClientMessage( Shooter, COLOR_RED, "Team killing is not allowed!" );
}
if ( gTeam[Target] == TEAM_USPM && gTeam[Shooter] == TEAM_USA ) // check if the victim is from the same team as the shooter.
{
new Float:hp;
new Float:ap;
GetPlayerHealth(Target, hp);
SetPlayerHealth(Target, hp + HealthLost);
GetPlayerArmour(Target, ap);
SetPlayerArmour(Target, ap + ArmourLost);
SendClientMessage( Shooter, COLOR_RED, "Team killing is not allowed!" );
}
if ( gTeam[Target] == TEAM_RUSSIA && gTeam[Shooter] == TEAM_RUSPM ) // check if the victim is from the same team as the shooter.
{
new Float:hp;
new Float:ap;
GetPlayerHealth(Target, hp);
SetPlayerHealth(Target, hp + HealthLost);
GetPlayerArmour(Target, ap);
SetPlayerArmour(Target, ap + ArmourLost);
SendClientMessage( Shooter, COLOR_RED, "Team killing is not allowed!" );
}
if ( gTeam[Target] == TEAM_RUSPM && gTeam[Shooter] == TEAM_RUSSIA ) // check if the victim is from the same team as the shooter.
{
new Float:hp;
new Float:ap;
GetPlayerHealth(Target, hp);
SetPlayerHealth(Target, hp + HealthLost);
GetPlayerArmour(Target, ap);
SetPlayerArmour(Target, ap + ArmourLost);
SendClientMessage( Shooter, COLOR_RED, "Team killing is not allowed!" );
}
if ( gTeam[Target] == TEAM_PAK && gTeam[Shooter] == TEAM_PAKPM ) // check if the victim is from the same team as the shooter.
{
new Float:hp;
new Float:ap;
GetPlayerHealth(Target, hp);
SetPlayerHealth(Target, hp + HealthLost);
GetPlayerArmour(Target, ap);
SetPlayerArmour(Target, ap + ArmourLost);
SendClientMessage( Shooter, COLOR_RED, "Team killing is not allowed!" );
}
if ( gTeam[Target] == TEAM_PAKPM && gTeam[Shooter] == TEAM_PAK ) // check if the victim is from the same team as the shooter.
{
new Float:hp;
new Float:ap;
GetPlayerHealth(Target, hp);
SetPlayerHealth(Target, hp + HealthLost);
GetPlayerArmour(Target, ap);
SetPlayerArmour(Target, ap + ArmourLost);
SendClientMessage( Shooter, COLOR_RED, "Team killing is not allowed!" );
}
if ( gTeam[Target] == TEAM_UK && gTeam[Shooter] == TEAM_UKPM ) // check if the victim is from the same team as the shooter.
{
new Float:hp;
new Float:ap;
GetPlayerHealth(Target, hp);
SetPlayerHealth(Target, hp + HealthLost);
GetPlayerArmour(Target, ap);
SetPlayerArmour(Target, ap + ArmourLost);
SendClientMessage( Shooter, COLOR_RED, "Team killing is not allowed!" );
}
if ( gTeam[Target] == TEAM_UKPM && gTeam[Shooter] == TEAM_UK ) // check if the victim is from the same team as the shooter.
{
new Float:hp;
new Float:ap;
GetPlayerHealth(Target, hp);
SetPlayerHealth(Target, hp + HealthLost);
GetPlayerArmour(Target, ap);
SetPlayerArmour(Target, ap + ArmourLost);
SendClientMessage( Shooter, COLOR_RED, "Team killing is not allowed!" );
}
}
return 1;
}
The Bug is the lag/delay. When a Player shoots his own team mate The function gets the curr health and restores it with the HealthLost function. But if a player continuously shoots the team mate , Due to the lag the health restoration gets reduced then more and then more , The person dies due to Team Kill again!.
It's not that fast as it shud work.. I need a fast and relaible anti kill! Someone please help me to fix the code.
Is there anything i can do!?