06.07.2013, 18:26
Hi,
I made a SQL Table which contains 4 Flots (for teleports coordinates). When I'm trying to get the teleports from this table in my array (pawno code), it displays only the first teleport(*). It must be an error of the use of the sscanf function but I can't find why :S
Here is my code :
P.S. : printf(ResultlineTeleport); displays :
(*) With this example it displays only 0,-256.78,-2666.4,-2662.34.
Thanks for help,
Rick.
I made a SQL Table which contains 4 Flots (for teleports coordinates). When I'm trying to get the teleports from this table in my array (pawno code), it displays only the first teleport(*). It must be an error of the use of the sscanf function but I can't find why :S
Here is my code :
Код:
case GX_MYSQL_GET_EVENT_TELES:
{
// Check if the player is still connected
if (IsPlayerConnected(extraid))
{
// Store the result
mysql_store_result(GXSQLDBPointer);
// Set the number of teles added
EventTeleports = mysql_num_rows(GXSQLDBPointer);
format(strTempString,sizeof(strTempString),"* DEBUG : I found %d teleports for this event !",EventTeleports);
SendClientMessageToAll(COLOR_YELLOW,strTempString);
if (mysql_num_rows(GXSQLDBPointer) >= 1)
{
// Create variables
new ResultlineTeleport[300];
// Make the teleport array from SQL Query
for(new i=0; i<mysql_num_rows(GXSQLDBPointer); i++)
{
mysql_fetch_row_format(ResultlineTeleport);
printf(ResultlineTeleport);
sscanf(ResultlineTeleport,"p<|>ffff",EventRandomTeleports[i][0],EventRandomTeleports[i][1],EventRandomTeleports[i][2],EventRandomTeleports[i][3]);
}
}
// Caca
for(new i=0; i<EventTeleports; i++)
{
for(new j=0; j<4; j++)
{
format(strTempString,sizeof(strTempString),"** %d %f",i,EventRandomTeleports[i][j]);
SendClientMessageToAll(0xFFFFFFFF,strTempString);
}
}
}
mysql_free_result();
// Exit here
return 1;
}
Quote:
|
[13:28:32] 0|0|0|0 [13:28:32] -2656.78|633.921|14.4531|174.321 [13:28:32] -2666.4|625.058|14.4531|130.6 [13:28:32] -2662.34|610.599|14.4531|210.731 |
Thanks for help,
Rick.

