06.11.2010, 15:43
pawn Код:
[11:55:03] SELECT * FROM `Vehicles`
[11:55:03] [MySQL] Error (0): Function: mysql_store_result called when no result stored.
[11:55:03]
pawn Код:
[Sat Nov 06 11:55:03 2010] Function: mysql_query executed: "SELECT * FROM `Vehicles`" with result: "0".
[Sat Nov 06 11:55:03 2010] Function: mysql_store_result executed with result: "1"
[Sat Nov 06 11:55:03 2010] Function: mysql_num_rows executed with result: "".
[Sat Nov 06 11:55:03 2010] Function: mysql_fetch_row executed with result: "1|411|0|2|1|1|1|122|45|50000|60000|D@rk_$h@dow|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0".
[Sat Nov 06 11:55:03 2010] Function: mysql_query executed: "SELECT * FROM `Vehicles` WHERE CarID = 1 LIMIT 1" with result: "0".
[Sat Nov 06 11:55:03 2010] Function: mysql_store_result executed with result: "1"
[Sat Nov 06 11:55:03 2010] Function: mysql_num_rows executed with result: "".
[Sat Nov 06 11:55:03 2010] Function: mysql_fetch_field executed.
[Sat Nov 06 11:55:03 2010] Function: mysql_fetch_field executed.
[Sat Nov 06 11:55:03 2010] Function: mysql_fetch_field executed.
[Sat Nov 06 11:55:03 2010] Function: mysql_fetch_field executed.
[Sat Nov 06 11:55:03 2010] Function: mysql_fetch_field executed.
[Sat Nov 06 11:55:03 2010] Function: mysql_fetch_field executed.
[Sat Nov 06 11:55:03 2010] Function: mysql_fetch_field executed.
[Sat Nov 06 11:55:03 2010] Function: mysql_fetch_field executed.
[Sat Nov 06 11:55:03 2010] Function: mysql_fetch_field executed.
[Sat Nov 06 11:55:03 2010] Function: mysql_fetch_field executed.
[Sat Nov 06 11:55:03 2010] Function: mysql_fetch_field executed.
[Sat Nov 06 11:55:03 2010] Function: mysql_fetch_field executed.
[Sat Nov 06 11:55:03 2010] Function: mysql_fetch_field executed.
[Sat Nov 06 11:55:03 2010] Function: mysql_fetch_field executed.
[Sat Nov 06 11:55:03 2010] Function: mysql_fetch_field executed.
[Sat Nov 06 11:55:03 2010] Function: mysql_fetch_field executed.
[Sat Nov 06 11:55:03 2010] Function: mysql_fetch_field executed.
[Sat Nov 06 11:55:03 2010] Function: mysql_fetch_field executed.
[Sat Nov 06 11:55:03 2010] Function: mysql_fetch_field executed.
[Sat Nov 06 11:55:03 2010] Function: mysql_fetch_field executed.
[Sat Nov 06 11:55:03 2010] Function: mysql_fetch_field executed.
[Sat Nov 06 11:55:03 2010] Function: mysql_fetch_field executed.
[Sat Nov 06 11:55:03 2010] Function: mysql_fetch_field executed.
[Sat Nov 06 11:55:03 2010] Function: mysql_fetch_field executed.
[Sat Nov 06 11:55:03 2010] Function: mysql_fetch_field executed.
[Sat Nov 06 11:55:03 2010] Function: mysql_fetch_field executed.
[Sat Nov 06 11:55:03 2010] Function: mysql_fetch_field executed.
[Sat Nov 06 11:55:03 2010] Function: mysql_fetch_field executed.
[Sat Nov 06 11:55:03 2010] Function: mysql_fetch_field executed.
[Sat Nov 06 11:55:03 2010] Function: mysql_fetch_field executed.
[Sat Nov 06 11:55:03 2010] Function: mysql_free_result executed.
[Sat Nov 06 11:55:03 2010] Error (0): Function: mysql_store_result called when no result stored.
[Sat Nov 06 11:55:03 2010] Function: mysql_free_result executed.
pawn Код:
stock LoadVehiclesFromDatabase()
{
new str[512], index;
format(str, sizeof(str), "SELECT * FROM `Vehicles`");
mysql_query(str);
print(str);
mysql_store_result();
if(mysql_num_rows() > 0)
{
while(mysql_fetch_row(str))
{
new datavar[25];
new datastr[1][24];
new Float:datafloat[4];
sscanf(str, "e<p<|>dddffffdddds[24]ddddddddddddddddddd>",datavar[0],datavar[1],datavar[2],datafloat[0],datafloat[1],datafloat[2],datafloat[3],datavar[3],datavar[4],datavar[5],datavar[6],datastr[0],datavar[7],
/*Mods*/datavar[8],datavar[9],datavar[10],datavar[11],datavar[12],datavar[13],datavar[14],datavar[15],datavar[16],datavar[17],datavar[18],datavar[19],datavar[20],datavar[21],datavar[22],datavar[23],datavar[24]);
VehicleSystem[index][Locked] = datavar[2];
strmid(VehicleSystem[index][Owner],datastr[0],false,23,24);
VehicleSystem[index][Paintjob] = datavar[7];
VehicleSystem[index][cMod][0] = datavar[8];
VehicleSystem[index][cMod][1] = datavar[9];
VehicleSystem[index][cMod][2] = datavar[10];
VehicleSystem[index][cMod][3] = datavar[11];
VehicleSystem[index][cMod][4] = datavar[12];
VehicleSystem[index][cMod][5] = datavar[13];
VehicleSystem[index][cMod][6] = datavar[14];
VehicleSystem[index][cMod][7] = datavar[15];
VehicleSystem[index][cMod][8] = datavar[16];
VehicleSystem[index][cMod][9] = datavar[17];
VehicleSystem[index][cMod][10] = datavar[18];
VehicleSystem[index][cMod][11] = datavar[19];
VehicleSystem[index][cMod][12] = datavar[20];
VehicleSystem[index][cMod][13] = datavar[21];
VehicleSystem[index][cMod][14] = datavar[22];
VehicleSystem[index][cMod][15] = datavar[23];
VehicleSystem[index][cMod][16] = datavar[24];
AddVehicle(datavar[0],datavar[1],datavar[3],datavar[4],datafloat[0],datafloat[1],datafloat[2],datafloat[3], datavar[5], datavar[6]);
index++;
}
}
mysql_free_result();
print("\n");
printf("Server: Loaded %d MySQL vehicles successfully.", index);
return 1;
}
pawn Код:
AddVehicle(Carid, Carmodel, Carcolor1, Carcolor2, Float:CarX, Float:CarY, Float:CarZ, Float:CarA, CarCost, CarSell)
{
new data[256];
format(GlobalQuery, sizeof(GlobalQuery), "SELECT * FROM `Vehicles` WHERE CarID = %d LIMIT 1",Carid);
//print(GlobalQuery);
mysql_query(GlobalQuery);
mysql_store_result();
VehicleCount++;
if(mysql_num_rows() > 0) {
mysql_fetch_field("CarID",data);
VehicleSystem[Carid][CarID]=strval(data);
/*format(data, sizeof(data), " CarID: %d", VehicleSystem[Carid][CarID]);
printf(data);*/
mysql_fetch_field("Model",data);
VehicleSystem[Carid][Model]=strval(data);
//format(data, sizeof(data), " CarModel: %d", VehicleSystem[Carid][Model]);
//printf(data);
mysql_fetch_field("Locked",data);
VehicleSystem[Carid][Locked]=strval(data);
//format(data, sizeof(data), " CarLocked: %d", VehicleSystem[Carid][Locked]);
//printf(data);
mysql_fetch_field("CarX",data);
VehicleSystem[Carid][Carx]=strval(data);
//format(data, sizeof(data), " CarX: %f", VehicleSystem[Carid][Carx]);
//printf(data);
mysql_fetch_field("CarY",data);
VehicleSystem[Carid][Cary]=strval(data);
//format(data, sizeof(data), " CarY: %f", VehicleSystem[Carid][Cary]);
//printf(data);
mysql_fetch_field("CarZ",data);
VehicleSystem[Carid][Carz]=strval(data);
//format(data, sizeof(data), " CarZ: %f", VehicleSystem[Carid][Carz]);
// printf(data);
mysql_fetch_field("CarA",data);
VehicleSystem[Carid][Cara]=strval(data);
//format(data, sizeof(data), " CarA: %f", VehicleSystem[Carid][Cara]);
//printf(data);
mysql_fetch_field("Color1",data);
VehicleSystem[Carid][Color1]=strval(data);
//format(data, sizeof(data), " CarColor1: %d", VehicleSystem[Carid][Color1]);
//printf(data);
mysql_fetch_field("Color2",data);
VehicleSystem[Carid][Color2]=strval(data);
//format(data, sizeof(data), " CarColor2: %d", VehicleSystem[Carid][Color2]);
//printf(data);
mysql_fetch_field("Price",data);
VehicleSystem[Carid][Price]=strval(data);
//format(data, sizeof(data), " CarPrice: %d", VehicleSystem[Carid][Price]);
//printf(data);
mysql_fetch_field("Sell",data);
VehicleSystem[Carid][Sell]=strval(data);
//format(data, sizeof(data), " CarSell: %d", VehicleSystem[Carid][Sell]);
//printf(data);
mysql_fetch_field("Owner",data);
strmid(VehicleSystem[Carid][Owner],data,0,20,20);
//format(data, sizeof(data), " CarOwner: %s", VehicleSystem[Carid][Owner]);
// printf(data);
mysql_fetch_field("Paintjob",data);
VehicleSystem[Carid][Paintjob]=strval(data);
mysql_fetch_field("Tune0",data);
VehicleSystem[Carid][cMod][0]=strval(data);
mysql_fetch_field("Tune1",data);
VehicleSystem[Carid][cMod][1]=strval(data);
mysql_fetch_field("Tune2",data);
VehicleSystem[Carid][cMod][2]=strval(data);
mysql_fetch_field("Tune3",data);
VehicleSystem[Carid][cMod][3]=strval(data);
mysql_fetch_field("Tune4",data);
VehicleSystem[Carid][cMod][4]=strval(data);
mysql_fetch_field("Tune5",data);
VehicleSystem[Carid][cMod][5]=strval(data);
mysql_fetch_field("Tune6",data);
VehicleSystem[Carid][cMod][6]=strval(data);
mysql_fetch_field("Tune7",data);
VehicleSystem[Carid][cMod][7]=strval(data);
mysql_fetch_field("Tune8",data);
VehicleSystem[Carid][cMod][8]=strval(data);
mysql_fetch_field("Tune9",data);
VehicleSystem[Carid][cMod][9]=strval(data);
mysql_fetch_field("Tune10",data);
VehicleSystem[Carid][cMod][10]=strval(data);
mysql_fetch_field("Tune11",data);
VehicleSystem[Carid][cMod][11]=strval(data);
mysql_fetch_field("Tune12",data);
VehicleSystem[Carid][cMod][12]=strval(data);
mysql_fetch_field("Tune13",data);
VehicleSystem[Carid][cMod][13]=strval(data);
mysql_fetch_field("Tune14",data);
VehicleSystem[Carid][cMod][14]=strval(data);
mysql_fetch_field("Tune15",data);
VehicleSystem[Carid][cMod][15]=strval(data);
mysql_fetch_field("Tune16",data);
VehicleSystem[Carid][cMod][16]=strval(data);
new carr = CreateVehicle(VehicleSystem[Carid][Model],VehicleSystem[Carid][Carx],VehicleSystem[Carid][Cary],VehicleSystem[Carid][Carz]+5,VehicleSystem[Carid][Cara],VehicleSystem[Carid][Color1],VehicleSystem[Carid][Color2],600000);
IsBuyableCar[carr]=Carid;
}
else {
VehicleSystem[Carid][CarID]=Carid;
VehicleSystem[Carid][Model]=Carmodel;
VehicleSystem[Carid][Locked]=0;
VehicleSystem[Carid][Carx]=CarX;
VehicleSystem[Carid][Cary]=CarY;
VehicleSystem[Carid][Carz]=CarZ;
VehicleSystem[Carid][Cara]=CarA;
VehicleSystem[Carid][Color1]=Carcolor1;
VehicleSystem[Carid][Color2]=Carcolor2;
VehicleSystem[Carid][Price]=CarCost;
VehicleSystem[Carid][Sell]=CarSell;
strmid(VehicleSystem[Carid][Owner],"Unbought",0,20,20);
new Escape[1][MAX_PLAYER_NAME];
mysql_real_escape_string(VehicleSystem[Carid][Owner], Escape[0]);
format(GlobalQuery, sizeof(GlobalQuery),"INSERT INTO `Vehicles` (`CarID` ,`Model` ,`Locked` ,`CarX` ,`CarY` ,`CarZ` ,`CarA` ,`Color1` ,`Color2` ,`Price` ,`Sell` ,`Owner`) VALUES (%d, %d, 0, %f, %f, %f, %f, %d, %d, %d, %d, 'Unbought');",Carid, Carmodel, CarX, CarY, CarZ, CarA, Carcolor1, Carcolor2, CarCost, CarSell);
mysql_query(GlobalQuery);
/*format(data, sizeof(data), " Car id: %d", VehicleSystem[Carid][CarID]);
printf(data);
format(data, sizeof(data), " CarModel: %d", VehicleSystem[Carid][Model]);
printf(data);
format(data, sizeof(data), " CarLocked: %d", VehicleSystem[Carid][Locked]);
printf(data);
format(data, sizeof(data), " CarX: %f", VehicleSystem[Carid][Carx]);
printf(data);
format(data, sizeof(data), " CarY: %f", VehicleSystem[Carid][Cary]);
printf(data);
format(data, sizeof(data), " CarZ: %f", VehicleSystem[Carid][Carz]);
printf(data);
format(data, sizeof(data), " CarA: %f", VehicleSystem[Carid][Cara]);
printf(data);
format(data, sizeof(data), " CarColor1: %d", VehicleSystem[Carid][Color1]);
printf(data);
format(data, sizeof(data), " CarColor2: %d", VehicleSystem[Carid][Color2]);
printf(data);
format(data, sizeof(data), " CarPrice: %d", VehicleSystem[Carid][Price]);
printf(data);
format(data, sizeof(data), " CarSell: %d", VehicleSystem[Carid][Sell]);
printf(data);
format(data, sizeof(data), " CarOwner: %s", VehicleSystem[Carid][Owner]);
printf(data);
printf("");*/
new carr = CreateVehicle(VehicleSystem[Carid][Model],VehicleSystem[Carid][Carx],VehicleSystem[Carid][Cary],VehicleSystem[Carid][Carz]+5,VehicleSystem[Carid][Cara],VehicleSystem[Carid][Color1],VehicleSystem[Carid][Color2],600000);
IsBuyableCar[carr]=Carid;
}
mysql_free_result();
return 1;
}