07.06.2012, 19:44
Had problems with this all day, really need this fixed.
For some reason it ignores the fact that the other player is the enemy and heals them as well.
pawn Код:
public MedicTimer()
{
foreach(Player, playerid)
{
if(IsPlayerConnected(playerid))
{
if(PlayerInfo[playerid][Medic] == 1 && PlayerInfo[playerid][Army] == 1)
{
new Float:x, Float:y, Float:z;
GetPlayerPos(playerid, x, y, z);
foreach(Player, i)
{
if(IsPlayerConnected(i) && i != playerid)
{
if(IsPlayerInRangeOfPoint(i, 1.0, x, y, z))
{
new Float:health;
GetPlayerHealth(i, health);
if(health < 100.0)
{
SetPlayerHealth(i, 100.0);
SendClientMessage(i, COLOUR_GREEN, "HEALED" );
SendClientMessage(i, COLOUR_GREEN, "Thank the medic, who risked his life to save yours!" );
return 1;
}
}
if(PlayerInfo[i][Enemy] == 1 || PlayerInfo[i][Medic] == 1)
{
return 0;
}
}
}
}
}
}
}