Variable, array problem.
#1

Hi, Vehicle data does not load properly, do not know why.
Код HTML:
forward OnVehiclesLoadForPlayer(playerid);
public OnVehiclesLoadForPlayer(playerid)
{
    for(new r = 0; r < cache_num_rows(); ++r)
    {
        new ORM:ormid = Veh[pInfo[playerid][pVeh][r]][ORM_ID] = orm_create("vehicles");
        orm_addvar_int(ormid, Veh[pInfo[playerid][pVeh][r]][ID], "ID"); //this is the key
        orm_addvar_int(ormid, Veh[pInfo[playerid][pVeh][r]][Owner], "Owner");
        orm_addvar_int(ormid, Veh[pInfo[playerid][pVeh][r]][Model], "Model");
        orm_addvar_float(ormid, Veh[pInfo[playerid][pVeh][r]][PosX], "PosX");
        orm_addvar_float(ormid, Veh[pInfo[playerid][pVeh][r]][PosY], "PosY");
        orm_addvar_float(ormid, Veh[pInfo[playerid][pVeh][r]][PosZ], "PosZ");
        orm_addvar_float(ormid, Veh[pInfo[playerid][pVeh][r]][VAngle], "VAngle");
        orm_addvar_int(ormid, Veh[pInfo[playerid][pVeh][r]][Color1], "Color1");
        orm_addvar_int(ormid, Veh[pInfo[playerid][pVeh][r]][Color2], "Color2");
        orm_addvar_int(ormid, Veh[pInfo[playerid][pVeh][r]][Paintjob], "Paintjob");
        orm_addvar_int(ormid, Veh[pInfo[playerid][pVeh][r]][Value], "Value");
        orm_addvar_int(ormid, Veh[pInfo[playerid][pVeh][r]][Lock], "Lock");
        orm_addvar_int(ormid, Veh[pInfo[playerid][pVeh][r]][Insurance], "Insurance");
        orm_addvar_string(ormid, Veh[pInfo[playerid][pVeh][r]][Plate], 16, "Plate");
        orm_addvar_float(ormid, Veh[pInfo[playerid][pVeh][r]][KM], "KM");
        orm_apply_cache(ormid, r);
        orm_setkey(ormid, "ID"); //here we declare it as the key
        Veh[pInfo[playerid][pVeh][r]][ServerID] = CreateVehicle(Veh[pInfo[playerid][pVeh][r]][Model], Veh[pInfo[playerid][pVeh][r]][PosX], Veh[pInfo[playerid][pVeh][r]][PosY], Veh[pInfo[playerid][pVeh][r]][PosZ], Veh[pInfo[playerid][pVeh][r]][VAngle], Veh[pInfo[playerid][pVeh][r]][Color1], Veh[pInfo[playerid][pVeh][r]][Color2], -1);
    }
    printf("!: %d", Veh[pInfo[playerid][pVeh][0]][Model]);// Debug 1
    printf("!2: %d", Veh[pInfo[playerid][pVeh][1]][Model]);// Debug 2
    return 1;
}
Код HTML:
enum PlayerInfo
{
    pVeh[5] //..... other ......//
}
new pInfo[MAX_PLAYERS][PlayerInfo];
DEBUG:
Veh[pInfo[playerid][pVeh][0]][Model] = 424.
Veh[pInfo[playerid][pVeh][1]][Model] = 424.


Normal should be so:
Veh[pInfo[playerid][pVeh][0]][Model] = 535.
Veh[pInfo[playerid][pVeh][1]][Model] = 424.
Reply
#2

Anyone?
Reply
#3

bump
Reply
#4

I'd say it has more to do with your database. Are you sure the first vehicle isn't model 535?

But just be careful. Only bump every 12 or 24 hours.
Reply
#5

Quote:
Originally Posted by Sew_Sumi
Посмотреть сообщение
I'd say it has more to do with your database. Are you sure the first vehicle isn't model 535?

But just be careful. Only bump every 12 or 24 hours.
Yeah, sure.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)