Array index out of bounds help needed.
#1

Anyone know whats wrong with this?
pawn Код:
new query[500];
        format(query, sizeof(query), "UPDATE vehicles SET vType=%d,vFaction=%d,vModel=%d,vMod1=%d,vMod2=%d,vMod3=%d,vMod4=%d,vMod5=%d,vvMod6=%d,vMod7=%d,vMod8=%d,vMod9=%d,vMod10=%d,vMod11=%d,vMod12=%d,vMod13=%d,vLockStatus=%d,vPaintJob=%d,PosX='%f',vPosY='%f',vPosZ='%f',vPosR='%f',vColour1=%d,vColour2=%d,vFuel=%d WHERE DataID=%d",
        Vehicle[id][vType],Vehicle[id][vFaction],Vehicle[id][vModel],Vehicle[id][vMod][0],Vehicle[id][vMod][1],Vehicle[id][vMod][2],Vehicle[id][vMod][3],Vehicle[id][vMod][4],Vehicle[id][vMod][5],Vehicle[id][vMod][6],Vehicle[id][vMod][7],Vehicle[id][vMod][8],Vehicle[id][vPos][9],Vehicle[id][vMod][10],Vehicle[id][vMod][11],
        Vehicle[id][vMod][12],Vehicle[id][vLockStatus],Vehicle[id][vPaintJob],Vehicle[id][vPos][0],Vehicle[id][vPos][1],Vehicle[id][vPos][2],Vehicle[id][vPos][3],Vehicle[id][vColour][0],Vehicle[id][vColour][1],Fuel[Vehicle[id][vVehicleID]],id);
        mysql_query(query);
Here is the error I get:
Код:
C:\Users\Callum\Desktop\Script\gamemodes\Farrow.pwn(1965 -- 1966) : error 032: array index out of bounds (variable "Vehicle")
The error is on the format line and the line after.
Reply
#2

Show as how you define "Vehicle"
Reply
#3

Quote:
Originally Posted by doreto
Посмотреть сообщение
Show as how you define "Vehicle"
pawn Код:
enum Vehicle_Variables
{
    vType,
        vFaction,
        vVehicleID,
    vModel,
    Float:vPos[4],
    vColour[2],
        vMod[13],
    vFuel,
    Engine,
    vLockStatus,
    vPaintJob,
}

new Vehicle[MAX_VEHICLES][Vehicle_Variables];
Reply
#4

your line is too long... Pawno can't get the whole line so he gets just Vehicle...
Reply
#5

Quote:
Originally Posted by NeroX98
Посмотреть сообщение
your line is too long... Pawno can't get the whole line so he gets just Vehicle...
It's not that as I have just shortened the line and I am still getting the error.
Reply
#6

Quote:
Originally Posted by NeroX98
Посмотреть сообщение
your line is too long... Pawno can't get the whole line so he gets just Vehicle...
Eh?

@OP Your accessing the vehicle array out of bounds.

pawn Код:
Vehicle[id][vPos][9]//vPos is of size 4, so accessing [9] is not allowed.
Reply
#7

Quote:
Originally Posted by iggy1
Посмотреть сообщение
Eh?

@OP Your accessing the vehicle array out of bounds.

pawn Код:
Vehicle[id][vPos][9]//vPos is of size 4, so accessing [9] is not allowed.
Thank you, didn't see that.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)