Run time error 7: "Stack underflow"
#1

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:
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;
}
I've debbuged it and here is the buggy part:
pawn Code:
mysql_fetch_field_row(Field,"message");
strmid(PickupInfo[idx][puMessage],Field,0,strlen(Field),128);
This can help:
pawn Code:
enum puInfo
{
    Float: puX,
    Float: puY,
    Float: puZ,
    puType,
    puModel,
    puMessage[128]
}; new PickupInfo[MAX_PICKUP+1][puInfo];
Any idea? This warning fucks up all my script...
Reply


Messages In This Thread
Run time error 7: "Stack underflow" - by Coicatak - 25.09.2009, 17:18
Re: Run time error 7: "Stack underflow" - by Logitech3334 - 05.09.2010, 07:25
Re: Run time error 7: "Stack underflow" - by Calgon - 05.09.2010, 07:32
Re: Run time error 7: "Stack underflow" - by Simon - 05.09.2010, 07:44
Re: Run time error 7: "Stack underflow" - by Calgon - 05.09.2010, 07:54

Forum Jump:


Users browsing this thread: 1 Guest(s)