18.10.2012, 17:16
I've a problem with my headshot system.
I can kill players even if they're in my team!
How i can fix this? It's annoying.
In the death chat the player dies without a killer.
I've anti team kill protection but with this headshot thing, if i aim at head at a player that is in my team, he gets killed.
I need to remove that
OnPlayerDeath:
As you can see, i added a gTeam check but doesn't work.
I can kill players even if they're in my team!
How i can fix this? It's annoying.
In the death chat the player dies without a killer.
I've anti team kill protection but with this headshot thing, if i aim at head at a player that is in my team, he gets killed.
I need to remove that
pawn Код:
public CheckHeadShot()
{
new index;
for(new playerid; playerid < maxPlayers; playerid++)
{
if(IsPlayerConnected(playerid))
{
index = GetPlayerAnimationIndex(playerid);
if(index == 1173 || index == 1175 || index == 1177 || index == 1178)
{
SetPVarInt(playerid, "Headshotted", 1);
SetPlayerHealth(playerid, 0);
}
}
}
return 1;
}
pawn Код:
if(GetPVarInt(playerid, "Headshotted") == 1)
{
if (gTeam[playerid] == gTeam[killerid]) return 0;
SetPVarInt(playerid, "Headshotted", 0);
GameTextForPlayer(playerid, "~w~Head~r~shot!", 3000, 3);
GameTextForPlayer(killerid, "~w~Head~r~shot!", 3000, 3);
PlayerInfo[playerid][pHsReceived] ++;
PlayerInfo[killerid][pHsMade] ++;
}