Command problem
#1

pawn Код:
CMD:vcheck(playerid, params[])
{
    if(IsACop(playerid))
    {
        new carid = GetPlayerVehicleID(playerid);
        new closestcar = GetClosestCar(playerid, carid);
        if(IsPlayerInRangeOfVehicle(playerid, closestcar, 9.0))
        {
            foreach(Player, i)
            {
                new v = GetPlayerVehicle(i, closestcar);
                if(v != -1)
                {
                    new str1[72 + MAX_PLAYER_NAME];
                    new cid =PlayerInfo[playerid][pCar][v];
                    format(str1, sizeof(str1), "Vehicle registration: %d | Name: %s | Owner: %s.",closestcar,GetVehicleFriendlyName(CarInfo[cid][c_ID]),PlayerRPName(i));
                    SendClientMessage(playerid, COLOR_WHITE, str1);
                    return 1;
                }
            }
            for(new f = 0; f < sizeof(FamilyInfo); f++)
            {
                new v = GetGangVehicle(f, closestcar);
                if(v != -1)
                {
                    new str2[128 + MAX_PLAYER_NAME];
                    format(str2, sizeof(str2), "Vehicle registration: %d | Name: %s | Owner: %s.",closestcar,GetVehicleFriendlyName(FamilyVehicleInfo[f][v][fvId]),FamilyInfo[f][FamilyLeader]);
                    SendClientMessage(playerid, COLOR_WHITE, str2);
                    return 1;
                }
            }
            SendClientMessage(playerid, COLOR_GRAD2, "This vehicle is not owned by anyone!");
        }
    }
    else
    {
        SendClientMessage(playerid, COLOR_GRAD1, "You are not authorized to use this command.");
    }
    return 1;
}
pawn Код:
[13:11:18] [cmd] [Norman] /vcheck
[13:11:18] [debug] Run time error 4: "Array index out of bounds"
[13:11:18] [debug]  Accessing element at index 3 past array upper bound 2
[13:11:18] [debug] AMX backtrace:
[13:11:18] [debug] #0 0021dc9c in ?? (0x00000000, 0x00000050) from Gvlock.amx
[13:11:18] [debug] #1 0021d738 in public cmd_vcheck (0x00000000, 0x00d3d3a8) from Gvlock.amx
[13:11:18] [debug] #2 native CallLocalFunction () [00472e50] from RP.exe
[13:11:18] [debug] #3 0000ab0c in public OnPlayerCommandText (0x00000000, 0x00d3d388) from Gvlock.amx
Reply
#2

pawn Код:
for(new f = 0; f < sizeof(FamilyInfo); f++)
            {
                new v = GetGangVehicle(f, closestcar);
                if(v != -1)
                {
                    new str2[128 + MAX_PLAYER_NAME];
                    format(str2, sizeof(str2), "Vehicle registration: %d | Name: %s | Owner: %s.",closestcar,GetVehicleFriendlyName(FamilyVehicleInfo[f][v][fvId]),FamilyInfo[f][FamilyLeader]);
                    SendClientMessage(playerid, COLOR_WHITE, str2);
                    return 1;
                }
            }
            SendClientMessage(playerid, COLOR_GRAD2, "This vehicle is not owned by anyone!");
        }
    }
This part only getting this problem
Reply
#3

Try increasing the string size.
Reply
#4

My guess is that one of these multi-dimensional arrays wasn't declared properly: FamilyVehicleInfo[f][v][fvId] or FamilyInfo[f][FamilyLeader]. Look for an array with a size of 3 and increase that size.
Reply
#5

Cant find the solution
Reply
#6

Quote:
Originally Posted by krytans
Посмотреть сообщение
Cant find the solution
Show us how you declared FamilyVehicleInfo and FamilyInfo.
Reply
#7

pawn Код:
enum fvInfo
{
    fvId,
    fvModelId,
    Float: fvSpawnx,
    Float: fvSpawny,
    Float: fvSpawnz,
    Float: fvSpawna,
    Float: fvSpawnxtmp,
    Float: fvSpawnytmp,
    Float: fvSpawnztmp,
    Float: fvSpawnatmp,
    fvLock,
    fvLocked,
    fvPaintJob,
    fvColor1,
    fvColor2,
    fvMods[MAX_MODS],
    fvPrice,
    fvImpounded,
    Float:fvFuel,
};

new FamilyVehicleInfo[MAX_FAMILY][MAX_GANG_VEHICLES][fvInfo];
pawn Код:
enum fInfo
{
    FamilyTaken,
    FamilyName[24],
    FamilyMOTD[64],
    FamilyLeader[MAX_PLAYER_NAME],
    FamilyBank,
    FamilyCash,
    FamilySafe,
    Float:FamilySafePos[3],
    FamilyPot,
    FamilyCrack,
    FamilyMats,
    FamilyMembers,
    FamilySkins,
    FamilySkin1,
    FamilySkin2,
    FamilySkin3,
    FamilySkin4,
    FamilySkin5,
    FamilySkin6,
    FamilySkin7,
    FamilySkin8,
    PickupID,
    FStrikes,
    Colt45,
    Shotgun,
    MP5,
    AK47,
    M4,
    SPAS12,
    Rifle,
    Sniper,
    Colt45a,
    Shotguna,
    MP5a,
    AK47a,
    M4a,
    SPAS12a,
    Riflea,
    fCookies,
    fColor,
    fID,
    Snipera
};
new FamilyInfo[MAX_FAMILY][fInfo];
new FamilyRank[MAX_FAMILY][6][24];
Reply
#8

Change the string size to something bigger, like 256.
Reply
#9

pawn Код:
[17:41:10] [debug] Run time error 4: "Array index out of bounds"
[17:41:10] [debug]  Accessing element at index 65535 past array upper bound 1999
[17:41:10] [debug] AMX backtrace:
[17:41:10] [debug] #0 0009d0b4 in ?? (0x0000ffff) from Gvlock.amx
[17:41:10] [debug] #1 004e4e6c in ?? (0x00000000) from Gvlock.amx
[17:41:10] [debug] #2 002231e4 in ?? (0x00000000, 0x00c2e9ac) from Gvlock.amx
[17:41:10] [debug] #3 004f38ec in public OnDialogResponse (0x00000000, 0x00000001, 0x00000001, 0xffffffff, 0x00c23720) from Gvlock.amx
Reply
#10

Quote:
Originally Posted by theLegion
Посмотреть сообщение
Change the string size to something bigger, like 256.
I did but facing same problem.
Reply


Forum Jump:


Users browsing this thread: 2 Guest(s)