Anti team kill delay problem!!(rep+)
#1

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;
}
This is my Anti Team kill function made with the help of OSPS!
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!?
Reply


Messages In This Thread
Anti team kill delay problem!!(rep+) - by Ballu Miaa - 17.12.2011, 12:44
Re: Anti team kill delay problem!!(rep+) - by Mrki_Drakula - 17.12.2011, 12:51
Re: Anti team kill delay problem!!(rep+) - by wildcookie007 - 17.12.2011, 12:51
Re: Anti team kill delay problem!!(rep+) - by kizla - 17.12.2011, 12:52
Re: Anti team kill delay problem!!(rep+) - by Ballu Miaa - 17.12.2011, 12:53
Re: Anti team kill delay problem!!(rep+) - by suhrab_mujeeb - 17.12.2011, 12:55
Re: Anti team kill delay problem!!(rep+) - by Ballu Miaa - 17.12.2011, 12:55
Re: Anti team kill delay problem!!(rep+) - by Ballu Miaa - 17.12.2011, 12:59
Re: Anti team kill delay problem!!(rep+) - by [ABK]Antonio - 17.12.2011, 13:16
Re: Anti team kill delay problem!!(rep+) - by kizla - 17.12.2011, 20:50

Forum Jump:


Users browsing this thread: 3 Guest(s)