08.02.2013, 15:43
Hi. I can't format correct ID of my MySQL Query (I don't know why). Here's the code:
And everything is fine but format is: S-RP: Witaj Peter Weiss! Zalogowałeś się jako IgrexolonO (ID: 1, GID: 0, FID: 101)
^ Forum ID should be 1.
MySQL debug:
As you can see forumID is 1. Please help me!
P.S.: If I won't format "pid" forumID is ok.
Код:
forward onPlayerLogin(pid); public onPlayerLogin(pid) { TogglePlayerSpectating(pid, 0); format(sqlquery, 512, "SELECT p.gid, p.forumID, p.adminLvl, p.skin, p.money, p.bMoney, p.lastPosX, p.lastPosY, p.lastPosZ, p.lastPosAngle, my.username FROM players p LEFT JOIN mybb_users my ON (p.forumID = my.uid) WHERE `login`='%s'", pName_(pid)); mysql_query(sqlquery); mysql_store_result(); mysql_fetch_row_format(sqlstring); sscanf(sqlstring, "p|iiiiiiffffs", 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][forumName]); mysql_free_result(); format(formats, sizeof(formats), "S-RP: Witaj %s! Zalogowałeś się jako %s (ID: %i, GID: %i, FID: %i)", playerInfo[pid][forumName], pNameW(pid), pid, playerInfo[pid][gid], playerInfo[pid][forumID]); SendClientMessage(pid, 0, formats);
^ Forum ID should be 1.
MySQL debug:
Код:
[14:47:44] CMySQLHandler::Query(SELECT p.gid, p.forumID, p.adminLvl, p.skin, p.money, p.bMoney, p.lastPosX, p.lastPosY, p.lastPosZ, p.lastPosAngle, my.username FROM players p LEFT JOIN mybb_users my ON (p.forumID = my.uid) WHERE `login`='Peter_Weiss') - Successfully executed. [14:47:44] >> mysql_store_result( Connection handle: 1 ) [14:47:44] CMySQLHandler::StoreResult() - Result was stored. [14:47:44] >> mysql_fetch_row_format( Connection handle: 1 ) [14:47:44] CMySQLHandler::FetchRow() - Return: 1|1|4|998|500|0|2114.8350|-1774.0463|4.9264|236.6608|MexikanoS
P.S.: If I won't format "pid" forumID is ok.