09.03.2010, 20:50
I have a problem with saving a string to a variable... keep getting diferent errors about array and stuff like that. If someone could tell me what i'm doing wrong...
My problem is with this line:
I know strval modifies the variable and returns an integer... but what function should i use to return a string... like strstr? which doesn't exist...
Код:
stock LoadVehicles()
{
new query[128], Field[11][64], Row[128], vehicleid;
format(query, sizeof(query), "SELECT * FROM `vehicles`");
mysql_query(query);
mysql_store_result();
if(mysql_num_rows())
{
while(mysql_fetch_row_format(Row, ","))
{
split(Row, Field, ',');
mysql_free_result();
vehicleid = strval(Field[0]);
VehicleInfo[vehicleid][vModel] = strval(Field[1]);
VehicleInfo[vehicleid][vPosX] = strval(Field[2]);
VehicleInfo[vehicleid][vPosY] = strval(Field[3]);
VehicleInfo[vehicleid][vPosZ] = strval(Field[4]);
VehicleInfo[vehicleid][vPosA] = strval(Field[5]);
VehicleInfo[vehicleid][vColor1] = strval(Field[6]);
VehicleInfo[vehicleid][vColor2] = strval(Field[7]);
VehicleInfo[vehicleid][vBuyable] = strval(Field[8]);
VehicleInfo[vehicleid][vPrice] = strval(Field[9]);
VehicleInfo[vehicleid][vOwner] = Field[10];
printf("%i (%s) = CreateVehicle(%i, %f, %f, %f, %f, %i, %i, %i);", vehicleid, VehicleInfo[vehicleid][vOwner], VehicleInfo[vehicleid][vModel], VehicleInfo[vehicleid][vPosX], VehicleInfo[vehicleid][vPosY], VehicleInfo[vehicleid][vPosZ], VehicleInfo[vehicleid][vPosA], VehicleInfo[vehicleid][vColor1], VehicleInfo[vehicleid][vColor2], 60);
//CreateVehicle(VehicleInfo[vehicleid][vModel], VehicleInfo[vehicleid][vPosX], VehicleInfo[vehicleid][vPosY], VehicleInfo[vehicleid][vPosZ], VehicleInfo[vehicleid][vPosA], VehicleInfo[vehicleid][vColor1], VehicleInfo[vehicleid][vColor2], 60);
}
}
mysql_free_result();
}
Код:
VehicleInfo[vehicleid][vOwner] = Field[10];

