15.10.2010, 13:01
I read from sql an vehicle , then i split it , i save each needed info into variabiles , but instead of (for example) -3223.4441 it gives me something like 3223.000000
The code is below , and some info from log too .
Variabiles defining :
The function
The data from printf
PS : The function was called 5 times .
The code is below , and some info from log too .
Variabiles defining :
pawn Код:
enum cInfo
{
id,
Owned,
Owner[MAX_PLAYER_NAME],
Faction,
Model,
Float:Cx,
Float:Cy,
Float:Cz,
Float:Inc,
C1,
C2,
}
new CarInfo[5000][cInfo];
pawn Код:
public LoadSQLCar(sqlid)
{
new query[128];
new value[32];
new wholeline[1024];
format(query, sizeof(query), "SELECT * FROM `vehicles` WHERE `id` = '%d' LIMIT 1", sqlid);
mysql_query(query);
mysql_store_result();
mysql_fetch_row(wholeline);
///-----
mysql_get_field("Owned", value);
CarInfo[sqlid][Owned] = strval(value);
mysql_get_field("Owner", CarInfo[sqlid][Owner]);
mysql_get_field("Faction", value);
CarInfo[sqlid][Faction] = strval(value);
mysql_get_field("Cx", value);
CarInfo[sqlid][Cx] = strval(value);
mysql_get_field("Cy", value);
CarInfo[sqlid][Cy] = strval(value);
mysql_get_field("Cz", value);
CarInfo[sqlid][Cz] = strval(value);
mysql_get_field("Inc", value);
CarInfo[sqlid][Inc] = strval(value);
mysql_get_field("C1", value);
CarInfo[sqlid][C1] = strval(value);
mysql_get_field("C2", value);
CarInfo[sqlid][C2] = strval(value);
//--
printf("%s",wholeline);
printf("%d|%d|%s|%d|%f|%f|%f|%f|%d|%d|",sqlid,CarInfo[sqlid][Owned],CarInfo[sqlid][Owner],CarInfo[sqlid][Faction],CarInfo[sqlid][Cx],CarInfo[sqlid][Cy],CarInfo[sqlid][Cz],CarInfo[sqlid][Inc],CarInfo[sqlid][C1],CarInfo[sqlid][C2]);
return 1;
}
Код:
[04:00:12] 1|0|No-One|0|522|2483.76|-1682.67|12.9051|352.181|3|8 [04:00:12] 1|0|No-One|0|2483.000000|-1682.000000|12.000000|352.000000|3|8| [04:00:12] 2|0|No-One|0|543|2506.21|-1679.79|13.3395|144.561|32|8 [04:00:12] 2|0|No-One|0|2506.000000|-1679.000000|13.000000|144.000000|32|8| [04:00:12] 3|0|No-One|0|561|2509.86|-1674.47|13.2601|150.689|8|17 [04:00:12] 3|0|No-One|0|2509.000000|-1674.000000|13.000000|150.000000|8|17| [04:00:12] 4|0|No-One|0|541|2470.17|-1677.87|13.1314|39.2007|68|8 [04:00:12] 4|0|No-One|0|2470.000000|-1677.000000|13.000000|39.000000|68|8| [04:00:12] 5|0|No-One|0|541|2467.31|-1671.64|13.1103|15.3821|2|1 [04:00:12] 5|0|No-One|0|2467.000000|-1671.000000|13.000000|15.000000|2|1|