Why its send two times (ONPLAYERDEATH)
#1

Hi
this message duplicate if i infect anyone. It's sending two times.
Код:
    if(teams[playerid] == TEAM_ZOMBIE)
    {
    if(pInfo[playerid][pZombieClass] == BOOMERZOMBIE)
    {
    new explodecount;
    GetPlayerPos(playerid,Float:x,Float:y,Float:z);
    CreateExplosion(Float:x,Float:y,Float:z,0,6.0);
    foreach(new i : Player)
    {
    GetClosestPlayer(i);
    if(IsPlayerConnected(i))
    {
   	switch(GetPlayerSkin(i))
    {
    case NON_IMMUNE:
    {
    if(i == playerid) continue;
    if(IsPlayerInRangeOfPoint(i,7.0,Float:x,Float:y,Float:z))
    {
    if(pInfo[i][IsPlayerInfected] == 0)
    {
    InfectPlayerStandard(i);
    explodecount++;
    }
    }
    }
    }
    }
    }
    if(explodecount > 0)
    {
    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,explodecount);
    SendClientMessageToAll(-1,zmstring2);
    }
    }
    }
	}
Reply
#2

I would bet because you don't have a break; statement so that it just drops through and repeats the message since there's no default anyway.
Reply
#3

So should i add return?
Reply
#4

Quote:
Originally Posted by Pokemon64
Посмотреть сообщение
So should i add return?
PHP код:
break; 
not return
Reply
#5

Lol ok i will test it
Reply
#6

Please for the love of god INDENT!
Reply
#7

Indent your damn code, it hurts my eyes and makes me want to kill cute babies.
Reply
#8

Well you dont need to repeat all the time
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)