PDA

View Full Version : loading problem [sscanf]


juraska
26/11/2011, 05:34 PM
I have some bug with data loading, actually is more than bug is crash my server :eek:
Crash



--------------------------

SA-MP Server: 0.3d-RC9



Exception At Address: 0x770F22C2



Registers:

EAX: 0x00000024 EBX: 0x00000042 ECX: 0x004D6430 EDX: 0x00000000

ESI: 0x00000024 EDI: 0x00000020 EBP: 0x0018FD14 ESP: 0x0018FD00

EFLAGS: 0x00010212



Stack:

+0000: 0x02F0C140 0x00000000 0x026B3964 0x0018FD18

+0010: 0x002F168F 0x0018FD50 0x0048D99E 0x00000020

+0020: 0x0048DFEE 0x00000000 0x02F0C140 0x00000000

+0030: 0x00000042 0x00000FFF 0x0018FD28 0x0018F8D4

+0040: 0x0018FEA4 0x00491FF8 0x004ACC60 0xFFFFFFFF

+0050: 0x00000000 0x0040534E 0x00000042 0x00000000

+0060: 0x02F0C134 0x0018FD80 0x02EB5EE8 0x0040578F

+0070: 0x00000001 0x021E3F50 0x021E3F50 0x00000010

+0080: 0x02EBB0FC 0x004010B6 0x021E3F50 0x02F0C140

+0090: 0x02EBD698 0x00402B63 0x021E3F50 0x0000003C

+00A0: 0x0018FDB8 0x02F0C134 0x0058E938 0x00000000

+00B0: 0x00000000 0x021E3F50 0x00000001 0x0004EA94

+00C0: 0x0004EA9C 0x0004EC54 0x0004AC58 0x0004EC3C

+00D0: 0x0004AC58 0x02EB5EE8 0x02EBD698 0x00000000

+00E0: 0x02EB53A0 0x000077B0 0x0047B458 0x021E3F50

+00F0: 0x0018FE18 0x00000001 0x005894B0 0x75D110FF

+0100: 0x3BA447C8 0x00588EE8 0x0058E938 0x00000001

+0110: 0x00588EE8 0x0058E978 0x000001F4 0x0048677A

+0120: 0x00000005 0x75D11136 0x75D116C5 0x00000000

+0130: 0x3BA447C8 0x00482E1E 0x00000000 0x00001DB1


Debug log


[10:29:00] CMySQLHandler::Query(SELECT * FROM `businessdata` WHERE `businessid` < 500 ORDER BY businessid) - Successfully executed.

[10:29:00] >> mysql_store_result( Connection handle: 1 )

[10:29:00] CMySQLHandler::StoreResult() - Result was stored.

[10:29:00] >> mysql_num_rows( Connection handle: 1 )

[10:29:00] CMySQLHandler::NumRows() - Returned 5 row(s)

[10:29:00] >> mysql_fetch_row_format( Connection handle: 1 )

[10:29:00] CMySQLHandler::FetchRow() - Return: 1||1964.07|1335.93|9.2501|1|1|0|0|

[10:29:00] >> mysql_fetch_row_format( Connection handle: 1 )

[10:29:00] CMySQLHandler::FetchRow() - Return: 2||1962.2|1334.75|9.25781|6|1|0|0|

[10:29:00] >> mysql_fetch_row_format( Connection handle: 1 )

[10:29:00] CMySQLHandler::FetchRow() - Return: 3|Barber (Small)|1156930000|1151750000|1091830000|4|1|0|1|P layer

[10:29:00] >> mysql_fetch_row_format( Connection handle: 1 )

[10:29:00] CMySQLHandler::FetchRow() - Return: 4||1974.44|1341.35|14.4689|2|1|0|0|

[10:29:00] >> mysql_fetch_row_format( Connection handle: 1 )

[10:29:00] CMySQLHandler::FetchRow() - Return: 5||1963.67|1341.47|15.4823|8|1|0|0|

[10:29:00] >> mysql_fetch_row_format( Connection handle: 1 )

[10:29:00] >> mysql_free_result( Connection handle: 1 )

[10:29:00] CMySQLHandler::FreeResult() - Result was successfully free'd.

As you can see everthing looks fain. But it's not create dynamic pickup and text

script

mysql_query("SELECT * FROM `businessdata` WHERE `businessid` < "#MAX_BUSINESS" ORDER BY businessid");
mysql_store_result();

if(mysql_num_rows() > 0)
{
while(mysql_fetch_row(GlobalQuery))
{
sscanf(GlobalQuery, "p<|>ds[50]fffdddds[24]",
BusID, busname, Pos[0], Pos[1],Pos[2],bust,buslvl,lasttrans,owned,owner);

strmid(ABusinessData[BusID][BusinessName], busname, 0, 30, 30);
ABusinessData[BusID][BusinessX] = Pos[0];
ABusinessData[BusID][BusinessY] = Pos[1];
ABusinessData[BusID][BusinessZ] = Pos[2];
ABusinessData[BusID][BusinessType] = bust;
ABusinessData[BusID][BusinessLevel] = buslvl;
ABusinessData[BusID][LastTransaction] = lasttrans;
ABusinessData[BusID][Owned] = owned;
strmid(ABusinessData[BusID][Owner], owner, 0,24,24);

SPAWN_BUSINESS(BusID);
TotalBusiness++;

}
}
mysql_free_result();

#define SPAWN_BUSINESS(%1) \
ABusinessData[%1][PickupID] = CreateDynamicPickup(1274, 1, \
ABusinessData[%1][BusinessX], ABusinessData[%1][BusinessY], \
ABusinessData[%1][BusinessZ], 0, 0, -1); \
ABusinessData[%1][DoorText] = CreateDynamic3DTextLabel("", -1, \
ABusinessData[%1][BusinessX], ABusinessData[%1][BusinessY], \
ABusinessData[%1][BusinessZ]+0.75, 20, \
INVALID_PLAYER_ID, INVALID_VEHICLE_ID, true, 0, 0, -1); \
UpdateBusinessLabel(BusID)




Thanks in advance