10.07.2012, 22:45
Hey I've been having this problem where sscanf doesnt seem to want to apply the mySQL row to an enum, and I just cant figure out what is wrong. I've tried searching but all the threads with this problem never get answered and are abandoned.
Here is the query:
Here is the enum:
Here is where the magic happens:
printf(row); prints the row correctly
printf(checking); prints "0 ". It should be "1 No-one"
House isnt IG.
I've tried changing the i's to d's, putting p<|> inside of e<>. I've checked multiple times that the database = the enum = sscanf (same order and made sure all fields were accounted for) but to no avail.
If I could get some help that would be greatly appreciated.
Thanks,
Josh
Here is the query:
pawn Код:
mysql_query("SELECT * FROM samp_houses", THREAD_LOADHOUSES);
pawn Код:
enum hInfo
{
hDBID,
Float:hEntrancex,
Float:hEntrancey,
Float:hEntrancez,
Float:hExitx,
Float:hExity,
Float:hExitz,
hOwner[MAX_PLAYER_NAME],
hDescription[MAX_PLAYER_NAME],
hValue,
hHel,
hArm,
hInt,
hLock,
hOwned,
hRent,
hRentabil,
hTakings,
hVec,
hVcol1,
hVcol2,
hLevel,
hWorld,
hSetted,
hDrugs,
hMaterials,
hWeapon1,
hAmmo1,
hWeapon2,
hAmmo2,
hWeapon3,
hAmmo3,
hWeapon4,
hAmmo4,
hWeapon5,
hAmmo5,
hWeapon6,
hAmmo6,
hDate,
hMessage[64],
};
new HouseInfo[MAX_HOUSES][hInfo];
pawn Код:
case THREAD_LOADHOUSES:
{
mysql_store_result();
new row[4000];
while(mysql_fetch_row(row))
{
printf(row);
sscanf(row, "p<|>e<iffffffs[24]s[24]iiiiiiiiiiiiiiiiiiiiiiiiiis[64]>", HouseInfo[1]);
new checking[40];
format(checking,sizeof(checking),"%d %s",HouseInfo[1][hDBID],HouseInfo[1][hOwner]);
printf(checking);
}
mysql_free_result();
}
printf(checking); prints "0 ". It should be "1 No-one"
House isnt IG.
I've tried changing the i's to d's, putting p<|> inside of e<>. I've checked multiple times that the database = the enum = sscanf (same order and made sure all fields were accounted for) but to no avail.
If I could get some help that would be greatly appreciated.
Thanks,
Josh