Bugged message.
#1

Hi!
I got one issue so we test infection message when you explode and near player should get infected and send message how much player i infect, bat its bugged so look.

So its should send "You infect 1 player" something like this bat idk why its shows and you infect player 2 its just bugged. My code
Код:
    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)
	{
	new zmstring2[256],pNames[MAX_PLAYER_NAME];
	infectedcount++;
    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);
	}
What wrong with it?
Reply
#2

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=0i<MAX_PLAYERSi++)
                    {
                        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);
                }
            }
        }
    } 
Reply
#3

Quote:
Originally Posted by Mic_H
Посмотреть сообщение
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=0i<MAX_PLAYERSi++)
                    {
                        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);
                }
            }
        }
    } 
error 017: undefined symbol "i"
Line: InfectPlayerStandard(i);
Reply
#4

Bump
Reply
#5

Bump
Reply
#6

Any help how should i fix this error
Код:
error 017: undefined symbol "i"
Reply
#7

Код:
 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++; 
                                InfectPlayerStandard(i);
                                //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];         
                   
                    GetPlayerName(playerid,pNames,sizeof(pNames)); 
                    format(zmstring2,sizeof(zmstring2),""COL_GREEN"%s has been infected "COL_WHITE"%i players.",pNames,infectedcount); 
                    SendClientMessageToAll(-1,zmstring2); 
                } 
            } 
        } 
    }
Reply
#8

Quote:
Originally Posted by ThatFag
Посмотреть сообщение
Код:
 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++; 
                                InfectPlayerStandard(i);
                                //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];         
                   
                    GetPlayerName(playerid,pNames,sizeof(pNames)); 
                    format(zmstring2,sizeof(zmstring2),""COL_GREEN"%s has been infected "COL_WHITE"%i players.",pNames,infectedcount); 
                    SendClientMessageToAll(-1,zmstring2); 
                } 
            } 
        } 
    }
Well before this i remake to InfectPlayerStandard(playerid); and i saw that, this message sends every time i explode me self without infect any player. Like i play alone press alt and explode me self its send Name_Name has been infected 1player, bat maybe it was me fault because i changed InfectPlayerStandard(i); to InfectPlayerStandard(playerid); bat anyway i will test it now, how does it work.
Reply
#9

P.S i test it alone its shows message without any reason if i explode myself. I think its count myself destruction thats why its shows always 1 . Its should count only targets who i infected with this explosion.
Reply
#10

Quote:
Originally Posted by Mic_H
Посмотреть сообщение
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=0i<MAX_PLAYERSi++)
                    {
                        if(
IsPlayerInRangeOfPoint(i,7.0,Float:x,Float:y,Float:z))
                        {
                            if(
pInfo[i][IsPlayerInfected] == 0)
                            {
                                
infectedcount++;        
                                
InfectPlayerStandard(i);
                                
//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];
                    
GetPlayerName(playerid,pNames,sizeof(pNames));
                    
format(zmstring2,sizeof(zmstring2),""COL_GREEN"%s has been infected "COL_WHITE"%i players.",pNames,infectedcount);
                    
SendClientMessageToAll(-1,zmstring2);
                }
            }
        }
    } 
Try this.. You gotta try to fix the error. That happened because the line was supposed to be in For-Loop but I accidently moved it under it.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)