get Free Slot - Printable Version
+- SA-MP Forums Archive (
https://sampforum.blast.hk)
+-- Forum: SA-MP Scripting and Plugins (
https://sampforum.blast.hk/forumdisplay.php?fid=8)
+--- Forum: Scripting Help (
https://sampforum.blast.hk/forumdisplay.php?fid=12)
+---- Forum: Help Archive (
https://sampforum.blast.hk/forumdisplay.php?fid=89)
+---- Thread: get Free Slot (
/showthread.php?tid=270664)
get Free Slot - Unknown123 - 21.07.2011
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
then the id should return 0 and if i have
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
Re: get Free Slot -
Donya - 21.07.2011
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;
}