stock LoadOwnedVehicles()
{
new
String[512],
ModelL,
CL[2],
PriceL,
OwnerL[MAX_PLAYER_NAME],
Float:PosL[4],
ID,
PlateNumL[32];
mysql_query("SELECT * FROM `ownedcars` WHERE `ID`");
mysql_store_result();
if(mysql_num_rows() > 0)
{
while(mysql_fetch_row(String))
{
sscanf(String,"p<|>iiiiis[24]ffffs[32]", ID, ModelL, CL[0], CL[1], PriceL, OwnerL, PosL[0], PosL[1], PosL[2], PosL[3], PlateNumL);//1695
vehicledata[ID][Model] = ModelL;
vehicledata[ID][Color1] = CL[0];
vehicledata[ID][Color2] = CL[1];
vehicledata[ID][Price] = PriceL;
format(vehicledata[ID][Owner], 24, "%s", OwnerL);
vehicledata[ID][PosX] = PosL[0];
vehicledata[ID][PosY] = PosL[1];
vehicledata[ID][PosZ] = PosL[2];
vehicledata[ID][PosA] = PosL[3];
format(vehicledata[ID][Plate], 32, "%s", PlateNumL);
new
ownedcar = CreateVehicle(ModelL, PosL[0], PosL[1], PosL[2], PosL[3], CL[0], CL[1], 500000);//1708
SetVehicleNumberPlate(ownedcar, PlateNumL);
isowned[ID] = ownedcar;
printf("Owned vehicle %d spawned!",ID);
}
}
mysql_free_result();
return 1;
}
stock AddStoreFromMysql()
{
new Str[67], Float:X, Float:Y, Float:Z, STotal;
mysql_query("SELECT * FROM `stores`");
mysql_store_result();
if(mysql_num_rows() > 0)
{
while(mysql_fetch_row(Str))
{
sscanf(Str, "p<|>fff", X, Y, Z);
StorePickup = CreateDynamicPickup(1274, 23, X, Y, Z, -1, -1, -1, PICKUPDISTANCE);
CreateDynamic3DTextLabel("Store", COLOR_YELLOW, X, Y, Z, 100.0, INVALID_PLAYER_ID, INVALID_VEHICLE_ID, 0, -1, -1, -1, TEXTLABELDISTANCE);
CreateDynamicMapIcon(X, Y, Z, 38, 0, -1, -1, -1, MAPICONDISTANCE);
STotal++;
}
}
mysql_free_result();
printf("** %i\t<->\tStores Loaded From\t<->\tMySQL\t\t **", STotal);
return 1;
}
[18:12:36] [MySQL] Connected (0) to root @ 127.0.0.1 via TCP/IP. [18:12:36] [MySQL] Server Version 5.5.8. [18:12:36] [MySQL] Auto reconnect is off. [18:12:36] 6|-152.795|70.2877|6.28111 [18:12:36] Store spawned at 0.000000 0.000000 0.000000! [18:12:36] 7|143.203|-201.151|1.57812 [18:12:36] Store spawned at 0.000000 0.000000 0.000000! [18:12:36] 8|251.889|-57.1905|1.57031 [18:12:36] Store spawned at 0.000000 0.000000 0.000000! [18:12:36] 9|822.329|-557.76|16.3359 [18:12:36] Store spawned at 0.000000 0.000000 0.000000! [18:12:36] 10|1315.47|-898.572|39.5781 [18:12:36] Store spawned at 0.000000 0.000000 0.000000! [18:12:36] 11|437.34|-1310.69|15.1121 [18:12:36] Store spawned at 0.000000 0.000000 0.000000! [18:12:36] 12|802.697|-1794.76|13.0234 [18:12:36] Store spawned at 0.000000 0.000000 0.000000! [18:12:36] 13|1450.04|-2287.26|13.5469 [18:12:36] Store spawned at 0.000000 0.000000 0.000000! [18:12:36] 14|1940.92|-2116.01|13.6953 [18:12:36] Store spawned at 0.000000 0.000000 0.000000! [18:12:36] 15|1833.02|-1842.61|13.5781 [18:12:36] Store spawned at 0.000000 0.000000 0.000000! [18:12:36] 16|2685.08|-2515.12|13.1273 [18:12:36] Store spawned at 0.000000 0.000000 0.000000! [18:12:36] 17|2117.83|897.498|11.1797 [18:12:36] Store spawned at 0.000000 0.000000 0.000000! [18:12:36] 18|2319.67|-89.3282|26.4844 [18:12:36] Store spawned at 0.000000 0.000000 0.000000! [18:12:36] 19|2302.48|57.4316|26.4844 [18:12:36] Store spawned at 0.000000 0.000000 0.000000! [18:12:36] 20|-78.7974|-1169.57|2.14838 [18:12:36] Store spawned at 0.000000 0.000000 0.000000! [18:12:36] 21|-2034.19|148.741|28.8359 [18:12:36] Store spawned at 0.000000 0.000000 0.000000! [18:12:36] ** 16 <-> Stores Loaded From <-> MySQL ** [18:12:36] Number of vehicle models: 3
[Thu Mar 24 18:12:36 2011] Function: mysql_query executed: "SELECT * FROM `ownedcars` WHERE `ID`" with result: "0". [Thu Mar 24 18:12:36 2011] Function: mysql_store_result executed with result: "1" [Thu Mar 24 18:12:36 2011] Function: mysql_num_rows executed with result: "". [Thu Mar 24 18:12:36 2011] Function: mysql_free_result executed.
[Thu Mar 24 18:12:36 2011] Function: mysql_num_rows executed with result: "".
""
Код:
[Thu Mar 24 18:12:36 2011] Function: mysql_num_rows executed with result: "". Код:
"" |
mysql_fetch_row(Str, "|")
stock LoadOwnedVehicles()
{
new
String[2000],
ModelL,
CL[2],
PriceL,
OwnerL[MAX_PLAYER_NAME],
Float:PosL[4],
ID,
PlateNumL[32];
mysql_query("SELECT * FROM `ownedcars` WHERE `ID`");
mysql_store_result();
while(mysql_fetch_row(String, "|"))
{
if(!mysql_num_rows()) continue;
sscanf(String,"p<|>iiiiis[24]ffffs[32]", ID, ModelL, CL[0], CL[1], PriceL, OwnerL, PosL[0], PosL[1], PosL[2], PosL[3], PlateNumL);//1695
print(String);
vehicledata[ID][Model] = ModelL;
vehicledata[ID][Color1] = CL[0];
vehicledata[ID][Color2] = CL[1];
vehicledata[ID][Price] = PriceL;
format(vehicledata[ID][Owner], 24, "%s", OwnerL);
vehicledata[ID][PosX] = PosL[0];
vehicledata[ID][PosY] = PosL[1];
vehicledata[ID][PosZ] = PosL[2];
vehicledata[ID][PosA] = PosL[3];
format(vehicledata[ID][Plate], 32, "%s", PlateNumL);
new
ownedcar = CreateVehicle(ModelL, PosL[0], PosL[1], PosL[2], PosL[3], CL[0], CL[1], 500000);//1708
SetVehicleNumberPlate(ownedcar, PlateNumL);
isowned[ID] = ownedcar;
printf("Owned vehicle %d spawned!",ID);
}
mysql_free_result();
return 1;
}
stock AddStoreFromMysql()
{
new Str[1000], id, Float:X, Float:Y, Float:Z, STotal;
mysql_query("SELECT * FROM `stores`");
mysql_store_result();
while(mysql_fetch_row(Str, "|"))
{
if(!mysql_num_rows()) continue;
sscanf(Str, "p<|>ifff",id, X, Y, Z);
print(Str);
StorePickup = CreateDynamicPickup(1274, 23, X, Y, Z, -1, -1, -1, PICKUPDISTANCE);
CreateDynamic3DTextLabel("Store", COLOR_YELLOW, X, Y, Z, 100.0, INVALID_PLAYER_ID, INVALID_VEHICLE_ID, 0, -1, -1, -1, TEXTLABELDISTANCE);
CreateDynamicMapIcon(X, Y, Z, 38, 0, -1, -1, -1, MAPICONDISTANCE);
printf("Store spawned at %f %f %f!",X,Y,Z);
STotal++;
}
mysql_free_result();
printf("** %i\t<->\tStores Loaded From\t<->\tMySQL\t\t **", STotal);
return 1;
}
Here are the functions now, but still not working correctly.
pawn Код:
pawn Код:
|
[Thu Mar 24 18:27:26 2011] ------------------------- [Thu Mar 24 18:27:26 2011] Logging Started [Thu Mar 24 18:27:26 2011] ------------------------- [Thu Mar 24 18:27:26 2011] Function: mysql_init executed with result: "0". [Thu Mar 24 18:27:26 2011] Connected (0) to root @ 127.0.0.1 via TCP/IP. [Thu Mar 24 18:27:26 2011] MySQL Server Version 5.5.8. [Thu Mar 24 18:27:26 2011] Auto reconnect is off. [Thu Mar 24 18:27:26 2011] Function: mysql_query executed: "SELECT * FROM `stores`" with result: "0". [Thu Mar 24 18:27:26 2011] Function: mysql_store_result executed with result: "1" [Thu Mar 24 18:27:26 2011] Function: mysql_fetch_row executed with result: "6|-152.795|70.2877|6.28111". [Thu Mar 24 18:27:26 2011] Function: mysql_num_rows executed with result: "". [Thu Mar 24 18:27:26 2011] Function: mysql_fetch_row executed with result: "7|143.203|-201.151|1.57812". [Thu Mar 24 18:27:26 2011] Function: mysql_num_rows executed with result: "". [Thu Mar 24 18:27:26 2011] Function: mysql_fetch_row executed with result: "8|251.889|-57.1905|1.57031". [Thu Mar 24 18:27:26 2011] Function: mysql_num_rows executed with result: "". [Thu Mar 24 18:27:26 2011] Function: mysql_fetch_row executed with result: "9|822.329|-557.76|16.3359". [Thu Mar 24 18:27:26 2011] Function: mysql_num_rows executed with result: "". [Thu Mar 24 18:27:26 2011] Function: mysql_fetch_row executed with result: "10|1315.47|-898.572|39.5781". [Thu Mar 24 18:27:26 2011] Function: mysql_num_rows executed with result: "". [Thu Mar 24 18:27:26 2011] Function: mysql_fetch_row executed with result: "11|437.34|-1310.69|15.1121". [Thu Mar 24 18:27:26 2011] Function: mysql_num_rows executed with result: "". [Thu Mar 24 18:27:26 2011] Function: mysql_fetch_row executed with result: "12|802.697|-1794.76|13.0234". [Thu Mar 24 18:27:26 2011] Function: mysql_num_rows executed with result: "". [Thu Mar 24 18:27:26 2011] Function: mysql_fetch_row executed with result: "13|1450.04|-2287.26|13.5469". [Thu Mar 24 18:27:26 2011] Function: mysql_num_rows executed with result: "". [Thu Mar 24 18:27:26 2011] Function: mysql_fetch_row executed with result: "14|1940.92|-2116.01|13.6953". [Thu Mar 24 18:27:26 2011] Function: mysql_num_rows executed with result: "". [Thu Mar 24 18:27:26 2011] Function: mysql_fetch_row executed with result: "15|1833.02|-1842.61|13.5781". [Thu Mar 24 18:27:26 2011] Function: mysql_num_rows executed with result: "". [Thu Mar 24 18:27:26 2011] Function: mysql_fetch_row executed with result: "16|2685.08|-2515.12|13.1273". [Thu Mar 24 18:27:26 2011] Function: mysql_num_rows executed with result: "". [Thu Mar 24 18:27:26 2011] Function: mysql_fetch_row executed with result: "17|2117.83|897.498|11.1797". [Thu Mar 24 18:27:26 2011] Function: mysql_num_rows executed with result: "". [Thu Mar 24 18:27:26 2011] Function: mysql_fetch_row executed with result: "18|2319.67|-89.3282|26.4844". [Thu Mar 24 18:27:26 2011] Function: mysql_num_rows executed with result: "". [Thu Mar 24 18:27:26 2011] Function: mysql_fetch_row executed with result: "19|2302.48|57.4316|26.4844". [Thu Mar 24 18:27:26 2011] Function: mysql_num_rows executed with result: "". [Thu Mar 24 18:27:26 2011] Function: mysql_fetch_row executed with result: "20|-78.7974|-1169.57|2.14838". [Thu Mar 24 18:27:26 2011] Function: mysql_num_rows executed with result: "". [Thu Mar 24 18:27:26 2011] Function: mysql_fetch_row executed with result: "21|-2034.19|148.741|28.8359". [Thu Mar 24 18:27:26 2011] Function: mysql_num_rows executed with result: "". [Thu Mar 24 18:27:26 2011] Function: mysql_free_result executed. [Thu Mar 24 18:27:26 2011] Function: mysql_query executed: "SELECT * FROM `ownedcars` WHERE `ID`" with result: "0". [Thu Mar 24 18:27:26 2011] Function: mysql_store_result executed with result: "1" [Thu Mar 24 18:27:26 2011] Function: mysql_free_result executed.
[18:12:36] [MySQL] Connected (0) to root @ 127.0.0.1 via TCP/IP. [18:12:36] [MySQL] Server Version 5.5.8. [18:12:36] [MySQL] Auto reconnect is off. [18:12:36] 6|-152.795|70.2877|6.28111 [18:12:36] Store spawned at 0.000000 0.000000 0.000000! [18:12:36] 7|143.203|-201.151|1.57812 [18:12:36] Store spawned at 0.000000 0.000000 0.000000! [18:12:36] 8|251.889|-57.1905|1.57031 [18:12:36] Store spawned at 0.000000 0.000000 0.000000! [18:12:36] 9|822.329|-557.76|16.3359 [18:12:36] Store spawned at 0.000000 0.000000 0.000000! [18:12:36] 10|1315.47|-898.572|39.5781 [18:12:36] Store spawned at 0.000000 0.000000 0.000000! [18:12:36] 11|437.34|-1310.69|15.1121 [18:12:36] Store spawned at 0.000000 0.000000 0.000000! [18:12:36] 12|802.697|-1794.76|13.0234 [18:12:36] Store spawned at 0.000000 0.000000 0.000000! [18:12:36] 13|1450.04|-2287.26|13.5469 [18:12:36] Store spawned at 0.000000 0.000000 0.000000! [18:12:36] 14|1940.92|-2116.01|13.6953 [18:12:36] Store spawned at 0.000000 0.000000 0.000000! [18:12:36] 15|1833.02|-1842.61|13.5781 [18:12:36] Store spawned at 0.000000 0.000000 0.000000! [18:12:36] 16|2685.08|-2515.12|13.1273 [18:12:36] Store spawned at 0.000000 0.000000 0.000000! [18:12:36] 17|2117.83|897.498|11.1797 [18:12:36] Store spawned at 0.000000 0.000000 0.000000! [18:12:36] 18|2319.67|-89.3282|26.4844 [18:12:36] Store spawned at 0.000000 0.000000 0.000000! [18:12:36] 19|2302.48|57.4316|26.4844 [18:12:36] Store spawned at 0.000000 0.000000 0.000000! [18:12:36] 20|-78.7974|-1169.57|2.14838 [18:12:36] Store spawned at 0.000000 0.000000 0.000000! [18:12:36] 21|-2034.19|148.741|28.8359 [18:12:36] Store spawned at 0.000000 0.000000 0.000000! [18:12:36] ** 16 <-> Stores Loaded From <-> MySQL ** [18:12:36] Number of vehicle models: 3