InValidVehicleID.
#1

I did that when a player enters the server, personal vehicles to create. But you can not create more than 5 vehicles! I do not know why.

OnPlayerLogin:
Код HTML:
mysql_format(MySQLCon, QuerY, sizeof(QuerY), "SELECT * FROM `vehicles` WHERE `Owner` = %d", pInfo[playerid][pID]);
mysql_pquery(MySQLCon, QuerY, "OnVehiclesLoad", "");
OnVehiclesLoad:
Код HTML:
forward OnVehiclesLoad(playerid);
public OnVehiclesLoad(playerid)
{
    for(new r = 0; r < cache_num_rows(); ++r, UlIDV++)
    {
        printf("RR: %d", UlIDV);
        new ORM:ormid = Veh[UlIDV][ORM_ID] = orm_create("vehicles");
        orm_addvar_int(ormid, Veh[UlIDV][ID], "ID"); //this is the key
        orm_setkey(ormid, "ID"); //here we declare it as the key
        orm_addvar_int(ormid, Veh[UlIDV][Owner], "Owner");
        orm_addvar_int(ormid, Veh[UlIDV][Model], "Model");
        orm_addvar_float(ormid, Veh[UlIDV][PosX], "PosX");
        orm_addvar_float(ormid, Veh[UlIDV][PosY], "PosY");
        orm_addvar_float(ormid, Veh[UlIDV][PosZ], "PosZ");
        orm_addvar_float(ormid, Veh[UlIDV][VAngle], "VAngle");
        orm_addvar_int(ormid, Veh[UlIDV][Color1], "Color1");
        orm_addvar_int(ormid, Veh[UlIDV][Color2], "Color2");
        orm_addvar_int(ormid, Veh[UlIDV][Paintjob], "Paintjob");
        orm_addvar_int(ormid, Veh[UlIDV][Value], "Value");
        orm_addvar_int(ormid, Veh[UlIDV][Lock], "Lock");
        orm_addvar_string(ormid, Veh[UlIDV][Plate], 16, "Plate");
        orm_addvar_float(ormid, Veh[UlIDV][KM], "KM");
        orm_addvar_int(ormid, Veh[UlIDV][Mod0], "Mod0");
        orm_addvar_int(ormid, Veh[UlIDV][Mod1], "Mod1");
        orm_addvar_int(ormid, Veh[UlIDV][Mod2], "Mod2");
        orm_addvar_int(ormid, Veh[UlIDV][Mod3], "Mod3");
        orm_addvar_int(ormid, Veh[UlIDV][Mod4], "Mod4");
        orm_addvar_int(ormid, Veh[UlIDV][Mod5], "Mod5");
        orm_addvar_int(ormid, Veh[UlIDV][Mod6], "Mod6");
        orm_addvar_int(ormid, Veh[UlIDV][Mod7], "Mod7");
        orm_addvar_int(ormid, Veh[UlIDV][Mod8], "Mod8");
        orm_addvar_int(ormid, Veh[UlIDV][Mod9], "Mod9");
        orm_addvar_int(ormid, Veh[UlIDV][Mod10], "Mod10");
        orm_addvar_int(ormid, Veh[UlIDV][Mod11], "Mod11");
        orm_addvar_int(ormid, Veh[UlIDV][Mod12], "Mod12");
        orm_addvar_int(ormid, Veh[UlIDV][Mod13], "Mod13");
        orm_addvar_int(ormid, Veh[UlIDV][Mod14], "Mod14");
        orm_addvar_int(ormid, Veh[UlIDV][Mod15], "Mod15");
        orm_addvar_int(ormid, Veh[UlIDV][Mod16], "Mod16");
        orm_addvar_string(ormid, Veh[UlIDV][Class], 13, "Class");
        orm_apply_cache(ormid, UlIDV);
        Veh[UlIDV][ServerID] = CreateVehicle(Veh[UlIDV][Model], Veh[UlIDV][PosX], Veh[UlIDV][PosY], Veh[UlIDV][PosZ], Veh[UlIDV][VAngle], Veh[UlIDV][Color1], Veh[UlIDV][Color2], -1);
    }
    return 1;
}
UlIDV = The last set ID of a vehicle from the database.

Код HTML:
[13:10:36] [debug] Run time error 4: "Array index out of bounds"
[13:10:36] [debug]  Accessing element at index 65535 past array upper bound 1999
[13:10:36] [debug] AMX backtrace:
[13:10:36] [debug] #0 0004f104 in public OnVehiclesLoad (1) from GM.amx
Line Error:
Код HTML:
Veh[UlIDV][ServerID] = CreateVehicle(Veh[UlIDV][Model], Veh[UlIDV][PosX], Veh[UlIDV][PosY], Veh[UlIDV][PosZ], Veh[UlIDV][VAngle], Veh[UlIDV][Color1], Veh[UlIDV][Color2], -1);
Код HTML:
enum e_Veh
{
    //.....
    ServerID,
    //.....
};
new Veh[MAX_VEHICLES][e_Veh];
Reply


Messages In This Thread
InValidVehicleID. - by norton2 - 05.01.2016, 12:40
Re: InValidVehicleID. - by norton2 - 05.01.2016, 13:05
Re: InValidVehicleID. - by norton2 - 05.01.2016, 14:21
Re: InValidVehicleID. - by kadaradam - 05.01.2016, 15:45
Re: InValidVehicleID. - by norton2 - 05.01.2016, 16:08
Re: InValidVehicleID. - by kadaradam - 05.01.2016, 16:59
Re: InValidVehicleID. - by norton2 - 05.01.2016, 17:06
Re: InValidVehicleID. - by SickAttack - 05.01.2016, 17:21
Re: InValidVehicleID. - by norton2 - 05.01.2016, 17:24
Re: InValidVehicleID. - by SickAttack - 05.01.2016, 17:29

Forum Jump:


Users browsing this thread: 1 Guest(s)