PDA

View Full Version : Not Select!


norton2
03/01/2016, 11:24 AM
After Login:
mysql_format(MySQLCon, QuerY, sizeof(QuerY), "SELECT * FROM `vehicles` WHERE `Owner` = %d", pInfo[playerid][pID]);
mysql_pquery(MySQLCon, QuerY, "OnVehiclesLoad", "");

OnVehiclesLoad:
forward OnVehiclesLoad();
public OnVehiclesLoad()
{
new r = cache_num_rows();
new ORM:ormid = Veh[r][ORM_ID] = orm_create("vehicles");

orm_addvar_int(ormid, Veh[r][ID], "ID"); //this is the key
orm_setkey(ormid, "ID"); //here we declare it as the key
orm_addvar_int(ormid, Veh[r][Owner], "Owner");
orm_addvar_int(ormid, Veh[r][Model], "Model");
orm_addvar_float(ormid, Veh[r][PosX], "PosX");
orm_addvar_float(ormid, Veh[r][PosY], "PosY");
orm_addvar_float(ormid, Veh[r][PosZ], "PosZ");
orm_addvar_float(ormid, Veh[r][VAngle], "VAngle");
orm_addvar_int(ormid, Veh[r][Color1], "Color1");
orm_addvar_int(ormid, Veh[r][Color2], "Color2");
orm_addvar_int(ormid, Veh[r][Paintjob], "Paintjob");
orm_addvar_int(ormid, Veh[r][Value], "Value");
orm_addvar_int(ormid, Veh[r][Lock], "Lock");
orm_addvar_string(ormid, Veh[r][Plate], 16, "Plate");
orm_addvar_float(ormid, Veh[r][KM], "KM");
orm_addvar_int(ormid, Veh[r][Mod0], "Mod0");
orm_addvar_int(ormid, Veh[r][Mod1], "Mod1");
orm_addvar_int(ormid, Veh[r][Mod2], "Mod2");
orm_addvar_int(ormid, Veh[r][Mod3], "Mod3");
orm_addvar_int(ormid, Veh[r][Mod4], "Mod4");
orm_addvar_int(ormid, Veh[r][Mod5], "Mod5");
orm_addvar_int(ormid, Veh[r][Mod6], "Mod6");
orm_addvar_int(ormid, Veh[r][Mod7], "Mod7");
orm_addvar_int(ormid, Veh[r][Mod8], "Mod8");
orm_addvar_int(ormid, Veh[r][Mod9], "Mod9");
orm_addvar_int(ormid, Veh[r][Mod10], "Mod10");
orm_addvar_int(ormid, Veh[r][Mod11], "Mod11");
orm_addvar_int(ormid, Veh[r][Mod12], "Mod12");
orm_addvar_int(ormid, Veh[r][Mod13], "Mod13");
orm_addvar_int(ormid, Veh[r][Mod14], "Mod14");
orm_addvar_int(ormid, Veh[r][Mod15], "Mod15");
orm_addvar_int(ormid, Veh[r][Mod16], "Mod16");
orm_addvar_string(ormid, Veh[r][Class], 13, "Class");
orm_addvar_int(ormid, Veh[r][ServerID], "ServerID");
orm_apply_cache(ormid, r);

Veh[r][ServerID] = CreateVehicle(Veh[r][Model], Veh[r][PosX], Veh[r][PosY], Veh[r][PosZ], Veh[r][VAngle], Veh[r][Color1], Veh[r][Color2], -1);
VBreak[Veh[r][ServerID]] = 1, KMVeh[Veh[r][ServerID]] = Veh[r][KM];
orm_update(Veh[r][ORM_ID]);
SetVehicleNumberPlate(Veh[r][ServerID], Veh[r][Plate]);
if(Veh[r][Lock] == 1) { SetVehicleParamsEx(Veh[r][ServerID],engine,lights,alarm,1,bonnet,boot,objective); }
else { SetVehicleParamsEx(Veh[r][ServerID],engine,lights,alarm,0,bonnet,boot,objective); }
return 1;
}

norton2
03/01/2016, 02:18 PM
BUMP.

vannesenn
03/01/2016, 02:38 PM
Where is a problem here? Describe problem a bit more!

norton2
03/01/2016, 02:56 PM
No vehicle is created on the server! Do not load data (vehicles) from the database.

norton2
03/01/2016, 09:15 PM
BUMP 2!

Vince
03/01/2016, 09:22 PM
I am not experienced enough with ORM, but you are going to need a loop either way. Also for the mod0 - mod16: please read my tutorial on normalization.

norton2
04/01/2016, 04:30 PM
Okay, thank you.