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