20.01.2012, 00:16
Basically put, I load my vehicles from the database and they do load as found in the log (see below) but they don't actually spawn? Strange right?
And my load vehicle function:
Quote:
[19:03:42] >> mysql_query( Connection handle: 1 ) [19:03:42] CMySQLHandler::Query(SELECT * FROM vehicles WHERE ID = '0') - Successfully executed. [19:03:42] >> mysql_store_result( Connection handle: 1 ) [19:03:42] CMySQLHandler::StoreResult() - Result was stored. [19:03:42] >> mysql_retrieve_row( Connection handle: 1 ) [19:03:42] >> mysql_fetch_field_row( Connection handle: 1 ) [19:03:42] CMySQLHandler::FetchField("ID") - 0 [19:03:42] >> mysql_fetch_field_row( Connection handle: 1 ) [19:03:42] CMySQLHandler::FetchField("Model") - 560 [19:03:42] >> mysql_fetch_field_row( Connection handle: 1 ) [19:03:42] CMySQLHandler::FetchField("PosX") - 1582.21 [19:03:42] >> mysql_fetch_field_row( Connection handle: 1 ) [19:03:42] CMySQLHandler::FetchField("PosY") - -1303.5 [19:03:42] >> mysql_fetch_field_row( Connection handle: 1 ) [19:03:42] CMySQLHandler::FetchField("PosZ") - 17.3694 [19:03:42] >> mysql_fetch_field_row( Connection handle: 1 ) [19:03:42] CMySQLHandler::FetchField("Angle") - 0 [19:03:42] >> mysql_fetch_field_row( Connection handle: 1 ) [19:03:42] CMySQLHandler::FetchField("Interior") - 0 [19:03:42] >> mysql_fetch_field_row( Connection handle: 1 ) [19:03:42] CMySQLHandler::FetchField("World") - 0 [19:03:42] >> mysql_fetch_field_row( Connection handle: 1 ) [19:03:42] CMySQLHandler::FetchField("Color1") - 1 [19:03:42] >> mysql_fetch_field_row( Connection handle: 1 ) [19:03:42] CMySQLHandler::FetchField("Color2") - 1 [19:03:42] >> mysql_fetch_field_row( Connection handle: 1 ) [19:03:42] CMySQLHandler::FetchField("Faction") - 0 [19:03:42] >> mysql_free_result( Connection handle: 1 ) [19:03:42] CMySQLHandler::FreeResult() - Result was successfully free'd. |
pawn Код:
public LoadVehicles(vehid)
{
format(mainstring,sizeof(mainstring),"SELECT * FROM vehicles WHERE ID = '%d'",vehid);
mysql_query(mainstring);
mysql_store_result();
new result[64];
if(mysql_retrieve_row())
{
mysql_fetch_field_row(result,"ID");
VehicleInfo[vehid][cID] = strval(result);
mysql_fetch_field_row(result,"Model");
VehicleInfo[vehid][cID] = strval(result);
mysql_fetch_field_row(result,"PosX");
VehicleInfo[vehid][cPosX] = floatstr(result);
mysql_fetch_field_row(result,"PosY");
VehicleInfo[vehid][cPosY] = floatstr(result);
mysql_fetch_field_row(result,"PosZ");
VehicleInfo[vehid][cPosZ] = floatstr(result);
mysql_fetch_field_row(result,"Angle");
VehicleInfo[vehid][cAngle] = floatstr(result);
mysql_fetch_field_row(result,"Interior");
VehicleInfo[vehid][cInterior] = strval(result);
mysql_fetch_field_row(result,"World");
VehicleInfo[vehid][cWorld] = strval(result);
mysql_fetch_field_row(result,"Color1");
VehicleInfo[vehid][cColor1] = strval(result);
mysql_fetch_field_row(result,"Color2");
VehicleInfo[vehid][cColor2] = strval(result);
mysql_fetch_field_row(result,"Faction");
VehicleInfo[vehid][cFaction] = strval(result);
VehicleInfo[vehid][cAlarm] = 0;
VehicleInfo[vehid][cEngine] = 0;
VehicleInfo[vehid][cFuel] = 100.0;
AddStaticVehicle(VehicleInfo[vehid][cModel],VehicleInfo[vehid][cPosX],VehicleInfo[vehid][cPosY],VehicleInfo[vehid][cPosZ],VehicleInfo[vehid][cAngle],VehicleInfo[vehid][cColor1],VehicleInfo[vehid][cColor2]);
LinkVehicleToInterior(vehid,VehicleInfo[vehid][cInterior]);
SetVehicleVirtualWorld(vehid,VehicleInfo[vehid][cWorld]);
}
mysql_free_result();
return 1;
}