Player-unique-car
#1

Hey, it's me again

My Carsystem is right so far, but i still have a problem.
How can i load the player-unique cars? If i connect, it loads all cars in the DB, not those who are mine.

Codes:
Код:
enum cardata
{
	id,
	owner[MAX_PLAYER_NAME],
	plate[20],
	Float:spawnx,
	Float:spawny,
	Float:spawnz,
	Float:spawnr,
	modelid,
	c1,
	c2,
	price,
	car
}
new Playercar[MAX_CARS][cardata];
Код:
stock LoadPlayerCars()
{

    mysql_query_callback(1, "SELECT * FROM cars",  "OnPlayerCarsLoaded");
}
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();
       while(mysql_fetch_row_format(result, "|"))
       {
       		sscanf(result, "p<|>is[16]ffffiiis[20]i",iD,downer,sx,sy,sz,sr,model,colo1,colo2,dplate,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++;
        }
        printf(" ||CAR: %s %i %f %f %f %f %i %i %i", downer,modelid,sx,sy,sz,sr,colo1,colo2,price);
       	mysql_free_result();
       	printf("[mysql] Succesful. %i ausgelesen", idx); //
       	return 1;
}
How can i solve it? And could you please descripe it? I dont want to create a new thread for every problem

You could also post a good mysql tutorial which explains my problems.
Reply


Messages In This Thread
Player-unique-car - by yellow - 03.02.2014, 14:12
AW: Player-unique-car - by yellow - 03.02.2014, 17:27
AW: Player-unique-car - by yellow - 04.02.2014, 13:24
AW: Player-unique-car - by yellow - 05.02.2014, 14:48
Re: Player-unique-car - by Borg - 05.02.2014, 14:55
AW: Player-unique-car - by yellow - 05.02.2014, 15:36
AW: Player-unique-car - by yellow - 05.02.2014, 15:48

Forum Jump:


Users browsing this thread: 2 Guest(s)