12.03.2013, 09:02
Hello! I've got several problems with sscanf, and I would like to move on explode system, but I don't really know how. It's my load player data script, and as "my.username" was last to load there was several problems with showing forumID. Now when I put it in first slot there's a problem with sscanfing forumName. If I've got a nicknames like: Bobs, Robbers, IgrexolonO it will show like this: B bs, R bbers, I rexolonO. There's always a space at 2nd character (but the mysql_store_result() is fine (debug)):
Return: MexikanoS|1|1|4|999|800|200|488.3582|-1880.8929|15.3423|327.1967|0|0|0|0|0|0|0|0|0|0|0|0
So now, here goes the code
And I have no idea how to rewrite it to explode. https://sampforum.blast.hk/showthread.php?tid=223561 I just found out this tutorial, but I still don't really know, how to properly use it. Could somebody help me?
Regards.
Return: MexikanoS|1|1|4|999|800|200|488.3582|-1880.8929|15.3423|327.1967|0|0|0|0|0|0|0|0|0|0|0|0
So now, here goes the code
Код:
format(sqlquery, sizeof(sqlquery), "SELECT my.username, p.gid, p.forumID, p.adminLvl, p.skin, p.money, p.bMoney, p.lastPosX, p.lastPosY, p.lastPosZ, p.lastPosAngle, p.item_1, p.item_2, p.item_3, p.item_4, p.item_5, p.item_6, p.item_7, p.item_8, p.item_9, p.item_10, p.item_11, p.item_12 FROM players p LEFT JOIN mybb_users my ON (p.forumID = my.uid) WHERE `login`='%s'", pName_(pid)); mysql_query(sqlquery); mysql_store_result(); while(mysql_fetch_row_format(sqlstring, "|")) { printf(sqlstring); mysql_fetch_field_row(playerInfo[pid][forumName], "my.username"); printf("%s", playerInfo[pid][forumName]); sscanf(sqlstring, "p<|>s[24]iiiiiiffffiiiiiiiiiiii", playerInfo[pid][forumName], playerInfo[pid][gid], playerInfo[pid][forumID], playerInfo[pid][adminLvl], playerInfo[pid][skin], playerInfo[pid][money], playerInfo[pid][bMoney], playerInfo[pid][lastPos][0], playerInfo[pid][lastPos][1], playerInfo[pid][lastPos][2], playerInfo[pid][lastPos][3], playerInfo[pid][item][0], playerInfo[pid][item][1], playerInfo[pid][item][2], playerInfo[pid][item][3], playerInfo[pid][item][4], playerInfo[pid][item][5], playerInfo[pid][item][6], playerInfo[pid][item][7], playerInfo[pid][item][8], playerInfo[pid][item][9], playerInfo[pid][item][10], playerInfo[pid][item][11]); }
Regards.