SendClientMessage problem - Spam.
#1

I did a system of war and when the war was over we put send you some messages. The problem is that they sent several times, and do not understand why you may know.

pawn Код:
function WarTimer()
{
    new string[100], string2[150];
    for(new i = 1; i < sizeof(Turfs); i++)
    {
        new attackers = WarInfo[i][wAttacker];
        new defenders = WarInfo[i][wFaction];
        if(WarInfo[i][wTime] >= 2)
        {
            foreach(Player,j)
            {
                if(WarInfo[i][wAttacker] == 5)
                {
                    GangZoneFlashForPlayer(j,Turfs[i], 0x00D9FAAA);
                }
                else if(WarInfo[i][wAttacker] == 6)
                {
                    GangZoneFlashForPlayer(j,Turfs[i], 0x666666AA);
                }
                else if(WarInfo[i][wAttacker] == 7)
                {
                    GangZoneFlashForPlayer(j,Turfs[i], 0x1EB500AA);
                }
                else if(WarInfo[i][wAttacker] == 8)
                {
                    GangZoneFlashForPlayer(j,Turfs[i], 0xCC00B4AA);
                }
            }
        }
        if(WarInfo[i][wTime] > 0)
        {
            WarInfo[i][wTime] -= 1;
            foreach(Player,j)
            {
                if(IsPlayerInTurf(j,i) == 1 || IsPlayerInTurf(j, i) == 0)
                {
                    if(PlayerInfo[j][pMember] == attackers)
                    {
                        WarScoreF[attackers][i] += 0.002;
                        if(Wartimeon[j] == 1)
                        {
                            format(string,sizeof(string),"~y~TURF TIMER: ~w~%s",CalculeazaTimp2(WarInfo[i][wTime]));
                            PlayerTextDrawSetString(j, TurfTimer[j], string);
                            PlayerTextDrawShow(j, TurfTimer[j]);
                            format(string, sizeof(string), "~y~Deaths: ~w~%d", decese[j][i]);
                            PlayerTextDrawSetString(j, DeathsWar[j], string);
                            PlayerTextDrawShow(j, DeathsWar[j]);
                            format(string, sizeof(string), "~y~Kills: ~w~%d", ucideri[j][i]);
                            PlayerTextDrawSetString(j, KillsWar[j], string);
                            PlayerTextDrawShow(j, KillsWar[j]);
                            format(string, sizeof(string), "~y~Turf ID: ~w~%d", i);
                            PlayerTextDrawSetString(j, TurfWar[j], string);
                            PlayerTextDrawShow(j, TurfWar[j]);
                        }
                    }
                    if(PlayerInfo[j][pMember] == defenders)
                    {
                        WarScoreF[defenders][i] += 0.002;
                        if(Wartimeon[j] == 1)
                        {
                            format(string,sizeof(string),"~y~TURF TIMER: ~w~%s",CalculeazaTimp2(WarInfo[i][wTime]));
                            PlayerTextDrawSetString(j, TurfTimer[j], string);
                            PlayerTextDrawShow(j, TurfTimer[j]);
                            format(string, sizeof(string), "~y~Deaths: ~w~%d", decese[j][i]);
                            PlayerTextDrawSetString(j, DeathsWar[j], string);
                            PlayerTextDrawShow(j, DeathsWar[j]);
                            format(string, sizeof(string), "~y~Kills: ~w~%d", ucideri[j][i]);
                            PlayerTextDrawSetString(j, KillsWar[j], string);
                            PlayerTextDrawShow(j, KillsWar[j]);
                            format(string, sizeof(string), "~y~Turf ID: ~w~%d", i);
                            PlayerTextDrawSetString(j, TurfWar[j], string);
                            PlayerTextDrawShow(j, TurfWar[j]);
                        }
                    }
                }
                else if(Wartimeon[j] == 1)
                {
                    PlayerTextDrawHide(j, TurfTimer[j]);
                    PlayerTextDrawHide(j, DeathsWar[j]);
                    PlayerTextDrawHide(j, KillsWar[j]);
                    PlayerTextDrawHide(j, TurfWar[j]);
                }
            }
            if(WarInfo[i][wTime] == 1)
            {
                new Float: atscore = 0.0;
                new Float: defscore = 0.0;
                atscore = WarScoreF[attackers][i];
                defscore = WarScoreF[defenders][i];
                   
                new winner;
                if(atscore > defscore)
                {
                    winner = 1;
                }
                else
                {
                    winner = 2;
                }
                new winbest;
                new winbestj = -1, losebestj = -1;
                new bestname1[25],bestname2[25],bestname[25],worstname[25];
                foreach(Player,j)
                {
                    if(winner == 1)
                    {
                        if(PlayerInfo[j][pMember] == attackers)
                        {
                            winbest = bestscoreat[i];
                            if(bestmemberat[i] != 999)
                            {
                                if(PlayerInfo[bestmemberat[i]][pMember] == attackers)
                                {
                                    winbestj = bestmemberat[i];
                                    GetPlayerName(winbestj,bestname1,sizeof(bestname1));
                                    strmid(bestname, bestname1, 0, strlen(bestname1), 255);
                                }
                            }
                            else
                            {
                                format(bestname,sizeof(bestname),"-");
                                strmid(bestname, bestname, 0, strlen(bestname), 255);
                            }
                        }
                        if(PlayerInfo[j][pMember] == defenders)
                        {
                            //losebest = worstscoredf[i];
                            if(worstmemberdf[i] != 999)
                            {
                                if(PlayerInfo[worstmemberdf[i]][pMember] == defenders)
                                {
                                    losebestj = worstmemberdf[i];
                                    GetPlayerName(losebestj,bestname2,sizeof(bestname2));
                                    strmid(worstname, bestname2, 0, strlen(bestname2), 255);
                                }
                            }
                            else
                            {
                                format(worstname,sizeof(worstname),"-");
                                strmid(worstname, worstname, 0, strlen(worstname), 255);
                            }
                        }
                    }
                    if(winner == 2)
                    {
                        if(PlayerInfo[j][pMember] == defenders)
                        {
                            winbest = bestscoredf[i];
                            if(bestmemberdf[i] != 999)
                            {
                                if(PlayerInfo[bestmemberdf[i]][pMember] == defenders)
                                {
                                    winbestj = bestmemberdf[i];
                                    GetPlayerName(winbestj,bestname1,sizeof(bestname1));
                                    strmid(bestname, bestname1, 0, strlen(bestname1), 255);
                                }
                            }
                            else
                            {
                                format(bestname,sizeof(bestname),"-");
                                strmid(bestname, bestname, 0, strlen(bestname), 255);
                            }
                        }
                        if(PlayerInfo[j][pMember] == attackers)
                        {
                            if(worstmemberat[i] != 999)
                            {
                                if(PlayerInfo[worstmemberat[i]][pMember] == attackers)
                                {
                                    losebestj = worstmemberat[i];
                                    GetPlayerName(losebestj,bestname2,sizeof(bestname2));
                                    strmid(worstname, bestname2, 0, strlen(bestname2), 255);
                                }
                            }
                            else
                            {
                                format(worstname,sizeof(worstname),"-");
                                strmid(worstname, worstname, 0, strlen(worstname), 255);
                            }
                        }
                    }
                }
                foreach(Player,j)
                {
                    if((PlayerInfo[j][pMember] == attackers) || (PlayerInfo[j][pMember] == defenders))
                    {
                        if(winner == 1)
                        {
                            TurfInfo[i][zOwned] = WarInfo[i][wAttacker];
                            Wartimeon[j] = 0;
                            PlayerTextDrawHide(j, TurfTimer[j]);
                            PlayerTextDrawHide(j, DeathsWar[j]);
                            PlayerTextDrawHide(j, KillsWar[j]);
                            PlayerTextDrawHide(j, TurfWar[j]);
                           
                            format(string2,sizeof(string2),"{008BC7}Razboi: {ffffff}%s a castigat zona %d. Scor final: %s %.1f - %.1f %s",NumeFactiune(WarInfo[i][wAttacker]), i, NumeFactiune(WarInfo[i][wAttacker]), atscore, defscore, NumeFactiune(WarInfo[i][wFaction]));
                            OOCNews(-1, string2);
                            format(string2,sizeof(string2),"{008BC7}Razboi: {ffffff}Cel mai bun gangster: %s ( %d Ucideri ) || Cel mai slab gangster: %s ( %d Decese )", bestname, winbest, worstname, worstscoreat[i]);
                            OOCNews(-1, string2);
                            format(string2,sizeof(string2),"{008BC7}Scorul tau: {ffffff}%d ( %d ucideri, %d decese )",ucideri[j][i] - decese[j][i], ucideri[j][i], decese[j][i]);
                            SendClientMessage(j, -1,string2);
                        }
                        if(winner == 2)
                        {                          
                            Wartimeon[j] = 0;
                            PlayerTextDrawHide(j, TurfTimer[j]);
                            PlayerTextDrawHide(j, DeathsWar[j]);
                            PlayerTextDrawHide(j, KillsWar[j]);
                            PlayerTextDrawHide(j, TurfWar[j]);
                           
                            format(string2,sizeof(string2),"{008BC7}Razboi: {ffffff}%s a castigat zona %d. Scor final: %s %.1f - %.1f %s",NumeFactiune(WarInfo[i][wFaction]), i, NumeFactiune(WarInfo[i][wFaction]), defscore, atscore, NumeFactiune(WarInfo[i][wAttacker]));
                            OOCNews(-1, string2);
                            format(string2,sizeof(string2),"{008BC7}Razboi: {ffffff}Cel mai bun gangster: %s ( %d Ucideri ) || Cel mai slab gangster: %s ( %d Decese )", bestname, winbest, worstname, worstscoreat[i]);
                            OOCNews(-1, string2);
                            format(string2,sizeof(string2),"{008BC7}Scorul tau: {ffffff}%d ( %d ucideri, %d decese )",ucideri[j][i] - decese[j][i], ucideri[j][i], decese[j][i]);
                            SendClientMessage(j, -1,string2);
                        }
                        WarScoreF[defenders][i] = 0.0;
                        WarScoreF[attackers][i] = 0.0;
                        InWar[attackers] = 0;
                        InWar[defenders] = 0;
                    }
                    if(winner == 1)
                    {
                        GangZoneHideForPlayer(j,Turfs[i]);
                        if(attackers == 5)
                        {
                            GangZoneShowForPlayer(j, Turfs[i], 0x00D9FAAA, 0x000000BB); // Aztecas
                        }
                        if(attackers == 6)
                        {
                            GangZoneShowForPlayer(j, Turfs[i], 0x666666AA, 0x000000BB); // Corleone
                        }
                        if(attackers == 7)
                        {
                            GangZoneShowForPlayer(j, Turfs[i], 0x1EB500AA, 0x000000BB); // Grove
                        }
                        if(attackers == 8)
                        {
                            GangZoneShowForPlayer(j, Turfs[i], 0xCC00B4AA, 0x000000BB); // Patterno
                        }
                    }
                }
                if(winner == 1)
                {
                    new str[128];
                    format(str,128,"UPDATE `turfs` SET `Owned`='%d' WHERE `ID`='%d'",TurfInfo[i][zOwned],i);
                    mysql_query(handle, str);
                }
                WarInfo[i][wTime] = 0;
                WarInfo[i][wFaction] = 0;
                WarInfo[i][wAttacker] = 0;
                worstscoreat[i] = 0;
                worstmemberat[i] = 999;
                bestscoreat[i] = 0;
                bestmemberat[i] = 999;
                worstscoredf[i] = 0;
                worstmemberdf[i] = 999;
                bestscoredf[i] = 0;
                bestmemberdf[i] = 999;
            }
        }
    }
    return 1;
}
Reply
#2

remember you set "winner" variable to 0. Also, do not know if you send many messages in the number of players online, I say this because there is a loop that sends the message many times (according to the players connected)
Reply
#3

We managed to solve this problem, it was done with the foreach loop to that. Thank you.

LOL.
And back problem .. I noticed that only resend messages that are global (OOCNews), those made with SendClientMessage (j ......); not doubles.

PHP код:
function OOCNews(color,const string[])
{
    foreach(
Playeri)
    {
        if(
IsPlayerConnected(i))
        {
            
SendClientMessage(icolorstring);
        }
    }

WarTimer:
PHP код:
function WarTimer()
{
    new 
string[100], stringg[150];    
    for(new 
1sizeof(Turfs); i++)
    {
        new 
attackers WarInfo[i][wAttacker];
        new 
defenders WarInfo[i][wFaction];
        if(
WarInfo[i][wTime] >= 2)
        {
            foreach(
Player,j)
            {
                  if(
WarInfo[i][wAttacker] == 5)
                {
                    
GangZoneFlashForPlayer(j,Turfs[i], 0x00D9FAAA);
                }
                else if(
WarInfo[i][wAttacker] == 6)
                {
                    
GangZoneFlashForPlayer(j,Turfs[i], 0x666666AA);
                }
                else if(
WarInfo[i][wAttacker] == 7)
                {
                    
GangZoneFlashForPlayer(j,Turfs[i], 0x1EB500AA);
                }
                else if(
WarInfo[i][wAttacker] == 8)
                {
                    
GangZoneFlashForPlayer(j,Turfs[i], 0xCC00B4AA);
                }
            }
        }
        if(
WarInfo[i][wTime] > 0)
        {
            
WarInfo[i][wTime] -= 1;
            foreach(
Player,j)
            {
                if(
IsPlayerInTurf(j,i) == || IsPlayerInTurf(ji) == 0)
                {
                    if(
PlayerInfo[j][pMember] == attackers)
                    {
                        
WarScoreF[attackers][i] += 0.002;
                    }
                    if(
PlayerInfo[j][pMember] == defenders)
                    {
                        
WarScoreF[defenders][i] += 0.002;
                    }
                }
                if(
Wartimeon[j] == 1)
                {
                    if(
Wartimeon[j] == 1)
                    {
                        
format(string,sizeof(string),"~y~TURF TIMER: ~w~%s",CalculeazaTimp2(WarInfo[i][wTime]));
                        
PlayerTextDrawSetString(jTurfTimer[j], string);
                        
PlayerTextDrawShow(jTurfTimer[j]);
                        
format(stringsizeof(string), "~y~Deaths: ~w~%d"decese[j][i]);
                        
PlayerTextDrawSetString(jDeathsWar[j], string);
                        
PlayerTextDrawShow(jDeathsWar[j]);
                        
format(stringsizeof(string), "~y~Kills: ~w~%d"ucideri[j][i]);
                        
PlayerTextDrawSetString(jKillsWar[j], string);
                        
PlayerTextDrawShow(jKillsWar[j]);
                        
format(stringsizeof(string), "~y~Turf ID: ~w~%d"i);
                        
PlayerTextDrawSetString(jTurfWar[j], string);
                        
PlayerTextDrawShow(jTurfWar[j]);
                    }
                }
            }
            if(
WarInfo[i][wTime] == 1)
            {
                new 
Floatatscore 0.0;
                new 
Floatdefscore 0.0;
                
atscore WarScoreF[attackers][i];
                
defscore WarScoreF[defenders][i];
                new 
winner;
                foreach(
Player,j)
                {
                    if(
PlayerInfo[j][pMember] == attackers)
                    {
                        
GangZoneStopFlashForPlayer(j,Turfs[i]);
                        
format(stringg,sizeof(stringg),"{008BC7}Razboi: {ffffff}Razboiul dintre %s si %s pentru teritoriul %d a luat sfarsit!",NumeFactiune(attackers),NumeFactiune(defenders),i);
                        
SendClientMessage(j, -1,stringg);
                    }
                    if(
PlayerInfo[j][pMember] == defenders)
                    {
                        
GangZoneStopFlashForPlayer(j,Turfs[i]);
                        
format(stringg,sizeof(stringg),"{008BC7}Razboi: {ffffff}Razboiul dintre %s si %s pentru teritoriul %d a luat sfarsit!",NumeFactiune(attackers),NumeFactiune(defenders),i);
                        
SendClientMessage(j, -1,stringg);
                    }
                }
                if(
atscore defscore)
                {
                    
winner 1;
                }
                else
                {
                    
winner 2;
                }
                new 
winbestlosebest;
                new 
winbestj = -1losebestj = -1;
                new 
bestname1[25],bestname2[25],bestname[25],worstname[25];
                foreach(
Player,j)
                {
                    if(
winner == 1)
                    {
                        if(
PlayerInfo[j][pMember] == attackers)
                        {
                            
winbest bestscoreat[i];
                            if(
bestmemberat[i] != 999)
                            {
                                if(
PlayerInfo[bestmemberat[i]][pMember] == attackers)
                                {
                                    
winbestj bestmemberat[i];
                                    
GetPlayerName(winbestj,bestname1,sizeof(bestname1));
                                    
strmid(bestnamebestname10strlen(bestname1), 255);
                                }
                            }
                            else
                            {
                                
format(bestname,sizeof(bestname)," - ");
                                
strmid(bestnamebestname0strlen(bestname), 255);
                            }
                         }
                        if(
PlayerInfo[j][pMember] == defenders)
                        {
                            
losebest worstscoredf[i];
                            if(
worstmemberdf[i] != 999)
                            {
                                if(
PlayerInfo[worstmemberdf[i]][pMember] == defenders)
                                {
                                    
losebestj worstmemberdf[i];
                                    
GetPlayerName(losebestj,bestname2,sizeof(bestname2));
                                    
strmid(worstnamebestname20strlen(bestname2), 255);
                                }
                            }
                            else
                            {
                                
format(worstname,sizeof(worstname)," - ");
                                
strmid(worstnameworstname0strlen(worstname), 255);
                            }
                        }
                    }
                    if(
winner == 2)
                    {
                        if(
PlayerInfo[j][pMember] == defenders)
                        {
                            
winbest bestscoredf[i];
                            if(
bestmemberdf[i] != 999)
                            {
                                if(
PlayerInfo[bestmemberdf[i]][pMember] == defenders)
                                {
                                    
winbestj bestmemberdf[i];
                                    
GetPlayerName(winbestj,bestname1,sizeof(bestname1));
                                    
strmid(bestnamebestname10strlen(bestname1), 255);
                                }
                            }
                            else
                            {
                                
format(bestname,sizeof(bestname)," - ");
                                
strmid(bestnamebestname0strlen(bestname), 255);
                            }
                        }
                        if(
PlayerInfo[j][pMember] == attackers)
                        {
                            
losebest worstscoreat[i];
                            if(
worstmemberat[i] != 999)
                            {
                                if(
PlayerInfo[worstmemberat[i]][pMember] == attackers)
                                {
                                    
losebestj worstmemberat[i];
                                    
GetPlayerName(losebestj,bestname2,sizeof(bestname2));
                                    
strmid(worstnamebestname20strlen(bestname2), 255);
                                }
                            }
                            else
                            {
                                
format(worstname,sizeof(worstname)," - ");
                                
strmid(worstnameworstname0strlen(worstname), 255);
                            }
                        }
                    }
                }
                foreach(
Player,j)
                {
                    new 
uciderii 0;
                    
uciderii += ucideri[j][i];
                        new 
decesee 0;
                        
decesee += decese[j][i];
                        
ucideri[j][i] = 0;
                    
decese[j][i] = 0;
                    if((
PlayerInfo[j][pMember] == attackers) || (PlayerInfo[j][pMember] == defenders))
                    {
                        if(
winner == 1)
                        {                            
                            
format(stringg,sizeof(stringg),"{008BC7}Razboi: {ffffff}%s a castigat teritoriul %d. Scor final: %s %.1f - %.1f %s",NumeFactiune(WarInfo[i][wAttacker]), iNumeFactiune(WarInfo[i][wAttacker]), atscoredefscoreNumeFactiune(WarInfo[i][wFaction]));
                            
OOCNews(-1stringg);
                            
format(stringg,sizeof(stringg),"{008BC7}Razboi: {ffffff}Cel mai bun gangster: %s ( %d Ucideri ) || Cel mai slab gangster: %s ( %d Decese )"bestnamewinbestworstnamelosebest);
                            
OOCNews(-1stringg);
                            
format(stringg,sizeof(stringg),"{008BC7}Scorul tau: {ffffff}%d ( %d ucideri, %d decese )",uciderii-deceseeucideriidecesee);
                            
SendClientMessage(j, -1,stringg);
                            
TurfInfo[i][zOwned] = WarInfo[i][wAttacker];
                            
Wartimeon[j] = 0;
                            
PlayerTextDrawHide(jTurfTimer[j]);
                            
PlayerTextDrawHide(jDeathsWar[j]);
                            
PlayerTextDrawHide(jKillsWar[j]);
                            
PlayerTextDrawHide(jTurfWar[j]);
                        }
                        if(
winner == 2)
                        {
                            
format(stringg,sizeof(stringg),"{008BC7}Razboi: {ffffff}%s a castigat zona %d. Scor final: %s %.1f - %.1f %s",NumeFactiune(WarInfo[i][wFaction]), iNumeFactiune(WarInfo[i][wFaction]), defscoreatscoreNumeFactiune(WarInfo[i][wAttacker]));
                            
OOCNews(-1stringg);
                            
format(stringg,sizeof(stringg),"{008BC7}Razboi: {ffffff}Cel mai bun gangster: %s ( %d Ucideri ) || Cel mai slab gangster: %s ( %d Decese )"bestnamewinbestworstnameworstscoreat[i]);
                            
OOCNews(-1stringg);
                            
format(stringg,sizeof(stringg),"{008BC7}Scorul tau: {ffffff}%d ( %d ucideri, %d decese )",ucideri[j][i] - decese[j][i], ucideri[j][i], decese[j][i]);
                            
SendClientMessage(j, -1,stringg);
                            
                            
Wartimeon[j] = 0;
                            
PlayerTextDrawHide(jTurfTimer[j]);
                            
PlayerTextDrawHide(jDeathsWar[j]);
                            
PlayerTextDrawHide(jKillsWar[j]);
                            
PlayerTextDrawHide(jTurfWar[j]);
                        }
                        
WarScoreF[defenders][i] = 0.0;
                        
WarScoreF[attackers][i] = 0.0;
                        
InWar[attackers] = 0;
                        
InWar[defenders] = 0;
                    }
                    if(
winner == 1)
                    {
                        
GangZoneHideForPlayer(j,Turfs[i]);
                        if(
attackers == 5)
                        {
                            
GangZoneShowForPlayer(jTurfs[i], 0x00D9FAAA0x000000BB); // Aztecas
                        
}
                        if(
attackers == 6)
                        {
                            
GangZoneShowForPlayer(jTurfs[i], 0x666666AA0x000000BB); // Corleone
                        
}
                        if(
attackers == 7)
                        {
                            
GangZoneShowForPlayer(jTurfs[i], 0x1EB500AA0x000000BB); // Grove
                        
}
                        if(
attackers == 8)
                        {
                            
GangZoneShowForPlayer(jTurfs[i], 0xCC00B4AA0x000000BB); // Patterno
                        
}
                    }
                }
                if(
winner == 1)
                {
                    new 
str[128];
                    
format(str,128,"UPDATE `turfs` SET `Owned`='%d' WHERE `ID`='%d'",TurfInfo[i][zOwned],i);
                    
mysql_query(handle,str);
                }
                
WarInfo[i][wTime] = 0;
                
WarInfo[i][wFaction] = 0;
                
WarInfo[i][wAttacker] = 0;
                
worstscoreat[i] = 0;
                
worstmemberat[i] = 999;
                
bestscoreat[i] = 0;
                
bestmemberat[i] = 999;
                
worstscoredf[i] = 0;
                
worstmemberdf[i] = 999;
                
bestscoredf[i] = 0;
                
bestmemberdf[i] = 999;
            }
        }
    }
    return 
1;

Reply
#4

Bump. Problem is back .
Reply
#5

Quote:
Originally Posted by Lunoxel
Посмотреть сообщение
I did a system of war and when the war was over we put send you some messages. The problem is that they sent several times, and do not understand why you may know.

pawn Код:
function WarTimer()
{
    new string[100], string2[150];
    for(new i = 1; i < sizeof(Turfs); i++)
    {
        new attackers = WarInfo[i][wAttacker];
        new defenders = WarInfo[i][wFaction];
        if(WarInfo[i][wTime] >= 2)
        {
            foreach(Player,j)
            {
                if(WarInfo[i][wAttacker] == 5)
                {
                    GangZoneFlashForPlayer(j,Turfs[i], 0x00D9FAAA);
                }
                else if(WarInfo[i][wAttacker] == 6)
                {
                    GangZoneFlashForPlayer(j,Turfs[i], 0x666666AA);
                }
                else if(WarInfo[i][wAttacker] == 7)
                {
                    GangZoneFlashForPlayer(j,Turfs[i], 0x1EB500AA);
                }
                else if(WarInfo[i][wAttacker] == 8)
                {
                    GangZoneFlashForPlayer(j,Turfs[i], 0xCC00B4AA);
                }
            }
        }
        if(WarInfo[i][wTime] > 0)
        {
            WarInfo[i][wTime] -= 1;
            foreach(Player,j)
            {
                if(IsPlayerInTurf(j,i) == 1 || IsPlayerInTurf(j, i) == 0)
                {
                    if(PlayerInfo[j][pMember] == attackers)
                    {
                        WarScoreF[attackers][i] += 0.002;
                        if(Wartimeon[j] == 1)
                        {
                            format(string,sizeof(string),"~y~TURF TIMER: ~w~%s",CalculeazaTimp2(WarInfo[i][wTime]));
                            PlayerTextDrawSetString(j, TurfTimer[j], string);
                            PlayerTextDrawShow(j, TurfTimer[j]);
                            format(string, sizeof(string), "~y~Deaths: ~w~%d", decese[j][i]);
                            PlayerTextDrawSetString(j, DeathsWar[j], string);
                            PlayerTextDrawShow(j, DeathsWar[j]);
                            format(string, sizeof(string), "~y~Kills: ~w~%d", ucideri[j][i]);
                            PlayerTextDrawSetString(j, KillsWar[j], string);
                            PlayerTextDrawShow(j, KillsWar[j]);
                            format(string, sizeof(string), "~y~Turf ID: ~w~%d", i);
                            PlayerTextDrawSetString(j, TurfWar[j], string);
                            PlayerTextDrawShow(j, TurfWar[j]);
                        }
                    }
                    if(PlayerInfo[j][pMember] == defenders)
                    {
                        WarScoreF[defenders][i] += 0.002;
                        if(Wartimeon[j] == 1)
                        {
                            format(string,sizeof(string),"~y~TURF TIMER: ~w~%s",CalculeazaTimp2(WarInfo[i][wTime]));
                            PlayerTextDrawSetString(j, TurfTimer[j], string);
                            PlayerTextDrawShow(j, TurfTimer[j]);
                            format(string, sizeof(string), "~y~Deaths: ~w~%d", decese[j][i]);
                            PlayerTextDrawSetString(j, DeathsWar[j], string);
                            PlayerTextDrawShow(j, DeathsWar[j]);
                            format(string, sizeof(string), "~y~Kills: ~w~%d", ucideri[j][i]);
                            PlayerTextDrawSetString(j, KillsWar[j], string);
                            PlayerTextDrawShow(j, KillsWar[j]);
                            format(string, sizeof(string), "~y~Turf ID: ~w~%d", i);
                            PlayerTextDrawSetString(j, TurfWar[j], string);
                            PlayerTextDrawShow(j, TurfWar[j]);
                        }
                    }
                }
                else if(Wartimeon[j] == 1)
                {
                    PlayerTextDrawHide(j, TurfTimer[j]);
                    PlayerTextDrawHide(j, DeathsWar[j]);
                    PlayerTextDrawHide(j, KillsWar[j]);
                    PlayerTextDrawHide(j, TurfWar[j]);
                }
            }
            if(WarInfo[i][wTime] == 1)
            {
                new Float: atscore = 0.0;
                new Float: defscore = 0.0;
                atscore = WarScoreF[attackers][i];
                defscore = WarScoreF[defenders][i];
                   
                new winner;
                if(atscore > defscore)
                {
                    winner = 1;
                }
                else
                {
                    winner = 2;
                }
                new winbest;
                new winbestj = -1, losebestj = -1;
                new bestname1[25],bestname2[25],bestname[25],worstname[25];
                foreach(Player,j)
                {
                    if(winner == 1)
                    {
                        if(PlayerInfo[j][pMember] == attackers)
                        {
                            winbest = bestscoreat[i];
                            if(bestmemberat[i] != 999)
                            {
                                if(PlayerInfo[bestmemberat[i]][pMember] == attackers)
                                {
                                    winbestj = bestmemberat[i];
                                    GetPlayerName(winbestj,bestname1,sizeof(bestname1));
                                    strmid(bestname, bestname1, 0, strlen(bestname1), 255);
                                }
                            }
                            else
                            {
                                format(bestname,sizeof(bestname),"-");
                                strmid(bestname, bestname, 0, strlen(bestname), 255);
                            }
                        }
                        if(PlayerInfo[j][pMember] == defenders)
                        {
                            //losebest = worstscoredf[i];
                            if(worstmemberdf[i] != 999)
                            {
                                if(PlayerInfo[worstmemberdf[i]][pMember] == defenders)
                                {
                                    losebestj = worstmemberdf[i];
                                    GetPlayerName(losebestj,bestname2,sizeof(bestname2));
                                    strmid(worstname, bestname2, 0, strlen(bestname2), 255);
                                }
                            }
                            else
                            {
                                format(worstname,sizeof(worstname),"-");
                                strmid(worstname, worstname, 0, strlen(worstname), 255);
                            }
                        }
                    }
                    if(winner == 2)
                    {
                        if(PlayerInfo[j][pMember] == defenders)
                        {
                            winbest = bestscoredf[i];
                            if(bestmemberdf[i] != 999)
                            {
                                if(PlayerInfo[bestmemberdf[i]][pMember] == defenders)
                                {
                                    winbestj = bestmemberdf[i];
                                    GetPlayerName(winbestj,bestname1,sizeof(bestname1));
                                    strmid(bestname, bestname1, 0, strlen(bestname1), 255);
                                }
                            }
                            else
                            {
                                format(bestname,sizeof(bestname),"-");
                                strmid(bestname, bestname, 0, strlen(bestname), 255);
                            }
                        }
                        if(PlayerInfo[j][pMember] == attackers)
                        {
                            if(worstmemberat[i] != 999)
                            {
                                if(PlayerInfo[worstmemberat[i]][pMember] == attackers)
                                {
                                    losebestj = worstmemberat[i];
                                    GetPlayerName(losebestj,bestname2,sizeof(bestname2));
                                    strmid(worstname, bestname2, 0, strlen(bestname2), 255);
                                }
                            }
                            else
                            {
                                format(worstname,sizeof(worstname),"-");
                                strmid(worstname, worstname, 0, strlen(worstname), 255);
                            }
                        }
                    }
                }
                foreach(Player,j)
                {
                    if((PlayerInfo[j][pMember] == attackers) || (PlayerInfo[j][pMember] == defenders))
                    {
                        if(winner == 1)
                        {
                            TurfInfo[i][zOwned] = WarInfo[i][wAttacker];
                            Wartimeon[j] = 0;
                            PlayerTextDrawHide(j, TurfTimer[j]);
                            PlayerTextDrawHide(j, DeathsWar[j]);
                            PlayerTextDrawHide(j, KillsWar[j]);
                            PlayerTextDrawHide(j, TurfWar[j]);
                           
                            format(string2,sizeof(string2),"{008BC7}Razboi: {ffffff}%s a castigat zona %d. Scor final: %s %.1f - %.1f %s",NumeFactiune(WarInfo[i][wAttacker]), i, NumeFactiune(WarInfo[i][wAttacker]), atscore, defscore, NumeFactiune(WarInfo[i][wFaction]));
                            OOCNews(-1, string2);
                            format(string2,sizeof(string2),"{008BC7}Razboi: {ffffff}Cel mai bun gangster: %s ( %d Ucideri ) || Cel mai slab gangster: %s ( %d Decese )", bestname, winbest, worstname, worstscoreat[i]);
                            OOCNews(-1, string2);
                            format(string2,sizeof(string2),"{008BC7}Scorul tau: {ffffff}%d ( %d ucideri, %d decese )",ucideri[j][i] - decese[j][i], ucideri[j][i], decese[j][i]);
                            SendClientMessage(j, -1,string2);
                        }
                        if(winner == 2)
                        {                          
                            Wartimeon[j] = 0;
                            PlayerTextDrawHide(j, TurfTimer[j]);
                            PlayerTextDrawHide(j, DeathsWar[j]);
                            PlayerTextDrawHide(j, KillsWar[j]);
                            PlayerTextDrawHide(j, TurfWar[j]);
                           
                            format(string2,sizeof(string2),"{008BC7}Razboi: {ffffff}%s a castigat zona %d. Scor final: %s %.1f - %.1f %s",NumeFactiune(WarInfo[i][wFaction]), i, NumeFactiune(WarInfo[i][wFaction]), defscore, atscore, NumeFactiune(WarInfo[i][wAttacker]));
                            OOCNews(-1, string2);
                            format(string2,sizeof(string2),"{008BC7}Razboi: {ffffff}Cel mai bun gangster: %s ( %d Ucideri ) || Cel mai slab gangster: %s ( %d Decese )", bestname, winbest, worstname, worstscoreat[i]);
                            OOCNews(-1, string2);
                            format(string2,sizeof(string2),"{008BC7}Scorul tau: {ffffff}%d ( %d ucideri, %d decese )",ucideri[j][i] - decese[j][i], ucideri[j][i], decese[j][i]);
                            SendClientMessage(j, -1,string2);
                        }
                        WarScoreF[defenders][i] = 0.0;
                        WarScoreF[attackers][i] = 0.0;
                        InWar[attackers] = 0;
                        InWar[defenders] = 0;
                    }
                    if(winner == 1)
                    {
                        GangZoneHideForPlayer(j,Turfs[i]);
                        if(attackers == 5)
                        {
                            GangZoneShowForPlayer(j, Turfs[i], 0x00D9FAAA, 0x000000BB); // Aztecas
                        }
                        if(attackers == 6)
                        {
                            GangZoneShowForPlayer(j, Turfs[i], 0x666666AA, 0x000000BB); // Corleone
                        }
                        if(attackers == 7)
                        {
                            GangZoneShowForPlayer(j, Turfs[i], 0x1EB500AA, 0x000000BB); // Grove
                        }
                        if(attackers == 8)
                        {
                            GangZoneShowForPlayer(j, Turfs[i], 0xCC00B4AA, 0x000000BB); // Patterno
                        }
                    }
                }
                if(winner == 1)
                {
                    new str[128];
                    format(str,128,"UPDATE `turfs` SET `Owned`='%d' WHERE `ID`='%d'",TurfInfo[i][zOwned],i);
                    mysql_query(handle, str);
                }
                WarInfo[i][wTime] = 0;
                WarInfo[i][wFaction] = 0;
                WarInfo[i][wAttacker] = 0;
                worstscoreat[i] = 0;
                worstmemberat[i] = 999;
                bestscoreat[i] = 0;
                bestmemberat[i] = 999;
                worstscoredf[i] = 0;
                worstmemberdf[i] = 999;
                bestscoredf[i] = 0;
                bestmemberdf[i] = 999;
            }
        }
    }
    return 1;
}
Home Your mistake is that you are constantly using foreach(Player, j) get more optimal algorithm, where you will be able to use it x1 time, and not ~x10. Then the problem with duplicate messages disappears.
Reply
#6

Ok, I'll do what you said, whether they will go.

I put Crashdetect and the OnGameModeInit gives me some error has nothing?

PHP код:
[13:32:31] [debugRun time error 4"Array index out of bounds"
[13:32:31] [debug]  Accessing element at negative index -1
[13:32:31] [debugAMX backtrace:
[
13:32:31] [debug#0 0001abb8 in ?? (0, 0, 0, 0, -1, 1060320051, 96, 85, 1060320051) from Gamemode.amx
[13:32:31] [debug#1 00024c14 in public GZ_OnGameModeInit () from Gamemode.amx
[13:32:31] [debug#2 00011b20 in public AC_OnGameModeInit () from Gamemode.amx
[13:32:31] [debug#3 0000eb8c in public Hook_OnGameModeInit () from Gamemode.amx
[13:32:31] [debug#4 native CallLocalFunction () from samp03svr
[13:32:31] [debug#5 0000e844 in public PZone_OnGameModeInit () from Gamemode.amx
[13:32:31] [debug#6 native CallLocalFunction () from samp03svr
[13:32:31] [debug#7 0000c4a0 in public ppb_OnGameModeInit () from Gamemode.amx
[13:32:31] [debug#8 0000c228 in public SSCANF_OnGameModeInit () from unnic.amx
[13:32:31] [debug#9 000037a8 in public zcmd_OnGameModeInit () from Gamemode.amx
[13:32:31] [debug#10 native CallLocalFunction () from samp03svr
[13:32:31] [debug#11 00003264 in public Itter_OnGameModeInit () from Gamemode.amx
[13:32:31] [debug#12 native CallLocalFunction () from samp03svr
[13:32:31] [debug#13 0000261c in public ScriptInit_OnGameModeInit () from Gamemode.amx
[13:32:31] [debug#14 00001e28 in public OnGameModeInit () from Gamemode.amx 
Reply
#7

Quote:
Originally Posted by Lunoxel
Посмотреть сообщение
Ok, I'll do what you said, whether they will go.

I put Crashdetect and the OnGameModeInit gives me some error has nothing?

PHP код:
[13:32:31] [debugRun time error 4"Array index out of bounds"
[13:32:31] [debug]  Accessing element at negative index -1
[13:32:31] [debugAMX backtrace:
[
13:32:31] [debug#0 0001abb8 in ?? (0, 0, 0, 0, -1, 1060320051, 96, 85, 1060320051) from Gamemode.amx
[13:32:31] [debug#1 00024c14 in public GZ_OnGameModeInit () from Gamemode.amx
[13:32:31] [debug#2 00011b20 in public AC_OnGameModeInit () from Gamemode.amx
[13:32:31] [debug#3 0000eb8c in public Hook_OnGameModeInit () from Gamemode.amx
[13:32:31] [debug#4 native CallLocalFunction () from samp03svr
[13:32:31] [debug#5 0000e844 in public PZone_OnGameModeInit () from Gamemode.amx
[13:32:31] [debug#6 native CallLocalFunction () from samp03svr
[13:32:31] [debug#7 0000c4a0 in public ppb_OnGameModeInit () from Gamemode.amx
[13:32:31] [debug#8 0000c228 in public SSCANF_OnGameModeInit () from unnic.amx
[13:32:31] [debug#9 000037a8 in public zcmd_OnGameModeInit () from Gamemode.amx
[13:32:31] [debug#10 native CallLocalFunction () from samp03svr
[13:32:31] [debug#11 00003264 in public Itter_OnGameModeInit () from Gamemode.amx
[13:32:31] [debug#12 native CallLocalFunction () from samp03svr
[13:32:31] [debug#13 0000261c in public ScriptInit_OnGameModeInit () from Gamemode.amx
[13:32:31] [debug#14 00001e28 in public OnGameModeInit () from Gamemode.amx 
Код:
[13:32:31] [debug] Run time error 4: "Array index out of bounds"
[13:32:31] [debug]  Accessing element at negative index -1 <- You index
This occurs when the variable you are trying to get an array of index -1

Example:

Код:
new index;
// before index 0
index--;
// after index -1
var = array[index]; <- Error "Array index out of bounds"
Reply
#8

I found the problem, it is to include the gZone2. Maybe you can help me to fix it: D.

PHP код:
#include <streamer>
 
#define MAX_ZONES 1024//maximum gangzones your server can have, the limit is upto 1024 and minimum 5
#define NUMDIS 40.0
#define MAX_GANGZONES 68
//Note: Creating one interactive gangzone makes total 5 zones, 4 for borders and 1 for the main zone!
 
enum GangzoneInfo
{
        
bool:E_exist,
        
E_border[4],
        
Float:E_minx,
        
Float:E_miny,
        
Float:E_maxx,
        
Float:E_maxy,
        
npart[5],
        
npart2[5]
}
static 
gGangzone[MAX_ZONES][GangzoneInfo];
 
static 
bool:gPlayerShown[MAX_PLAYERS][MAX_ZONES];
static 
gPlayerColor[MAX_PLAYERS][MAX_ZONES];
static 
gPlayerBorderColor[MAX_PLAYERS][MAX_ZONES];
 
//Note: if you use this in a filterscript, please define "FILTERSCRIPT" in your script
public OnGameModeInit()
{
    
DestroyAllGangZones();//destory all gangzones
    #if defined GZ_OnGameModeInit
                
GZ_OnGameModeInit();
        
#endif
        
return 1;
}
#if defined _ALS_OnGameModeInit
        #undef OnGameModeInit
#else
        #define _ALS_OnGameModeInit
#endif
#define OnGameModeInit GZ_OnGameModeInit
#if defined GZ_OnGameModeInit
        
forward GZ_OnGameModeInit();
#endif
public OnGameModeExit()
{
    
DestroyAllGangZones();//destory all gangzones
    #if defined GZ_OnGameModeExit
                
GZ_OnGameModeExit();
        
#endif
        
return 1;
}
#if defined _ALS_OnGameModeExit
        #undef OnGameModeExit
#else
        #define _ALS_OnGameModeExit
#endif
#define OnGameModeExit GZ_OnGameModeExit
#if defined GZ_OnGameModeExit
        
forward GZ_OnGameModeExit();
#endif
stock GangZoneCreateNumbergzid gznum Float:centposx Float:centposy Float:numsize )
{
    switch(
gznum)
    {
      case 
0:
      {
        new 
Float:gztk 4.0*numsize;
        new 
Float:gsdisx 15.0*numsize;
        new 
Float:gsdisy 20.0*numsize;
        
gGangzone[gzid][npart][0] = GangZoneCreate(centposx-gsdisx-gztk,centposy-gsdisy-gztk,centposx+gsdisx+gztk,centposy-gsdisy+gztk); // Down of 0
        
gGangzone[gzid][npart][1] = GangZoneCreate(centposx-gsdisx-gztk,centposy+gsdisy+gztk,centposx+gsdisx+gztk,centposy+gsdisy-gztk); // Up of 0
        
gGangzone[gzid][npart][2] = GangZoneCreate(centposx-gsdisx-gztk,centposy-gsdisy+gztk,centposx-gsdisx+gztk,centposy+gsdisy-gztk); // Left of 0
        
gGangzone[gzid][npart][3] = GangZoneCreate(centposx+gsdisx-gztk,centposy-gsdisy+gztk,centposx+gsdisx+gztk,centposy+gsdisy-gztk); // Right of 0
      
}
      case 
1:
      {
        new 
Float:gztk 4.0*numsize;
        new 
Float:gsdisy 25.0*numsize;
        
gGangzone[gzid][npart][0] = GangZoneCreate(centposx-gztk,centposy-gsdisy-gztk,centposx+gztk,centposy+gsdisy+gztk);
      }
      case 
2:
      {
        new 
Float:gztk 4.0*numsize;
        new 
Float:gsdisy 20.0*numsize;
        new 
Float:gsdisx 25.0*numsize;
        
gGangzone[gzid][npart][0] = GangZoneCreate(centposx-gsdisx,centposy+gsdisy-gztk,centposx+gsdisx,centposy+gsdisy+gztk); // Up
        
gGangzone[gzid][npart][1] = GangZoneCreate(centposx+gsdisx-gztk-gztk,centposy+gztk,centposx+gsdisx,centposy+gsdisy-gztk); // Right Stick
        
gGangzone[gzid][npart][2] = GangZoneCreate(centposx-gsdisx,centposy-gztk,centposx+gsdisx,centposy+gztk); // Middle
        
gGangzone[gzid][npart][3] = GangZoneCreate(centposx-gsdisx,centposy-gsdisy+gztk,centposx-gsdisx+gztk+gztk,centposy-gztk); // Left Stick
        
gGangzone[gzid][npart][4] = GangZoneCreate(centposx-gsdisx,centposy-gsdisy-gztk,centposx+gsdisx,centposy-gsdisy+gztk); // Down
      
}
      case 
3:
      {
        new 
Float:gztk 4.0*numsize;
        new 
Float:gsdisy 20.0*numsize;
        new 
Float:gsdisx 25.0*numsize;
        
gGangzone[gzid][npart][0] = GangZoneCreate(centposx-gsdisx,centposy+gsdisy-gztk,centposx+gsdisx,centposy+gsdisy+gztk); // Up
        
gGangzone[gzid][npart][1] = GangZoneCreate(centposx+gsdisx,centposy-gsdisy-gztk,centposx+gsdisx+gztk+gztk,centposy+gsdisy+gztk); // Stick
        
gGangzone[gzid][npart][2] = GangZoneCreate(centposx-gsdisx,centposy-gztk,centposx+gsdisx,centposy+gztk); // Middle
        
gGangzone[gzid][npart][3] = GangZoneCreate(centposx-gsdisx,centposy-gsdisy-gztk,centposx+gsdisx,centposy-gsdisy+gztk); // Down
      
}
      case 
4:
      {
          new 
Float:gztk 4.0*numsize;
        new 
Float:gsdisy 20.0*numsize;
        new 
Float:gsdisx 25.0*numsize;
        
gGangzone[gzid][npart][0] = GangZoneCreate(centposx-gsdisx,centposy+gsdisy,centposx-gsdisx+gztk+gztk,centposy+gztk); // Left
        
gGangzone[gzid][npart][1] = GangZoneCreate(centposx-gsdisx,centposy-gztk,centposx+gsdisx,centposy+gztk);// Middle
        
gGangzone[gzid][npart][2] = GangZoneCreate(centposx+gsdisx,centposy-gsdisy,centposx+gsdisx+gztk+gztk,centposy+gsdisy); // Stick
      
}
      case 
5:
      {
          new 
Float:gztk 4.0*numsize;
        new 
Float:gsdisy 20.0*numsize;
        new 
Float:gsdisx 25.0*numsize;
        
gGangzone[gzid][npart][0] = GangZoneCreate(centposx-gsdisx-gztk,centposy+gsdisy-gztk,centposx+gsdisx+gztk,centposy+gsdisy+gztk); // Up
        
gGangzone[gzid][npart][1] = GangZoneCreate(centposx-gsdisx-gztk,centposy+gztk,centposx-gsdisx+gztk,centposy+gsdisy-gztk); // Left Stick
        
gGangzone[gzid][npart][2] = GangZoneCreate(centposx-gsdisx-gztk,centposy-gztk,centposx+gsdisx+gztk,centposy+gztk); // Middle
        
gGangzone[gzid][npart][3] = GangZoneCreate(centposx+gsdisx-gztk,centposy-gztk,centposx+gsdisx+gztk,centposy-gsdisy+gztk); // Right Stick
        
gGangzone[gzid][npart][4] = GangZoneCreate(centposx-gsdisx-gztk,centposy-gsdisy-gztk,centposx+gsdisx+gztk,centposy-gsdisy+gztk); // Down
      
}
      case 
6:
      {
          new 
Float:gztk 4.0*numsize;
        new 
Float:gsdisy 20.0*numsize;
        new 
Float:gsdisx 25.0*numsize;
        
gGangzone[gzid][npart][0] = GangZoneCreate(centposx-gsdisx,centposy+gsdisy-gztk,centposx+gsdisx,centposy+gsdisy+gztk); // Up
        
gGangzone[gzid][npart][1] = GangZoneCreate(centposx-gsdisx-gztk-gztk,centposy+gsdisy+gztk,centposx-gsdisx,centposy-gsdisy-gztk); // Main Left Stick
        
gGangzone[gzid][npart][2] = GangZoneCreate(centposx-gsdisx,centposy-gztk,centposx+gsdisx,centposy+gztk); // Middle
        
gGangzone[gzid][npart][3] = GangZoneCreate(centposx-gsdisx,centposy-gsdisy-gztk,centposx+gsdisx,centposy-gsdisy+gztk); // Down
        
gGangzone[gzid][npart][4] = GangZoneCreate(centposx+gsdisx-gztk-gztk,centposy-gsdisy+gztk,centposx+gsdisx,centposy-gztk); // Right small stick
      
}
      case 
7:
      {
        new 
Float:gztk 4.0*numsize;
        new 
Float:gsdisy 20.0*numsize;
        new 
Float:gsdisx 15.0*numsize;
        
gGangzone[gzid][npart][0] = GangZoneCreate(centposx+gsdisx-gztk,centposy-gsdisy-gztk,centposx+gsdisx+gztk,centposy+gsdisy-gztk); // Stick of 1
        
gGangzone[gzid][npart][1] = GangZoneCreate(centposx-gsdisx,centposy+gsdisy-gztk,centposx+gsdisx+gztk,centposy+gsdisy+gztk); // Up of 1
      
}
      case 
8:
      {
          new 
Float:gztk 4.0*numsize;
        new 
Float:gsdisy 20.0*numsize;
        new 
Float:gsdisx 25.0*numsize;
        
gGangzone[gzid][npart][0] = GangZoneCreate(centposx-gsdisx-gztk,centposy+gsdisy+gztk,centposx-gsdisx+gztk,centposy-gsdisy-gztk); // Left stick
        
gGangzone[gzid][npart][1] = GangZoneCreate(centposx+gsdisx-gztk,centposy+gsdisy+gztk,centposx+gsdisx+gztk,centposy-gsdisy-gztk); // Right stick
        
gGangzone[gzid][npart][2] = GangZoneCreate(centposx-gsdisx+gztk,centposy+gsdisy-gztk,centposx+gsdisx-gztk,centposy+gsdisy+gztk); // Up
        
gGangzone[gzid][npart][3] = GangZoneCreate(centposx-gsdisx+gztk,centposy-gztk,centposx+gsdisx-gztk,centposy+gztk); // Center
        
gGangzone[gzid][npart][4] = GangZoneCreate(centposx-gsdisx+gztk,centposy-gsdisy-gztk,centposx+gsdisx-gztk,centposy-gsdisy+gztk); // Down
      
}
      case 
9:
      {
          new 
Float:gztk 4.0*numsize;
        new 
Float:gsdisy 20.0*numsize;
        new 
Float:gsdisx 25.0*numsize;
        
gGangzone[gzid][npart][0] = GangZoneCreate(centposx-gsdisx-gztk,centposy,centposx-gsdisx+gztk,centposy+gsdisy-gztk); // Left Stick
        
gGangzone[gzid][npart][1] = GangZoneCreate(centposx+gsdisx,centposy-gsdisy-gztk,centposx+gsdisx+gztk+gztk,centposy+gsdisy+gztk); // Right Stick
        
gGangzone[gzid][npart][2] = GangZoneCreate(centposx-gsdisx-gztk,centposy+gsdisy-gztk,centposx+gsdisx,centposy+gsdisy+gztk); // Up
        
gGangzone[gzid][npart][3] = GangZoneCreate(centposx-gsdisx+gztk,centposy,centposx+gsdisx,centposy+gztk+gztk); // Middle
        
gGangzone[gzid][npart][4] = GangZoneCreate(centposx-gsdisx-gztk,centposy-gsdisy-gztk,centposx+gsdisx,centposy-gsdisy+gztk); // Down
      
}
    }
}
stock GangZoneCreateNumber2gzid gznum Float:centposx Float:centposy Float:numsize)
{
    switch(
gznum)
    {
      case 
0:
      {
        new 
Float:gztk 4.0*numsize;
        new 
Float:gsdisx 15.0*numsize;
        new 
Float:gsdisy 20.0*numsize;
        
gGangzone[gzid][npart2][0] = GangZoneCreate(centposx-gsdisx-gztk,centposy-gsdisy-gztk,centposx+gsdisx+gztk,centposy-gsdisy+gztk); // Down of 0
        
gGangzone[gzid][npart2][1] = GangZoneCreate(centposx-gsdisx-gztk,centposy+gsdisy+gztk,centposx+gsdisx+gztk,centposy+gsdisy-gztk); // Up of 0
        
gGangzone[gzid][npart2][2] = GangZoneCreate(centposx-gsdisx-gztk,centposy-gsdisy+gztk,centposx-gsdisx+gztk,centposy+gsdisy-gztk); // Left of 0
        
gGangzone[gzid][npart2][3] = GangZoneCreate(centposx+gsdisx-gztk,centposy-gsdisy+gztk,centposx+gsdisx+gztk,centposy+gsdisy-gztk); // Right of 0
      
}
      case 
1:
      {
        new 
Float:gztk 4.0*numsize;
        new 
Float:gsdisy 25.0*numsize;
        
gGangzone[gzid][npart2][0] = GangZoneCreate(centposx-gztk,centposy-gsdisy-gztk,centposx+gztk,centposy+gsdisy+gztk);
      }
      case 
2:
      {
        new 
Float:gztk 4.0*numsize;
        new 
Float:gsdisy 20.0*numsize;
        new 
Float:gsdisx 25.0*numsize;
        
gGangzone[gzid][npart2][0] = GangZoneCreate(centposx-gsdisx,centposy+gsdisy-gztk,centposx+gsdisx,centposy+gsdisy+gztk); // Up
        
gGangzone[gzid][npart2][1] = GangZoneCreate(centposx+gsdisx-gztk-gztk,centposy+gztk,centposx+gsdisx,centposy+gsdisy-gztk); // Right Stick
        
gGangzone[gzid][npart2][2] = GangZoneCreate(centposx-gsdisx,centposy-gztk,centposx+gsdisx,centposy+gztk); // Middle
        
gGangzone[gzid][npart2][3] = GangZoneCreate(centposx-gsdisx,centposy-gsdisy+gztk,centposx-gsdisx+gztk+gztk,centposy-gztk); // Left Stick
        
gGangzone[gzid][npart2][4] = GangZoneCreate(centposx-gsdisx,centposy-gsdisy-gztk,centposx+gsdisx,centposy-gsdisy+gztk); // Down
      
}
      case 
3:
      {
        new 
Float:gztk 4.0*numsize;
        new 
Float:gsdisy 20.0*numsize;
        new 
Float:gsdisx 25.0*numsize;
        
gGangzone[gzid][npart2][0] = GangZoneCreate(centposx-gsdisx,centposy+gsdisy-gztk,centposx+gsdisx,centposy+gsdisy+gztk); // Up
        
gGangzone[gzid][npart2][1] = GangZoneCreate(centposx+gsdisx,centposy-gsdisy-gztk,centposx+gsdisx+gztk+gztk,centposy+gsdisy+gztk); // Stick
        
gGangzone[gzid][npart2][2] = GangZoneCreate(centposx-gsdisx,centposy-gztk,centposx+gsdisx,centposy+gztk); // Middle
        
gGangzone[gzid][npart2][3] = GangZoneCreate(centposx-gsdisx,centposy-gsdisy-gztk,centposx+gsdisx,centposy-gsdisy+gztk); // Down
      
}
      case 
4:
      {
          new 
Float:gztk 4.0*numsize;
        new 
Float:gsdisy 20.0*numsize;
        new 
Float:gsdisx 25.0*numsize;
        
gGangzone[gzid][npart2][0] = GangZoneCreate(centposx-gsdisx,centposy+gsdisy,centposx-gsdisx+gztk+gztk,centposy+gztk); // Left
        
gGangzone[gzid][npart2][1] = GangZoneCreate(centposx-gsdisx,centposy-gztk,centposx+gsdisx,centposy+gztk);// Middle
        
gGangzone[gzid][npart2][2] = GangZoneCreate(centposx+gsdisx,centposy-gsdisy,centposx+gsdisx+gztk+gztk,centposy+gsdisy); // Stick
      
}
      case 
5:
      {
          new 
Float:gztk 4.0*numsize;
        new 
Float:gsdisy 20.0*numsize;
        new 
Float:gsdisx 25.0*numsize;
        
gGangzone[gzid][npart2][0] = GangZoneCreate(centposx-gsdisx-gztk,centposy+gsdisy-gztk,centposx+gsdisx+gztk,centposy+gsdisy+gztk); // Up
        
gGangzone[gzid][npart2][1] = GangZoneCreate(centposx-gsdisx-gztk,centposy+gztk,centposx-gsdisx+gztk,centposy+gsdisy-gztk); // Left Stick
        
gGangzone[gzid][npart2][2] = GangZoneCreate(centposx-gsdisx-gztk,centposy-gztk,centposx+gsdisx+gztk,centposy+gztk); // Middle
        
gGangzone[gzid][npart2][3] = GangZoneCreate(centposx+gsdisx-gztk,centposy-gztk,centposx+gsdisx+gztk,centposy-gsdisy+gztk); // Right Stick
        
gGangzone[gzid][npart2][4] = GangZoneCreate(centposx-gsdisx-gztk,centposy-gsdisy-gztk,centposx+gsdisx+gztk,centposy-gsdisy+gztk); // Down
      
}
      case 
6:
      {
          new 
Float:gztk 4.0*numsize;
        new 
Float:gsdisy 20.0*numsize;
        new 
Float:gsdisx 25.0*numsize;
        
gGangzone[gzid][npart2][0] = GangZoneCreate(centposx-gsdisx,centposy+gsdisy-gztk,centposx+gsdisx,centposy+gsdisy+gztk); // Up
        
gGangzone[gzid][npart2][1] = GangZoneCreate(centposx-gsdisx-gztk-gztk,centposy+gsdisy+gztk,centposx-gsdisx,centposy-gsdisy-gztk); // Main Left Stick
        
gGangzone[gzid][npart2][2] = GangZoneCreate(centposx-gsdisx,centposy-gztk,centposx+gsdisx,centposy+gztk); // Middle
        
gGangzone[gzid][npart2][3] = GangZoneCreate(centposx-gsdisx,centposy-gsdisy-gztk,centposx+gsdisx,centposy-gsdisy+gztk); // Down
        
gGangzone[gzid][npart2][4] = GangZoneCreate(centposx+gsdisx-gztk-gztk,centposy-gsdisy+gztk,centposx+gsdisx,centposy-gztk); // Right small stick
      
}
      case 
7:
      {
        new 
Float:gztk 4.0*numsize;
        new 
Float:gsdisy 20.0*numsize;
        new 
Float:gsdisx 15.0*numsize;
        
gGangzone[gzid][npart2][0] = GangZoneCreate(centposx+gsdisx-gztk,centposy-gsdisy-gztk,centposx+gsdisx+gztk,centposy+gsdisy-gztk); // Stick of 1
        
gGangzone[gzid][npart2][1] = GangZoneCreate(centposx-gsdisx,centposy+gsdisy-gztk,centposx+gsdisx+gztk,centposy+gsdisy+gztk); // Up of 1
      
}
      case 
8:
      {
          new 
Float:gztk 4.0*numsize;
        new 
Float:gsdisy 20.0*numsize;
        new 
Float:gsdisx 25.0*numsize;
        
gGangzone[gzid][npart2][0] = GangZoneCreate(centposx-gsdisx-gztk,centposy+gsdisy+gztk,centposx-gsdisx+gztk,centposy-gsdisy-gztk); // Left stick
        
gGangzone[gzid][npart2][1] = GangZoneCreate(centposx+gsdisx-gztk,centposy+gsdisy+gztk,centposx+gsdisx+gztk,centposy-gsdisy-gztk); // Right stick
        
gGangzone[gzid][npart2][2] = GangZoneCreate(centposx-gsdisx+gztk,centposy+gsdisy-gztk,centposx+gsdisx-gztk,centposy+gsdisy+gztk); // Up
        
gGangzone[gzid][npart2][3] = GangZoneCreate(centposx-gsdisx+gztk,centposy-gztk,centposx+gsdisx-gztk,centposy+gztk); // Center
        
gGangzone[gzid][npart2][4] = GangZoneCreate(centposx-gsdisx+gztk,centposy-gsdisy-gztk,centposx+gsdisx-gztk,centposy-gsdisy+gztk); // Down
      
}
      case 
9:
      {
          new 
Float:gztk 4.0*numsize;
        new 
Float:gsdisy 20.0*numsize;
        new 
Float:gsdisx 25.0*numsize;
        
gGangzone[gzid][npart2][0] = GangZoneCreate(centposx-gsdisx-gztk,centposy,centposx-gsdisx+gztk,centposy+gsdisy-gztk); // Left Stick
        
gGangzone[gzid][npart2][1] = GangZoneCreate(centposx+gsdisx,centposy-gsdisy-gztk,centposx+gsdisx+gztk+gztk,centposy+gsdisy+gztk); // Right Stick
        
gGangzone[gzid][npart2][2] = GangZoneCreate(centposx-gsdisx-gztk,centposy+gsdisy-gztk,centposx+gsdisx,centposy+gsdisy+gztk); // Up
        
gGangzone[gzid][npart2][3] = GangZoneCreate(centposx-gsdisx+gztk,centposy,centposx+gsdisx,centposy+gztk+gztk); // Middle
        
gGangzone[gzid][npart2][4] = GangZoneCreate(centposx-gsdisx-gztk,centposy-gsdisy-gztk,centposx+gsdisx,centposy-gsdisy+gztk); // Down
      
}
    }
}
stock GangZoneCreate_(Float:minxFloat:minyFloat:maxxFloat:maxycolor = -1Float:bordersize 1.0bordercolor 0x00000060gznumberFloat:numsize)
{
        new 
E_zone GangZoneCreate(minxminymaxxmaxy);//the main zone
 
        
gGangzone[E_zone][E_minx] = minx;
        
gGangzone[E_zone][E_miny] = miny;
        
gGangzone[E_zone][E_maxx] = maxx;
        
gGangzone[E_zone][E_maxy] = maxy;
 
        for(new 
players 0players MAX_PLAYERSplayers++)//setting player data
        
{
            
gPlayerShown[players][E_zone] = false;
            
gPlayerColor[players][E_zone] = color;
            
gPlayerBorderColor[players][E_zone] = bordercolor;
        }
 
        
#define SEPERATION  (2.0*bordersize)//the seperation value to differenciate borders from gangzone, set accordingly! (Default: 2.0)
        
gGangzone[E_zone][E_border][0] = GangZoneCreate(minx SEPERATIONminyminx SEPERATIONmaxy);//border 1
        
gGangzone[E_zone][E_border][1] = GangZoneCreate(minx SEPERATIONmaxy SEPERATIONmaxxmaxy SEPERATION);//border 2
        
gGangzone[E_zone][E_border][2] = GangZoneCreate(maxx SEPERATIONminymaxx SEPERATIONmaxy);//border 3
        
gGangzone[E_zone][E_border][3] = GangZoneCreate(minx SEPERATIONminy SEPERATIONmaxxminy SEPERATION);//border 4
        
        // Numbers
        
new Float:centposxFloat:centposy;
        
centposx = (minx maxx) / 2;
        
centposy = (miny maxy) / 2;
    
        if(
gznumber >= && gznumber <= 9)
        {
            
GangZoneCreateNumber(E_zonegznumbercentposxcentposynumsize);
        }
        else if(
gznumber && gznumber <= MAX_ZONES)
        {
            new 
temp123[3], gznum1[2], gznum2[2];
            
format(temp123sizeof temp123"%d"gznumber);
            
strmid(gznum1temp12301);
            
strmid(gznum2temp12312);
            
GangZoneCreateNumber(E_zonestrval(gznum1), centposx-(NUMDIS*numsize), centposynumsize);
            
GangZoneCreateNumber2(E_zonestrval(gznum2), centposx+(NUMDIS*numsize), centposynumsize);
        }
     
        
gGangzone[E_zone][E_exist] = true;//finally, zone exists!
        
return E_zone;
}
#if defined _ALS_GangZoneCreate
    #undef GangZoneCreate
#else
    #define _ALS_GangZoneCreate
#endif
#define GangZoneCreate GangZoneCreate_
 
stock GangZoneDestroy_(zone)
{
        if(! 
gGangzone[zone][E_exist]) return false;//check if exists
 
        
for(new players 0players MAX_PLAYERSplayers++)//remove player data
        
{
            
gPlayerColor[players][zone] = -1;
            
gPlayerShown[players][zone] = false;
            
gPlayerBorderColor[players][zone] = -1;
        }
 
        
gGangzone[zone][E_minx] = 0.0;
        
gGangzone[zone][E_miny] = 0.0;
        
gGangzone[zone][E_maxx] = 0.0;
        
gGangzone[zone][E_maxy] = 0.0;
 
        
GangZoneDestroy(zone);//destroy main zone
 
        
for(new border 0border 4border++)//destroy all 4 borders
        
{
            
GangZoneDestroy(gGangzone[zone][E_border][border]);
            for(new 
nump=0nump 5nump++)
            {
                
GangZoneDestroy(gGangzone[zone][npart][nump]);
                
GangZoneDestroy(gGangzone[zone][npart2][nump]);
            }
        }
 
        
gGangzone[zone][E_exist] = false;//finally, zone doesn't exists
        
return true;
}
#if defined _ALS_GangZoneDestroy
    #undef GangZoneDestroy
#else
    #define _ALS_GangZoneDestroy
#endif
#define GangZoneDestroy GangZoneDestroy_
 
stock GangZoneExist(zone)
{
    if(
zone || zone >= MAX_ZONES)
    {
        
printf("Error::GangZoneExist()::Out Of Bounds::%i"zone);//by pottus
        
return false;//if invalid zone id
    
}
    return 
gGangzone[zone][E_exist];//check if zone exists!
}
 
stock GangZoneShowForPlayer_(playeridzonecolor = -1bordercolor = -1)
{
        if(! 
GangZoneExist(zone)) return false;
 
        if(
color != -1gPlayerColor[playerid][zone] = color;
        if(
bordercolor != -1gPlayerBorderColor[playerid][zone] = bordercolor;
 
        
GangZoneShowForPlayer(playeridzonegPlayerColor[playerid][zone]);
        for(new 
border 0border 4border++) GangZoneShowForPlayer(playeridgGangzone[zone][E_border][border], gPlayerBorderColor[playerid][zone]);
        for(new 
numpnump 5nump++)
        {
            if(
gGangzone[zone][npart][nump] != -1)
            {
                
GangZoneShowForPlayer(playeridgGangzone[zone][npart][nump], 0x000000BB);
            }
            if(
gGangzone[zone][npart2][nump] != -1)
            {
                
GangZoneShowForPlayer(playeridgGangzone[zone][npart2][nump], 0x000000BB);
            }
        }
            
        
gPlayerShown[playerid][zone] = true;
 
        return 
true;
}
#if defined _ALS_GangZoneShowForPlayer
    #undef GangZoneShowForPlayer
#else
    #define _ALS_GangZoneShowForPlayer
#endif
#define GangZoneShowForPlayer GangZoneShowForPlayer_
 
stock GangZoneShowForAll_(zonecolor = -1bordercolor = -1)
{
        if(! 
GangZoneExist(zone)) return false;
 
        for(new 
players 0players MAX_PLAYERSplayers++)
        {
            
GangZoneShowForPlayer(playerszonecolor);
            for(new 
border 0border 4border++) GangZoneShowForPlayer(playersgGangzone[zone][E_border][border], bordercolor);
            for(new 
numpnump 5nump++)
            {
                if(
gGangzone[zone][npart][nump] != -1)
                {
                    
GangZoneShowForPlayer(playeridgGangzone[zone][npart][nump], 0x000000BB);
                }
                if(
gGangzone[zone][npart2][nump] != -1)
                {
                    
GangZoneShowForPlayer(playeridgGangzone[zone][npart2][nump], 0x000000BB);
                }
            }
        }
        return 
true;
}
#if defined _ALS_GangZoneShowForAll
    #undef GangZoneShowForAll
#else
    #define _ALS_GangZoneShowForAll
#endif
#define GangZoneShowForAll GangZoneShowForAll_
 
stock GangZoneHideForPlayer_(playeridzone)
{
    if(! 
GangZoneExist(zone)) return false;
    
GangZoneHideForPlayer(playeridzone);
    for(new 
border 0border 4border++) GangZoneHideForPlayer(playeridgGangzone[zone][E_border][border]);
    for(new 
nump=0nump 5nump++)
    {
        
GangZoneHideForPlayer(playeridgGangzone[zone][npart][nump]);
        
GangZoneHideForPlayer(playeridgGangzone[zone][npart2][nump]);
    }
        
    
gPlayerShown[playerid][zone] = false;
    return 
true;
}
#if defined _ALS_GangZoneHideForPlayer
    #undef GangZoneHideForPlayer
#else
    #define _ALS_GangZoneHideForPlayer
#endif
#define GangZoneHideForPlayer GangZoneHideForPlayer_
 
stock GangZoneHideForAll_(zone)
{
        if(! 
GangZoneExist(zone)) return false;
 
        
GangZoneHideForAll(zone);
        for(new 
border 0border 4border++) GangZoneHideForAll(gGangzone[zone][E_border][border]);
 
        for(new 
players 0players MAX_PLAYERSplayers++) gPlayerShown[players][zone] = false;
 
        return 
true;
}
#if defined _ALS_GangZoneHideForAll
    #undef GangZoneHideForAll
#else
    #define _ALS_GangZoneHideForAll
#endif
#define GangZoneHideForAll GangZoneHideForAll_
 
stock GangZoneSetColorForPlayer(playeridzonecolorbordercolor = -1)
{
        if(! 
GangZoneExist(zone)) return false;
 
    if(
gPlayerShown[playerid][zone]) GangZoneShowForPlayer(playeridzonecolorbordercolor);
 
    return 
true;
}
 
stock GangZoneSetColorForAll(zonecolorbordercolor = -1)
{
        if(! 
GangZoneExist(zone)) return false;
 
    for(new 
players 0players MAX_PLAYERSplayers++)
        {
            if(
gPlayerShown[players][zone])
            {
                
GangZoneShowForPlayer(playerszonecolorbordercolor);
            }
    }
        return 
true;
}
//the flashing functions are same as that of samp!
// GangZoneFlashForPlayer(playerid, zone, flashcolor);
 
// GangZoneFlashForAll(zone, flashcolor);
 
// GangZoneStopFlashForPlayer(playerid, zone);
 
// GangZoneStopFlashForAll(zone);
 
stock DestroyAllGangZones()
{
        for(new 
zone 0zone MAX_ZONESzone++)
        {
            if(
GangZoneExist(zone))
            {
                
GangZoneDestroy(zone);
            }
        }
        return 
true;
}
 
stock ShowAllGangZonesForPlayer(playeridcolor = -1bordercolor = -1)
{
        for(new 
zone 0zone MAX_ZONESzone++)
        {
            if(
GangZoneExist(zone))
            {
                
GangZoneShowForPlayer(playeridzonecolorbordercolor);
            }
        }
        return 
true;
}
 
stock ShowAllGangZonesForAll(color = -1bordercolor = -1)
{
        for(new 
zone 0zone MAX_ZONESzone++)
        {
            if(
GangZoneExist(zone))
            {
                
GangZoneShowForAll(zone colorbordercolor);
            }
        }
        return 
true;
}
 
stock HideAllGangZonesForPlayer(playerid)
{
        for(new 
zone 0zone MAX_ZONESzone++)
        {
            if(
GangZoneExist(zone))
            {
                
GangZoneHideForPlayer(playeridzone);
            }
        }
        return 
true;
}
 
stock HideAllGangZonesForAll()
{
        for(new 
zone 0zone MAX_ZONESzone++)
        {
            if(
GangZoneExist(zone))
            {
                
GangZoneHideForAll(zone);
            }
        }
        return 
true;

Reply
#9

Quote:
Originally Posted by Lunoxel
Посмотреть сообщение
I found the problem, it is to include the gZone2. Maybe you can help me to fix it: D.

PHP код:
#include <streamer>
 
#define MAX_ZONES 1024//maximum gangzones your server can have, the limit is upto 1024 and minimum 5
#define NUMDIS 40.0
#define MAX_GANGZONES 68
//Note: Creating one interactive gangzone makes total 5 zones, 4 for borders and 1 for the main zone!
 
enum GangzoneInfo
{
        
bool:E_exist,
        
E_border[4],
        
Float:E_minx,
        
Float:E_miny,
        
Float:E_maxx,
        
Float:E_maxy,
        
npart[5],
        
npart2[5]
}
static 
gGangzone[MAX_ZONES][GangzoneInfo];
 
static 
bool:gPlayerShown[MAX_PLAYERS][MAX_ZONES];
static 
gPlayerColor[MAX_PLAYERS][MAX_ZONES];
static 
gPlayerBorderColor[MAX_PLAYERS][MAX_ZONES];
 
//Note: if you use this in a filterscript, please define "FILTERSCRIPT" in your script
public OnGameModeInit()
{
    
DestroyAllGangZones();//destory all gangzones
    #if defined GZ_OnGameModeInit
                
GZ_OnGameModeInit();
        
#endif
        
return 1;
}
#if defined _ALS_OnGameModeInit
        #undef OnGameModeInit
#else
        #define _ALS_OnGameModeInit
#endif
#define OnGameModeInit GZ_OnGameModeInit
#if defined GZ_OnGameModeInit
        
forward GZ_OnGameModeInit();
#endif
public OnGameModeExit()
{
    
DestroyAllGangZones();//destory all gangzones
    #if defined GZ_OnGameModeExit
                
GZ_OnGameModeExit();
        
#endif
        
return 1;
}
#if defined _ALS_OnGameModeExit
        #undef OnGameModeExit
#else
        #define _ALS_OnGameModeExit
#endif
#define OnGameModeExit GZ_OnGameModeExit
#if defined GZ_OnGameModeExit
        
forward GZ_OnGameModeExit();
#endif
stock GangZoneCreateNumbergzid gznum Float:centposx Float:centposy Float:numsize )
{
    switch(
gznum)
    {
      case 
0:
      {
        new 
Float:gztk 4.0*numsize;
        new 
Float:gsdisx 15.0*numsize;
        new 
Float:gsdisy 20.0*numsize;
        
gGangzone[gzid][npart][0] = GangZoneCreate(centposx-gsdisx-gztk,centposy-gsdisy-gztk,centposx+gsdisx+gztk,centposy-gsdisy+gztk); // Down of 0
        
gGangzone[gzid][npart][1] = GangZoneCreate(centposx-gsdisx-gztk,centposy+gsdisy+gztk,centposx+gsdisx+gztk,centposy+gsdisy-gztk); // Up of 0
        
gGangzone[gzid][npart][2] = GangZoneCreate(centposx-gsdisx-gztk,centposy-gsdisy+gztk,centposx-gsdisx+gztk,centposy+gsdisy-gztk); // Left of 0
        
gGangzone[gzid][npart][3] = GangZoneCreate(centposx+gsdisx-gztk,centposy-gsdisy+gztk,centposx+gsdisx+gztk,centposy+gsdisy-gztk); // Right of 0
      
}
      case 
1:
      {
        new 
Float:gztk 4.0*numsize;
        new 
Float:gsdisy 25.0*numsize;
        
gGangzone[gzid][npart][0] = GangZoneCreate(centposx-gztk,centposy-gsdisy-gztk,centposx+gztk,centposy+gsdisy+gztk);
      }
      case 
2:
      {
        new 
Float:gztk 4.0*numsize;
        new 
Float:gsdisy 20.0*numsize;
        new 
Float:gsdisx 25.0*numsize;
        
gGangzone[gzid][npart][0] = GangZoneCreate(centposx-gsdisx,centposy+gsdisy-gztk,centposx+gsdisx,centposy+gsdisy+gztk); // Up
        
gGangzone[gzid][npart][1] = GangZoneCreate(centposx+gsdisx-gztk-gztk,centposy+gztk,centposx+gsdisx,centposy+gsdisy-gztk); // Right Stick
        
gGangzone[gzid][npart][2] = GangZoneCreate(centposx-gsdisx,centposy-gztk,centposx+gsdisx,centposy+gztk); // Middle
        
gGangzone[gzid][npart][3] = GangZoneCreate(centposx-gsdisx,centposy-gsdisy+gztk,centposx-gsdisx+gztk+gztk,centposy-gztk); // Left Stick
        
gGangzone[gzid][npart][4] = GangZoneCreate(centposx-gsdisx,centposy-gsdisy-gztk,centposx+gsdisx,centposy-gsdisy+gztk); // Down
      
}
      case 
3:
      {
        new 
Float:gztk 4.0*numsize;
        new 
Float:gsdisy 20.0*numsize;
        new 
Float:gsdisx 25.0*numsize;
        
gGangzone[gzid][npart][0] = GangZoneCreate(centposx-gsdisx,centposy+gsdisy-gztk,centposx+gsdisx,centposy+gsdisy+gztk); // Up
        
gGangzone[gzid][npart][1] = GangZoneCreate(centposx+gsdisx,centposy-gsdisy-gztk,centposx+gsdisx+gztk+gztk,centposy+gsdisy+gztk); // Stick
        
gGangzone[gzid][npart][2] = GangZoneCreate(centposx-gsdisx,centposy-gztk,centposx+gsdisx,centposy+gztk); // Middle
        
gGangzone[gzid][npart][3] = GangZoneCreate(centposx-gsdisx,centposy-gsdisy-gztk,centposx+gsdisx,centposy-gsdisy+gztk); // Down
      
}
      case 
4:
      {
          new 
Float:gztk 4.0*numsize;
        new 
Float:gsdisy 20.0*numsize;
        new 
Float:gsdisx 25.0*numsize;
        
gGangzone[gzid][npart][0] = GangZoneCreate(centposx-gsdisx,centposy+gsdisy,centposx-gsdisx+gztk+gztk,centposy+gztk); // Left
        
gGangzone[gzid][npart][1] = GangZoneCreate(centposx-gsdisx,centposy-gztk,centposx+gsdisx,centposy+gztk);// Middle
        
gGangzone[gzid][npart][2] = GangZoneCreate(centposx+gsdisx,centposy-gsdisy,centposx+gsdisx+gztk+gztk,centposy+gsdisy); // Stick
      
}
      case 
5:
      {
          new 
Float:gztk 4.0*numsize;
        new 
Float:gsdisy 20.0*numsize;
        new 
Float:gsdisx 25.0*numsize;
        
gGangzone[gzid][npart][0] = GangZoneCreate(centposx-gsdisx-gztk,centposy+gsdisy-gztk,centposx+gsdisx+gztk,centposy+gsdisy+gztk); // Up
        
gGangzone[gzid][npart][1] = GangZoneCreate(centposx-gsdisx-gztk,centposy+gztk,centposx-gsdisx+gztk,centposy+gsdisy-gztk); // Left Stick
        
gGangzone[gzid][npart][2] = GangZoneCreate(centposx-gsdisx-gztk,centposy-gztk,centposx+gsdisx+gztk,centposy+gztk); // Middle
        
gGangzone[gzid][npart][3] = GangZoneCreate(centposx+gsdisx-gztk,centposy-gztk,centposx+gsdisx+gztk,centposy-gsdisy+gztk); // Right Stick
        
gGangzone[gzid][npart][4] = GangZoneCreate(centposx-gsdisx-gztk,centposy-gsdisy-gztk,centposx+gsdisx+gztk,centposy-gsdisy+gztk); // Down
      
}
      case 
6:
      {
          new 
Float:gztk 4.0*numsize;
        new 
Float:gsdisy 20.0*numsize;
        new 
Float:gsdisx 25.0*numsize;
        
gGangzone[gzid][npart][0] = GangZoneCreate(centposx-gsdisx,centposy+gsdisy-gztk,centposx+gsdisx,centposy+gsdisy+gztk); // Up
        
gGangzone[gzid][npart][1] = GangZoneCreate(centposx-gsdisx-gztk-gztk,centposy+gsdisy+gztk,centposx-gsdisx,centposy-gsdisy-gztk); // Main Left Stick
        
gGangzone[gzid][npart][2] = GangZoneCreate(centposx-gsdisx,centposy-gztk,centposx+gsdisx,centposy+gztk); // Middle
        
gGangzone[gzid][npart][3] = GangZoneCreate(centposx-gsdisx,centposy-gsdisy-gztk,centposx+gsdisx,centposy-gsdisy+gztk); // Down
        
gGangzone[gzid][npart][4] = GangZoneCreate(centposx+gsdisx-gztk-gztk,centposy-gsdisy+gztk,centposx+gsdisx,centposy-gztk); // Right small stick
      
}
      case 
7:
      {
        new 
Float:gztk 4.0*numsize;
        new 
Float:gsdisy 20.0*numsize;
        new 
Float:gsdisx 15.0*numsize;
        
gGangzone[gzid][npart][0] = GangZoneCreate(centposx+gsdisx-gztk,centposy-gsdisy-gztk,centposx+gsdisx+gztk,centposy+gsdisy-gztk); // Stick of 1
        
gGangzone[gzid][npart][1] = GangZoneCreate(centposx-gsdisx,centposy+gsdisy-gztk,centposx+gsdisx+gztk,centposy+gsdisy+gztk); // Up of 1
      
}
      case 
8:
      {
          new 
Float:gztk 4.0*numsize;
        new 
Float:gsdisy 20.0*numsize;
        new 
Float:gsdisx 25.0*numsize;
        
gGangzone[gzid][npart][0] = GangZoneCreate(centposx-gsdisx-gztk,centposy+gsdisy+gztk,centposx-gsdisx+gztk,centposy-gsdisy-gztk); // Left stick
        
gGangzone[gzid][npart][1] = GangZoneCreate(centposx+gsdisx-gztk,centposy+gsdisy+gztk,centposx+gsdisx+gztk,centposy-gsdisy-gztk); // Right stick
        
gGangzone[gzid][npart][2] = GangZoneCreate(centposx-gsdisx+gztk,centposy+gsdisy-gztk,centposx+gsdisx-gztk,centposy+gsdisy+gztk); // Up
        
gGangzone[gzid][npart][3] = GangZoneCreate(centposx-gsdisx+gztk,centposy-gztk,centposx+gsdisx-gztk,centposy+gztk); // Center
        
gGangzone[gzid][npart][4] = GangZoneCreate(centposx-gsdisx+gztk,centposy-gsdisy-gztk,centposx+gsdisx-gztk,centposy-gsdisy+gztk); // Down
      
}
      case 
9:
      {
          new 
Float:gztk 4.0*numsize;
        new 
Float:gsdisy 20.0*numsize;
        new 
Float:gsdisx 25.0*numsize;
        
gGangzone[gzid][npart][0] = GangZoneCreate(centposx-gsdisx-gztk,centposy,centposx-gsdisx+gztk,centposy+gsdisy-gztk); // Left Stick
        
gGangzone[gzid][npart][1] = GangZoneCreate(centposx+gsdisx,centposy-gsdisy-gztk,centposx+gsdisx+gztk+gztk,centposy+gsdisy+gztk); // Right Stick
        
gGangzone[gzid][npart][2] = GangZoneCreate(centposx-gsdisx-gztk,centposy+gsdisy-gztk,centposx+gsdisx,centposy+gsdisy+gztk); // Up
        
gGangzone[gzid][npart][3] = GangZoneCreate(centposx-gsdisx+gztk,centposy,centposx+gsdisx,centposy+gztk+gztk); // Middle
        
gGangzone[gzid][npart][4] = GangZoneCreate(centposx-gsdisx-gztk,centposy-gsdisy-gztk,centposx+gsdisx,centposy-gsdisy+gztk); // Down
      
}
    }
}
stock GangZoneCreateNumber2gzid gznum Float:centposx Float:centposy Float:numsize)
{
    switch(
gznum)
    {
      case 
0:
      {
        new 
Float:gztk 4.0*numsize;
        new 
Float:gsdisx 15.0*numsize;
        new 
Float:gsdisy 20.0*numsize;
        
gGangzone[gzid][npart2][0] = GangZoneCreate(centposx-gsdisx-gztk,centposy-gsdisy-gztk,centposx+gsdisx+gztk,centposy-gsdisy+gztk); // Down of 0
        
gGangzone[gzid][npart2][1] = GangZoneCreate(centposx-gsdisx-gztk,centposy+gsdisy+gztk,centposx+gsdisx+gztk,centposy+gsdisy-gztk); // Up of 0
        
gGangzone[gzid][npart2][2] = GangZoneCreate(centposx-gsdisx-gztk,centposy-gsdisy+gztk,centposx-gsdisx+gztk,centposy+gsdisy-gztk); // Left of 0
        
gGangzone[gzid][npart2][3] = GangZoneCreate(centposx+gsdisx-gztk,centposy-gsdisy+gztk,centposx+gsdisx+gztk,centposy+gsdisy-gztk); // Right of 0
      
}
      case 
1:
      {
        new 
Float:gztk 4.0*numsize;
        new 
Float:gsdisy 25.0*numsize;
        
gGangzone[gzid][npart2][0] = GangZoneCreate(centposx-gztk,centposy-gsdisy-gztk,centposx+gztk,centposy+gsdisy+gztk);
      }
      case 
2:
      {
        new 
Float:gztk 4.0*numsize;
        new 
Float:gsdisy 20.0*numsize;
        new 
Float:gsdisx 25.0*numsize;
        
gGangzone[gzid][npart2][0] = GangZoneCreate(centposx-gsdisx,centposy+gsdisy-gztk,centposx+gsdisx,centposy+gsdisy+gztk); // Up
        
gGangzone[gzid][npart2][1] = GangZoneCreate(centposx+gsdisx-gztk-gztk,centposy+gztk,centposx+gsdisx,centposy+gsdisy-gztk); // Right Stick
        
gGangzone[gzid][npart2][2] = GangZoneCreate(centposx-gsdisx,centposy-gztk,centposx+gsdisx,centposy+gztk); // Middle
        
gGangzone[gzid][npart2][3] = GangZoneCreate(centposx-gsdisx,centposy-gsdisy+gztk,centposx-gsdisx+gztk+gztk,centposy-gztk); // Left Stick
        
gGangzone[gzid][npart2][4] = GangZoneCreate(centposx-gsdisx,centposy-gsdisy-gztk,centposx+gsdisx,centposy-gsdisy+gztk); // Down
      
}
      case 
3:
      {
        new 
Float:gztk 4.0*numsize;
        new 
Float:gsdisy 20.0*numsize;
        new 
Float:gsdisx 25.0*numsize;
        
gGangzone[gzid][npart2][0] = GangZoneCreate(centposx-gsdisx,centposy+gsdisy-gztk,centposx+gsdisx,centposy+gsdisy+gztk); // Up
        
gGangzone[gzid][npart2][1] = GangZoneCreate(centposx+gsdisx,centposy-gsdisy-gztk,centposx+gsdisx+gztk+gztk,centposy+gsdisy+gztk); // Stick
        
gGangzone[gzid][npart2][2] = GangZoneCreate(centposx-gsdisx,centposy-gztk,centposx+gsdisx,centposy+gztk); // Middle
        
gGangzone[gzid][npart2][3] = GangZoneCreate(centposx-gsdisx,centposy-gsdisy-gztk,centposx+gsdisx,centposy-gsdisy+gztk); // Down
      
}
      case 
4:
      {
          new 
Float:gztk 4.0*numsize;
        new 
Float:gsdisy 20.0*numsize;
        new 
Float:gsdisx 25.0*numsize;
        
gGangzone[gzid][npart2][0] = GangZoneCreate(centposx-gsdisx,centposy+gsdisy,centposx-gsdisx+gztk+gztk,centposy+gztk); // Left
        
gGangzone[gzid][npart2][1] = GangZoneCreate(centposx-gsdisx,centposy-gztk,centposx+gsdisx,centposy+gztk);// Middle
        
gGangzone[gzid][npart2][2] = GangZoneCreate(centposx+gsdisx,centposy-gsdisy,centposx+gsdisx+gztk+gztk,centposy+gsdisy); // Stick
      
}
      case 
5:
      {
          new 
Float:gztk 4.0*numsize;
        new 
Float:gsdisy 20.0*numsize;
        new 
Float:gsdisx 25.0*numsize;
        
gGangzone[gzid][npart2][0] = GangZoneCreate(centposx-gsdisx-gztk,centposy+gsdisy-gztk,centposx+gsdisx+gztk,centposy+gsdisy+gztk); // Up
        
gGangzone[gzid][npart2][1] = GangZoneCreate(centposx-gsdisx-gztk,centposy+gztk,centposx-gsdisx+gztk,centposy+gsdisy-gztk); // Left Stick
        
gGangzone[gzid][npart2][2] = GangZoneCreate(centposx-gsdisx-gztk,centposy-gztk,centposx+gsdisx+gztk,centposy+gztk); // Middle
        
gGangzone[gzid][npart2][3] = GangZoneCreate(centposx+gsdisx-gztk,centposy-gztk,centposx+gsdisx+gztk,centposy-gsdisy+gztk); // Right Stick
        
gGangzone[gzid][npart2][4] = GangZoneCreate(centposx-gsdisx-gztk,centposy-gsdisy-gztk,centposx+gsdisx+gztk,centposy-gsdisy+gztk); // Down
      
}
      case 
6:
      {
          new 
Float:gztk 4.0*numsize;
        new 
Float:gsdisy 20.0*numsize;
        new 
Float:gsdisx 25.0*numsize;
        
gGangzone[gzid][npart2][0] = GangZoneCreate(centposx-gsdisx,centposy+gsdisy-gztk,centposx+gsdisx,centposy+gsdisy+gztk); // Up
        
gGangzone[gzid][npart2][1] = GangZoneCreate(centposx-gsdisx-gztk-gztk,centposy+gsdisy+gztk,centposx-gsdisx,centposy-gsdisy-gztk); // Main Left Stick
        
gGangzone[gzid][npart2][2] = GangZoneCreate(centposx-gsdisx,centposy-gztk,centposx+gsdisx,centposy+gztk); // Middle
        
gGangzone[gzid][npart2][3] = GangZoneCreate(centposx-gsdisx,centposy-gsdisy-gztk,centposx+gsdisx,centposy-gsdisy+gztk); // Down
        
gGangzone[gzid][npart2][4] = GangZoneCreate(centposx+gsdisx-gztk-gztk,centposy-gsdisy+gztk,centposx+gsdisx,centposy-gztk); // Right small stick
      
}
      case 
7:
      {
        new 
Float:gztk 4.0*numsize;
        new 
Float:gsdisy 20.0*numsize;
        new 
Float:gsdisx 15.0*numsize;
        
gGangzone[gzid][npart2][0] = GangZoneCreate(centposx+gsdisx-gztk,centposy-gsdisy-gztk,centposx+gsdisx+gztk,centposy+gsdisy-gztk); // Stick of 1
        
gGangzone[gzid][npart2][1] = GangZoneCreate(centposx-gsdisx,centposy+gsdisy-gztk,centposx+gsdisx+gztk,centposy+gsdisy+gztk); // Up of 1
      
}
      case 
8:
      {
          new 
Float:gztk 4.0*numsize;
        new 
Float:gsdisy 20.0*numsize;
        new 
Float:gsdisx 25.0*numsize;
        
gGangzone[gzid][npart2][0] = GangZoneCreate(centposx-gsdisx-gztk,centposy+gsdisy+gztk,centposx-gsdisx+gztk,centposy-gsdisy-gztk); // Left stick
        
gGangzone[gzid][npart2][1] = GangZoneCreate(centposx+gsdisx-gztk,centposy+gsdisy+gztk,centposx+gsdisx+gztk,centposy-gsdisy-gztk); // Right stick
        
gGangzone[gzid][npart2][2] = GangZoneCreate(centposx-gsdisx+gztk,centposy+gsdisy-gztk,centposx+gsdisx-gztk,centposy+gsdisy+gztk); // Up
        
gGangzone[gzid][npart2][3] = GangZoneCreate(centposx-gsdisx+gztk,centposy-gztk,centposx+gsdisx-gztk,centposy+gztk); // Center
        
gGangzone[gzid][npart2][4] = GangZoneCreate(centposx-gsdisx+gztk,centposy-gsdisy-gztk,centposx+gsdisx-gztk,centposy-gsdisy+gztk); // Down
      
}
      case 
9:
      {
          new 
Float:gztk 4.0*numsize;
        new 
Float:gsdisy 20.0*numsize;
        new 
Float:gsdisx 25.0*numsize;
        
gGangzone[gzid][npart2][0] = GangZoneCreate(centposx-gsdisx-gztk,centposy,centposx-gsdisx+gztk,centposy+gsdisy-gztk); // Left Stick
        
gGangzone[gzid][npart2][1] = GangZoneCreate(centposx+gsdisx,centposy-gsdisy-gztk,centposx+gsdisx+gztk+gztk,centposy+gsdisy+gztk); // Right Stick
        
gGangzone[gzid][npart2][2] = GangZoneCreate(centposx-gsdisx-gztk,centposy+gsdisy-gztk,centposx+gsdisx,centposy+gsdisy+gztk); // Up
        
gGangzone[gzid][npart2][3] = GangZoneCreate(centposx-gsdisx+gztk,centposy,centposx+gsdisx,centposy+gztk+gztk); // Middle
        
gGangzone[gzid][npart2][4] = GangZoneCreate(centposx-gsdisx-gztk,centposy-gsdisy-gztk,centposx+gsdisx,centposy-gsdisy+gztk); // Down
      
}
    }
}
stock GangZoneCreate_(Float:minxFloat:minyFloat:maxxFloat:maxycolor = -1Float:bordersize 1.0bordercolor 0x00000060gznumberFloat:numsize)
{
        new 
E_zone GangZoneCreate(minxminymaxxmaxy);//the main zone
 
        
gGangzone[E_zone][E_minx] = minx;
        
gGangzone[E_zone][E_miny] = miny;
        
gGangzone[E_zone][E_maxx] = maxx;
        
gGangzone[E_zone][E_maxy] = maxy;
 
        for(new 
players 0players MAX_PLAYERSplayers++)//setting player data
        
{
            
gPlayerShown[players][E_zone] = false;
            
gPlayerColor[players][E_zone] = color;
            
gPlayerBorderColor[players][E_zone] = bordercolor;
        }
 
        
#define SEPERATION  (2.0*bordersize)//the seperation value to differenciate borders from gangzone, set accordingly! (Default: 2.0)
        
gGangzone[E_zone][E_border][0] = GangZoneCreate(minx SEPERATIONminyminx SEPERATIONmaxy);//border 1
        
gGangzone[E_zone][E_border][1] = GangZoneCreate(minx SEPERATIONmaxy SEPERATIONmaxxmaxy SEPERATION);//border 2
        
gGangzone[E_zone][E_border][2] = GangZoneCreate(maxx SEPERATIONminymaxx SEPERATIONmaxy);//border 3
        
gGangzone[E_zone][E_border][3] = GangZoneCreate(minx SEPERATIONminy SEPERATIONmaxxminy SEPERATION);//border 4
        
        // Numbers
        
new Float:centposxFloat:centposy;
        
centposx = (minx maxx) / 2;
        
centposy = (miny maxy) / 2;
    
        if(
gznumber >= && gznumber <= 9)
        {
            
GangZoneCreateNumber(E_zonegznumbercentposxcentposynumsize);
        }
        else if(
gznumber && gznumber <= MAX_ZONES)
        {
            new 
temp123[3], gznum1[2], gznum2[2];
            
format(temp123sizeof temp123"%d"gznumber);
            
strmid(gznum1temp12301);
            
strmid(gznum2temp12312);
            
GangZoneCreateNumber(E_zonestrval(gznum1), centposx-(NUMDIS*numsize), centposynumsize);
            
GangZoneCreateNumber2(E_zonestrval(gznum2), centposx+(NUMDIS*numsize), centposynumsize);
        }
     
        
gGangzone[E_zone][E_exist] = true;//finally, zone exists!
        
return E_zone;
}
#if defined _ALS_GangZoneCreate
    #undef GangZoneCreate
#else
    #define _ALS_GangZoneCreate
#endif
#define GangZoneCreate GangZoneCreate_
 
stock GangZoneDestroy_(zone)
{
        if(! 
gGangzone[zone][E_exist]) return false;//check if exists
 
        
for(new players 0players MAX_PLAYERSplayers++)//remove player data
        
{
            
gPlayerColor[players][zone] = -1;
            
gPlayerShown[players][zone] = false;
            
gPlayerBorderColor[players][zone] = -1;
        }
 
        
gGangzone[zone][E_minx] = 0.0;
        
gGangzone[zone][E_miny] = 0.0;
        
gGangzone[zone][E_maxx] = 0.0;
        
gGangzone[zone][E_maxy] = 0.0;
 
        
GangZoneDestroy(zone);//destroy main zone
 
        
for(new border 0border 4border++)//destroy all 4 borders
        
{
            
GangZoneDestroy(gGangzone[zone][E_border][border]);
            for(new 
nump=0nump 5nump++)
            {
                
GangZoneDestroy(gGangzone[zone][npart][nump]);
                
GangZoneDestroy(gGangzone[zone][npart2][nump]);
            }
        }
 
        
gGangzone[zone][E_exist] = false;//finally, zone doesn't exists
        
return true;
}
#if defined _ALS_GangZoneDestroy
    #undef GangZoneDestroy
#else
    #define _ALS_GangZoneDestroy
#endif
#define GangZoneDestroy GangZoneDestroy_
 
stock GangZoneExist(zone)
{
    if(
zone || zone >= MAX_ZONES)
    {
        
printf("Error::GangZoneExist()::Out Of Bounds::%i"zone);//by pottus
        
return false;//if invalid zone id
    
}
    return 
gGangzone[zone][E_exist];//check if zone exists!
}
 
stock GangZoneShowForPlayer_(playeridzonecolor = -1bordercolor = -1)
{
        if(! 
GangZoneExist(zone)) return false;
 
        if(
color != -1gPlayerColor[playerid][zone] = color;
        if(
bordercolor != -1gPlayerBorderColor[playerid][zone] = bordercolor;
 
        
GangZoneShowForPlayer(playeridzonegPlayerColor[playerid][zone]);
        for(new 
border 0border 4border++) GangZoneShowForPlayer(playeridgGangzone[zone][E_border][border], gPlayerBorderColor[playerid][zone]);
        for(new 
numpnump 5nump++)
        {
            if(
gGangzone[zone][npart][nump] != -1)
            {
                
GangZoneShowForPlayer(playeridgGangzone[zone][npart][nump], 0x000000BB);
            }
            if(
gGangzone[zone][npart2][nump] != -1)
            {
                
GangZoneShowForPlayer(playeridgGangzone[zone][npart2][nump], 0x000000BB);
            }
        }
            
        
gPlayerShown[playerid][zone] = true;
 
        return 
true;
}
#if defined _ALS_GangZoneShowForPlayer
    #undef GangZoneShowForPlayer
#else
    #define _ALS_GangZoneShowForPlayer
#endif
#define GangZoneShowForPlayer GangZoneShowForPlayer_
 
stock GangZoneShowForAll_(zonecolor = -1bordercolor = -1)
{
        if(! 
GangZoneExist(zone)) return false;
 
        for(new 
players 0players MAX_PLAYERSplayers++)
        {
            
GangZoneShowForPlayer(playerszonecolor);
            for(new 
border 0border 4border++) GangZoneShowForPlayer(playersgGangzone[zone][E_border][border], bordercolor);
            for(new 
numpnump 5nump++)
            {
                if(
gGangzone[zone][npart][nump] != -1)
                {
                    
GangZoneShowForPlayer(playeridgGangzone[zone][npart][nump], 0x000000BB);
                }
                if(
gGangzone[zone][npart2][nump] != -1)
                {
                    
GangZoneShowForPlayer(playeridgGangzone[zone][npart2][nump], 0x000000BB);
                }
            }
        }
        return 
true;
}
#if defined _ALS_GangZoneShowForAll
    #undef GangZoneShowForAll
#else
    #define _ALS_GangZoneShowForAll
#endif
#define GangZoneShowForAll GangZoneShowForAll_
 
stock GangZoneHideForPlayer_(playeridzone)
{
    if(! 
GangZoneExist(zone)) return false;
    
GangZoneHideForPlayer(playeridzone);
    for(new 
border 0border 4border++) GangZoneHideForPlayer(playeridgGangzone[zone][E_border][border]);
    for(new 
nump=0nump 5nump++)
    {
        
GangZoneHideForPlayer(playeridgGangzone[zone][npart][nump]);
        
GangZoneHideForPlayer(playeridgGangzone[zone][npart2][nump]);
    }
        
    
gPlayerShown[playerid][zone] = false;
    return 
true;
}
#if defined _ALS_GangZoneHideForPlayer
    #undef GangZoneHideForPlayer
#else
    #define _ALS_GangZoneHideForPlayer
#endif
#define GangZoneHideForPlayer GangZoneHideForPlayer_
 
stock GangZoneHideForAll_(zone)
{
        if(! 
GangZoneExist(zone)) return false;
 
        
GangZoneHideForAll(zone);
        for(new 
border 0border 4border++) GangZoneHideForAll(gGangzone[zone][E_border][border]);
 
        for(new 
players 0players MAX_PLAYERSplayers++) gPlayerShown[players][zone] = false;
 
        return 
true;
}
#if defined _ALS_GangZoneHideForAll
    #undef GangZoneHideForAll
#else
    #define _ALS_GangZoneHideForAll
#endif
#define GangZoneHideForAll GangZoneHideForAll_
 
stock GangZoneSetColorForPlayer(playeridzonecolorbordercolor = -1)
{
        if(! 
GangZoneExist(zone)) return false;
 
    if(
gPlayerShown[playerid][zone]) GangZoneShowForPlayer(playeridzonecolorbordercolor);
 
    return 
true;
}
 
stock GangZoneSetColorForAll(zonecolorbordercolor = -1)
{
        if(! 
GangZoneExist(zone)) return false;
 
    for(new 
players 0players MAX_PLAYERSplayers++)
        {
            if(
gPlayerShown[players][zone])
            {
                
GangZoneShowForPlayer(playerszonecolorbordercolor);
            }
    }
        return 
true;
}
//the flashing functions are same as that of samp!
// GangZoneFlashForPlayer(playerid, zone, flashcolor);
 
// GangZoneFlashForAll(zone, flashcolor);
 
// GangZoneStopFlashForPlayer(playerid, zone);
 
// GangZoneStopFlashForAll(zone);
 
stock DestroyAllGangZones()
{
        for(new 
zone 0zone MAX_ZONESzone++)
        {
            if(
GangZoneExist(zone))
            {
                
GangZoneDestroy(zone);
            }
        }
        return 
true;
}
 
stock ShowAllGangZonesForPlayer(playeridcolor = -1bordercolor = -1)
{
        for(new 
zone 0zone MAX_ZONESzone++)
        {
            if(
GangZoneExist(zone))
            {
                
GangZoneShowForPlayer(playeridzonecolorbordercolor);
            }
        }
        return 
true;
}
 
stock ShowAllGangZonesForAll(color = -1bordercolor = -1)
{
        for(new 
zone 0zone MAX_ZONESzone++)
        {
            if(
GangZoneExist(zone))
            {
                
GangZoneShowForAll(zone colorbordercolor);
            }
        }
        return 
true;
}
 
stock HideAllGangZonesForPlayer(playerid)
{
        for(new 
zone 0zone MAX_ZONESzone++)
        {
            if(
GangZoneExist(zone))
            {
                
GangZoneHideForPlayer(playeridzone);
            }
        }
        return 
true;
}
 
stock HideAllGangZonesForAll()
{
        for(new 
zone 0zone MAX_ZONESzone++)
        {
            if(
GangZoneExist(zone))
            {
                
GangZoneHideForAll(zone);
            }
        }
        return 
true;

Specify the Errors: mark line. Too much code
Reply
#10

Do not show the line, pawn no gives me any error, just give crashdetect in server_log.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)