25.09.2009, 17:18
The following function called under OnGameModeInit causes a big problem, when I compile I got no warnings but when I start up my server this appears in server log after the function is called:
I've debbuged it and here is the buggy part:
This can help:
Any idea? This warning fucks up all my script...
Quote:
[19:15:29] Script[gamemodes/BCL-RP.amx]: Run time error 7: "Stack underflow" |
pawn Code:
stock LoadSQLPickups()
{
new Field[64];
new Data[512];
new sql[80];
format(sql, sizeof(sql), "SELECT COUNT(*) FROM pickups");
mysql_query(sql);
mysql_store_result();
mysql_fetch_row(Data);
totalpickups = strval(Data);
mysql_free_result();
for (new idx=1; idx<=totalpickups; idx++)
{
format(sql, sizeof(sql), "SELECT * FROM pickups WHERE id=%d", idx);
mysql_query(sql);
mysql_store_result();
if (mysql_num_rows() > 0)
{
mysql_fetch_row(Data);
mysql_fetch_field_row(Field,"message");
strmid(PickupInfo[idx][puMessage],Field,0,strlen(Field),128);
mysql_fetch_field_row(Field,"type");
PickupInfo[idx][puType] = strval(Field);
mysql_fetch_field_row(Field,"model");
PickupInfo[idx][puModel] = strval(Field);
mysql_fetch_field_row(Field,"x");
PickupInfo[idx][puX] = floatstr(Field);
mysql_fetch_field_row(Field,"y");
PickupInfo[idx][puY] = floatstr(Field);
mysql_fetch_field_row(Field,"z");
PickupInfo[idx][puZ] = floatstr(Field);
mysql_free_result();
CreatePickup(PickupInfo[idx][puModel], PickupInfo[idx][puType], PickupInfo[idx][puX], PickupInfo[idx][puY], PickupInfo[idx][puZ]);
}
}
printf("%d pickups loaded from DB", totalpickups);
return 1;
}
pawn Code:
mysql_fetch_field_row(Field,"message");
strmid(PickupInfo[idx][puMessage],Field,0,strlen(Field),128);
pawn Code:
enum puInfo
{
Float: puX,
Float: puY,
Float: puZ,
puType,
puModel,
puMessage[128]
}; new PickupInfo[MAX_PICKUP+1][puInfo];