Loading pickups from MySQL
#1

Ok so I had this code first since I used a file system:

pawn Код:
public LoadPickups()
{
    new i2;
    for(new i=1; i<(dini_Int("bizzcount.ini", "bizzcount")+1); i++)
    {
        i2 = i;
      format(str, sizeof(str), "businesses/%i.ini", i);
      if(!dini_Exists(str)) i2++;
      if(i2 == i) // file exists
      {
            new pickup = CreatePickup(1274, 1, dini_Float(str, "loc X"), dini_Float(str, "loc Y"), dini_Float(str, "loc Z"));
            dini_IntSet(str, "Pickup ID", pickup);
        }
    }
    return 1;
}
And it would create a pickup for every bizz file (all bizzes in the businesses folder). But now I want to load the pickups from my database but since I'm not very used to this I can't figure out how to..
The 'bizzes' table in my database has 10 columbs and the 9th is called PickupIds. I have that columb so it can identify the bizz at OnPlayerPickupPickup (which I also need help with lol). Also, I use BIZZCOUNT.INI to keep track on the amount of bizzes, but is there an easier way to do this with MySQL? Right now this is where I am:
pawn Код:
fpublic LoadPickups()
{
    MySQLCheckConnection();
    for(new i=1; i<MAX_PICKUPS; i++)
    {
        format(query, sizeof(query), "SELECT * FROM bizzes WHERE id = %i LIMIT 1", i);
        samp_mysql_query(query);
        samp_mysql_store_result();
      new sqline[128],sqlfield[16];
        samp_mysql_fetch_row(sqline);
        samp_mysql_get_field("bpickup", sqlfield);
//Dunno how to continue
There are also 3 locations columbs (locX locY locZ).
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)