Jump to content
  • 0

Eroare Consola


alexandru2304

Question

Salut, de curand am gasit un gamemode pe net, si nu inteleg ce are. 

Am rezolvat toate bugurile, erorile dar aceasta nu stiu s-o rezolv.

[debug] AMX backtrace:

"[debug] Run time error 4: "Array index out of bounds"

[debug] Accessing element at index 49 past array upper bound 48

[debug]#0 0005bf14 in public SetPlayerUnjail <>from gamemode.amx

"

public SetPlayerUnjail()
{
    if(painttime > 0)
    {
        foreach(Player, x)
        {
            foreach(Player, a)
            {
                if(PlayerPaintballing[x] != 0 && PlayerPaintballing[a] != 0)
                {
                    SetPlayerMarkerForPlayer(x, a, GetPlayerColor(a));
                }
            }
        }
        painttime--;
        if(painttime == 0)
        {
            foreach(Player, x)
            {
                foreach(Player, a)
                {
                    if(PlayerPaintballing[x] == 0 && PlayerPaintballing[a] == 0)
                    {
                        SetPlayerMarkerForPlayer( x, a, ( GetPlayerColor( a ) & 0xFFFFFF00 ) );
                    }
                }
            }
        }
    }
    foreach(Player, z)
    {
        if(playerVariables[z][pDD] >= 1)
        {
            playerVariables[z][pDD] --;
        }
        if(playerVariables[z][pDs] >= 1)
        {
            playerVariables[z][pDs] --;
        }
        if(playerVariables[z][pDr] >= 1)
        {
            playerVariables[z][pDr] --;
        }
    }
    for(new iGroup; iGroup < MAX_GROUPS; iGroup++)
    {
        if(groupVariables[iGroup][gDeelay] >= 1)
        {
            groupVariables[iGroup][gDeelay]--;
        }
    }
    for(new i = 0; i <= sizeof(TurfInfo); i++)
    {
        new string[256];
        new count = 0;
        new att = WarInfo[wAttacker];
        new deff = WarInfo[wFaction];
        if(WarInfo[wTime] > 0)
        {
            WarInfo[wTime] -= 1;
            foreach(Player, x)
            {
                if(playerVariables[x][pGroup] == WarInfo[wAttacker])
                {
                     if(IsPlayerInTurf(x , i))
                    {
                        count++;
                    }
                }

                if(groupVariables[playerVariables[x][pGroup]][gInWar] == 0)
                {
                    foreach(Player, a)
                    {
                        SetPlayerMarkerForPlayer( x, a, ( GetPlayerColor( a ) & 0xFFFFFF00 ) );
                    }
                }
                 if(playerVariables[x][pGroup] == WarInfo[wAttacker] || playerVariables[x][pGroup] == WarInfo[wFaction])
                {
                    new time = WarInfo[wTime];
                    TextDrawShowForPlayer(x, tTimer[x]);
                    format(string, sizeof(string), "War time: ~y~%s ~w~", CalculeazaTimp(time));
                    TextDrawSetString(tTimer[x], string);
                    GangZoneFlashForPlayer(x, Turfs, COLOR_RED);
                    if(IsPlayerInTurf(x, i))
                    {
                        if(IsPlayerInAnyVehicle(x))
                        {
                            if(JustRemoved[x] == 0)
                            {
                                RemovePlayerFromVehicle(x);
                                SendClientMessage(x, COLOR_RED, "Nu ai voie intr-o masina pe turf!");
                                JustRemoved[x] = 1;
                            }
                        }
                    }

                    foreach(Player, a)
                    {
                        if((playerVariables[x][pGroup] == WarInfo[wAttacker] || playerVariables[x][pGroup] == WarInfo[wFaction]) && groupVariables[playerVariables[x][pGroup]][gInWar] == 1 && (playerVariables[a][pGroup] == WarInfo[wAttacker] || playerVariables[a][pGroup] == WarInfo[wFaction]))
                        {
                            SetPlayerMarkerForPlayer(x, a, GetPlayerColor(a));
                        }
                    }

                    if(GetPlayerState(x) == PLAYER_STATE_ONFOOT)
                    {
                        JustRemoved[x] = 0;
                    }

                }
                else if(playerVariables[x][pGroup] == 0)
                {
                    TextDrawHideForPlayer(x, tTimer[x]);
                    GangZoneStopFlashForPlayer(x, Turfs);
                }
            }
            if(count == 0)
            {

                    groupVariables[WarInfo[wFaction]][gInWar] = 0;
                    groupVariables[WarInfo[wAttacker]][gInWar] = 0;
                    groupVariables[att][gDeelay] = 600;
                    new id;
                    id = CalculateBestScore(i);
                    new id2 = CalculateWorstScore(i);
                    format(szMessage, sizeof(szMessage), "--------------------[war overview]-----------------");
                    SendToGroup(att, COLOR_ATTACK, szMessage);
                    SendToGroup(deff, COLOR_ATTACK, szMessage);
                    format(szMessage, sizeof(szMessage), "Score: %s %d - %d %s",groupVariables[WarInfo[wAttacker]][gGroupName] , groupVariables[WarInfo[wAttacker]][gScore], groupVariables[deff][gScore], groupVariables[deff][gGroupName]);
                    SendToGroup(att, COLOR_ATTACK, szMessage);
                    SendToGroup(deff, COLOR_ATTACK, szMessage);
                    format(szMessage, sizeof(szMessage), "Best score: %s (%i). Worst score: %s (%i)", playerVariables[id][pNormalName], playerVariables[id][pWarScore] - playerVariables[id][pWarDeaths], playerVariables[id2][pNormalName], playerVariables[id2][pWarScore] - playerVariables[id2][pWarDeaths]);
                    SendToGroup(att, COLOR_ATTACK, szMessage);
                    SendToGroup(deff, COLOR_ATTACK, szMessage);
                    foreach(Player, z)
                    {
                        TextDrawHideForPlayer(z, tTimer[z]);
                        if(playerVariables[z][pGroup] == att || playerVariables[z][pGroup] == deff)
                        {
                            foreach(Player, a)
                            {
                                SetPlayerMarkerForPlayer( z, a, ( GetPlayerColor( a ) & 0xFFFFFF00 ) );
                            }
                            TextDrawHideForPlayer(z, tTimer[z]);
                            format(szMessage, sizeof(szMessage), "Your personal score: %i", playerVariables[z][pWarScore] - playerVariables[z][pWarDeaths]);
                            SendClientMessage(z, COLOR_ATTACK, szMessage);
                            playerVariables[z][pWarScore] = 0;
                            playerVariables[z][pWarDeaths] = 0;
                            GangZoneShowForPlayerEx(z, Turfs, GetTeamZoneColor(TurfInfo[zOwned]));
                            TextDrawHideForPlayer(z, War0[z]);
                            TextDrawHideForPlayer(z, War1[z]);
                            TextDrawHideForPlayer(z, War2[z]);
                            TextDrawHideForPlayer(z, War3[z]);

                            JustRemoved[z] = 0;
                        }
                    }
                    format(szMessage, sizeof(szMessage), "-------------------------------------");
                    SendToGroup(att, COLOR_ATTACK, szMessage);
                    SendToGroup(deff, COLOR_ATTACK, szMessage);
                    format(szMessage, sizeof(szMessage), "[WAR] %s failed to win turf %i owned by %s because they left the turf.", groupVariables[att][gGroupName], i, groupVariables[deff][gGroupName]);
                    SendToGroup(att, COLOR_ATTACK, szMessage);
                    SendToGroup(deff, COLOR_ATTACK, szMessage);
                    GangZoneStopFlashForAll(Turfs);
                    WarInfo[wTime] = 0;
                    WarInfo[wAttacker] = 0;
                    WarInfo[wFaction] = 0;
            }
            if(WarInfo[wTime] == 2)
            {
                if(groupVariables[WarInfo[wAttacker]][gScore] > groupVariables[WarInfo[wFaction]][gScore])
                {
                    TurfInfo[zOwned] = WarInfo[wAttacker];
                    format(result, sizeof(result), "UPDATE turfs SET Owned = '%d' WHERE ID = %d", TurfInfo[zOwned], i);
                    mysql_tquery(handle, result);
                    format(szMessage, sizeof(szMessage), "NR AdmBot: Gruparea mafiota %s a cucerit teritoriul %i care era detinut de mafia %s.", groupVariables[att][gGroupName], i, groupVariables[deff][gGroupName]);
                    SendClientMessageToAll(COLOR_NEWSRP, szMessage);
                     groupVariables[att][gDeelay] = 300;
                }
                   else if(groupVariables[WarInfo[wAttacker]][gScore] < groupVariables[WarInfo[wFaction]][gScore])
                {
                    TurfInfo[zOwned] = WarInfo[wFaction];
                    format(result, sizeof(result), "UPDATE turfs SET Owned = '%d' WHERE ID = %d", TurfInfo[zOwned], i);
                    mysql_tquery(handle, result);
                    groupVariables[att][gDeelay] = 600;
                    format(szMessage, sizeof(szMessage), "[WAR] %s failed to win turf %i owned by %s.", groupVariables[att][gGroupName], i, groupVariables[deff][gGroupName]);
                    SendToGroup(att, COLOR_ATTACK, szMessage);
                    SendToGroup(deff, COLOR_ATTACK, szMessage);
                }
                else if(groupVariables[WarInfo[wAttacker]][gScore] == groupVariables[WarInfo[wFaction]][gScore])
                {
                    TurfInfo[zOwned] = WarInfo[wFaction];
                    format(result, sizeof(result), "UPDATE turfs SET Owned = '%d' WHERE ID = %d", TurfInfo[zOwned], i);
                    mysql_tquery(handle, result);
                    groupVariables[att][gDeelay] = 600;
                    format(szMessage, sizeof(szMessage), "[WAR] %s failed to win turf %i owned by %s.", groupVariables[att][gGroupName], i, groupVariables[deff][gGroupName]);
                    SendToGroup(att, COLOR_ATTACK, szMessage);
                    SendToGroup(deff, COLOR_ATTACK, szMessage);
                }
                new id;
                id = CalculateBestScore(i);
                new id2 = CalculateWorstScore(i);
                groupVariables[WarInfo[wFaction]][gInWar] = 0;
                groupVariables[WarInfo[wAttacker]][gInWar] = 0;
                format(szMessage, sizeof(szMessage), "--------------------[war overview]-----------------");
                SendToGroup(att, COLOR_ATTACK, szMessage);
                SendToGroup(deff, COLOR_ATTACK, szMessage);
                format(szMessage, sizeof(szMessage), "Score: %s %d - %d %s",groupVariables[WarInfo[wAttacker]][gGroupName] , groupVariables[WarInfo[wAttacker]][gScore], groupVariables[deff][gScore], groupVariables[deff][gGroupName]);
                SendToGroup(att, COLOR_ATTACK, szMessage);
                SendToGroup(deff, COLOR_ATTACK, szMessage);
                format(szMessage, sizeof(szMessage), "Best score: %s (%i). Worst score: %s (%i)", playerVariables[id][pNormalName], playerVariables[id][pWarScore] - playerVariables[id][pWarDeaths], playerVariables[id2][pNormalName], playerVariables[id2][pWarScore] - playerVariables[id2][pWarDeaths]);
                SendToGroup(att, COLOR_ATTACK, szMessage);
                SendToGroup(deff, COLOR_ATTACK, szMessage);
                foreach(Player, z)
                {
                    TextDrawHideForPlayer(z, tTimer[z]);
                    if(playerVariables[z][pGroup] == att || playerVariables[z][pGroup] == deff)
                    {
                        foreach(Player, a)
                        {
                            SetPlayerMarkerForPlayer( z, a, ( GetPlayerColor( a ) & 0xFFFFFF00 ) );
                        }
                        TextDrawHideForPlayer(z, tTimer[z]);
                        format(szMessage, sizeof(szMessage), "Your personal score: %i", playerVariables[z][pWarScore] - playerVariables[z][pWarDeaths]);
                        SendClientMessage(z, COLOR_ATTACK, szMessage);
                        playerVariables[z][pWarScore] = 0;
                        playerVariables[z][pWarDeaths] = 0;
                        GangZoneShowForPlayerEx(z, Turfs, GetTeamZoneColor(TurfInfo[zOwned]));
                        JustRemoved[z] = 0;
                    }
                }
                format(szMessage, sizeof(szMessage), "-------------------------------------");
                SendToGroup(att, COLOR_ATTACK, szMessage);
                SendToGroup(deff, COLOR_ATTACK, szMessage);
                GangZoneStopFlashForAll(Turfs);
                WarInfo[wTime] = 0;
                WarInfo[wAttacker] = 0;
                WarInfo[wFaction] = 0;
            }
        }
    }
    foreach(Player, i)
    {
        if(IsPlayerConnected(i))
        {
            if(PaintballRound == 1 && PlayerPaintballing != 0)
            {
                new string[500];
                format(string,sizeof(string),"Paintball time: ~b~%s", CalculeazaTimp(painttime));
                TextDrawSetString(Paintball[3], string);
                TextDrawShowForPlayer(i, Paintball[3]);
            }
            if(PlayerStoned >= 2)
            {
                new Float:angle;
                GetPlayerFacingAngle(i, angle);
                if(IsPlayerInAnyVehicle(i))
                {
                    if(GetPlayerState(i) == 2)
                    {
                        SetVehicleZAngle(GetPlayerVehicleID(i), angle + 15);
                        SetPlayerDrunkLevel (i, 5000);
                    }
                }
                else
                {
                    SetPlayerDrunkLevel (i, 5000);
                }
            }
            if(MedicCallTime > 0)
            {
                if(MedicAccepted < 999)
                {
                    if(IsPlayerConnected(MedicAccepted))
                    {
                        new Float:X,Float:Y,Float:Z;
                        GetPlayerPos(MedicAccepted, X, Y, Z);
                        SetPlayerCheckpoint(i, X, Y, Z, 5);
                    }
                }
            }
        }
    }
}

"

Link to comment
Share on other sites

0 answers to this question

Recommended Posts

There have been no answers to this question yet

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Answer this question...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue. For more details you can also review our Terms of Use and Privacy Policy.