get Free Slot
#1

pawn Код:
stock GetFreeHouseSlot()
{
    new UsedSlot;
    for(new ID = 0; ID < MAX_HOUSES; ID++)
    {
        new mysql_string[4];
        mysql_fetch_field_row(mysql_string, "HouseID");
        UsedSlot = strval(mysql_string);
       
        if(ID != UsedSlot)
        {
            return ID;
        }
    }
    return -1;
}
i try to select a free slot from my mysql db
like if u have these id's in my data base
Код:
1
2
4
5
then the id should return 0 and if i have
Код:
0
1
2
4
5
then it should return 3

if you dont understand me look at Donyas topic, i think we are looking for the same thing
http://forum.sa-mp.com/showthread.ph...ight=Free+Slot
Reply
#2

pawn Код:
stock GetFreeHouseSlot()
{
    new szQuery[32];
    for(new id = 0; id < MAX_HOUSES; id++)
    {
        mysql_format(1, szQuery, "SELECT * FROM `Houses` WHERE `HouseID` = %d", id);
    mysql_query(szQuery);
        if(!mysql_num_rows()) return id;
    }
    return -1;
}
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)