24.03.2013, 04:42
hello guys, i make a script antiteamkill.. look the code
but, its not work.. how to fix it ?
pawn Код:
new teamkill = 1;
public OnPlayerShootPlayer(Shooter,Target,Float:HealthLost,Float:ArmourLost)
{
if(teamkill == 1)
{
if ( Shooter != INVALID_PLAYER_ID )
{
if ( GetPlayerTeam( Target ) == GetPlayerTeam( Shooter ) ) // check if the victim is from the same team as the shooter.
{
new Float:hp;
GetPlayerHealth(Target, hp);
SetPlayerHealth(Target, hp + HealthLost);
SetPlayerHealth( Shooter, 0 );
}
}
}
return 1;
}
CMD:tm(playerid, params[])
{
if(admin[playerid] == 1)
{
if (!teamkill)
{
teamkill = 1;
SendClientMessageToAll(COLOR_LIGHTBLUE, "Teamkill enable by admin!");
}
else
{
teamkill = 0;
SendClientMessageToAll(COLOR_LIGHTBLUE, "Teamkill disable by admin!");
}
}
else
{
GameTextForPlayer(playerid, "~b~You Are Not Admin", 1000, 3);
}
return 1;
}