Sscanf Isn't Setting Enum
#1

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:
pawn Код:
mysql_query("SELECT * FROM samp_houses", THREAD_LOADHOUSES);
Here is the enum:
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];
Here is where the magic happens:
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(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
Reply
#2

After looking at a script I made in the past, I see that the e param should be before the p param.

pawn Код:
e<p<|>iffffffs[24]s[24]iiiiiiiiiiiiiiiiiiiiiiiiiis[64]>
Reply
#3

I've tried that already, but did again for good measure. Unfortunately it didn't change anything.
Reply
#4

Page 7 bump. I really need help with this.

Thanks.
Reply
#5

Page 12 bump.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)