PHP код:
if(PRESSED(KEY_WALK))
{
new infectedcount;
if(team[playerid] == TEAM_ZOMBIE)
{
if(pInfo[playerid][pZombieClass] == ADVANCEDBOOMER)
{
if(IsPlayerInRangeOfPoint(playerid,8.0,Map[ZombieSpawnX],Map[ZombieSpawnY],Map[ZombieSpawnZ]))
{
GameTextForPlayer(playerid,"~r~You cant explode yourself near zombie spawn!",4000,5);
}
else
{
new Float:x,Float:y,Float:z;
GetPlayerPos(playerid,Float:x,Float:y,Float:z);
SetPlayerHealth(playerid,0.0);
CreateExplosion(Float:x,Float:y,Float:z,0,6.0);
for(new i=0; i<MAX_PLAYERS; i++)
{
if(IsPlayerInRangeOfPoint(i,7.0,Float:x,Float:y,Float:z))
{
if(pInfo[i][IsPlayerInfected] == 0)
{
infectedcount++;
//It was bugged because you added it inside the forloop.. while the "InfectedCount". was still being counted.
//Show it after the for(loop)
}
}
}
//Like this
new zmstring2[256],pNames[MAX_PLAYER_NAME];
InfectPlayerStandard(i);
GetPlayerName(playerid,pNames,sizeof(pNames));
format(zmstring2,sizeof(zmstring2),""COL_GREEN"%s has been infected "COL_WHITE"%i players.",pNames,infectedcount);
SendClientMessageToAll(-1,zmstring2);
}
}
}
}