SA-MP Forums Archive
Not Select! - Printable Version

+- SA-MP Forums Archive (
+-- Forum: SA-MP Scripting and Plugins (
+--- Forum: Scripting Help (
+--- Thread: Not Select! (/showthread.php?tid=597662)

Not Select! - norton2 - 03.01.2016

After Login:
mysql_format(MySQLCon, QuerY, sizeof(QuerY), "SELECT * FROM `vehicles` WHERE `Owner` = %d", pInfo[playerid][pID]);
mysql_pquery(MySQLCon, QuerY, "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];
    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;

Re: Not Select! - norton2 - 03.01.2016


Re: Not Select! - vannesenn - 03.01.2016

Where is a problem here? Describe problem a bit more!

Re: Not Select! - norton2 - 03.01.2016

No vehicle is created on the server! Do not load data (vehicles) from the database.

Re: Not Select! - norton2 - 03.01.2016


Re: Not Select! - Vince - 03.01.2016

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.

Re: Not Select! - norton2 - 04.01.2016

Okay, thank you.