17.12.2011, 12:55
You cannot control the time interval between which the player sends data to the server. The fastest of them can be OnPlayerUpdate but still needs the player to send the update to the server. Try using a better script. The script you created is pointless. It checks the gTeam on every "if". Try this simpler code (Your code modified):
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!" );
}
}
return 1;
}