[REP++ WHO HELPS] Run time error 4: "Array index out of bounds"
#1

Hello , i can't get this work , i have 25 turfs in my mysql database, i want to show an error when a player is not near them , i make this with IsPlayerInRange , don't ask why.


I get SERVER:Unknown command if i am not in a turf , and if i am it's goes SUCCESS!

Error:
pawn Код:
[11:27:42] [debug] Run time error 4: "Array index out of bounds"
[11:27:42] [debug]  Accessing element at index 26 past array upper bound 25
I tried to put 25 instead of 26 but gamemode goes to Unknown.
pawn Код:
new TurfInfo[26][ttInfo];

new TurfInfo[26];



CMD:attack(playerid, params[])
{
    new turfid;
    for(new xf = 0; xf <= sizeof(TurfInfo); xf++)
    {
        if(IsPlayerInRangeOfPoint(playerid, 4.0, TurfInfo[xf][ttPosX], TurfInfo[xf][ttPosY], TurfInfo[xf][ttPosZ]))
        {
                    turfid = xf;
            break;
        }
    }
    if(turfid == 0) return SendClientMessage(playerid, COLOR_WHITE, "ERROR!");
    if(turfid > 0) return SendClientMessage(playerid, COLOR_WHITE, "SUCCES!");
    return 1;
}
Reply


Messages In This Thread
[REP++ WHO HELPS] Run time error 4: "Array index out of bounds" - by buburuzu19 - 14.08.2015, 08:30
Re: [REP++ WHO HELPS] Run time error 4: "Array index out of bounds" - by jlalt - 14.08.2015, 08:55
Re: [REP++ WHO HELPS] Run time error 4: "Array index out of bounds" - by DTV - 14.08.2015, 09:02
Re: [REP++ WHO HELPS] Run time error 4: "Array index out of bounds" - by MarvinPWN - 14.08.2015, 09:21

Forum Jump:


Users browsing this thread: 1 Guest(s)