02.02.2014, 18:14
thanks for the tutorial link @Vince:
my source right now
It fetched 3 rows, thats okay cause i 've got 3 in my DB.
But my car doesnt appear. Did i do it correctly? Or is sth wrong?
#edit
i printed it.
printf(" ||CAR: %s %i %f %f %f %f %i %i %i", downer,modelid,sx,sy,sz,sr,colo1,colo2,price);
the output is
Wheres the mistake?
my source right now
Код:
stock LoadPlayerCars() { mysql_query_callback(1, "SELECT * FROM cars", "OnPlayerCarsLoaded"); // we won't pass any other variables to the callback } forward OnPlayerCarsLoaded(); public OnPlayerCarsLoaded() { new idx, result[256], query[128]; new downer,dplate,Float:sx,Float:sy,Float:sz,model,colo1,colo2,dprice,dcar,iD,Float:sr; format(result, 128, "SELECT * FROM `cars` WHERE `ID` = '%d'", id); mysql_query(query); mysql_store_result(); // Here we start the while loop to fetch the rows while(mysql_fetch_row_format(result, "|")) { sscanf(result, "e<p<|>{i}is[16]s[24]ffffiiii>",iD,downer,dplate,sx,sy,sz,sr,model,colo1,colo2,dprice); Playercar[idx][owner] = downer; Playercar[idx][plate] = dplate; Playercar[idx][spawnx] = sx; Playercar[idx][spawny] = sy; Playercar[idx][spawnz] = sz; Playercar[idx][spawnr] = sr; Playercar[idx][modelid] = model; Playercar[idx][c1] = colo1; Playercar[idx][c2] = colo2; Playercar[idx][price] = dprice; Playercar[idx][car] = AddStaticVehicleEx(Playercar[idx][modelid],Playercar[idx][spawnx],Playercar[idx][spawny],Playercar[idx][spawnz],Playercar[idx][spawnr],Playercar[idx][c1],Playercar[idx][c2],60); idx++; // Now increment our index! } mysql_free_result(); printf("[mysql] Succesful. Fetched %i rows from the database.", idx); // return 1; }
But my car doesnt appear. Did i do it correctly? Or is sth wrong?
#edit
i printed it.
printf(" ||CAR: %s %i %f %f %f %f %i %i %i", downer,modelid,sx,sy,sz,sr,colo1,colo2,price);
the output is
Код:
||CAR: 49 0.000000 0.000000 0.000000 0.000000 0 0 52