23.10.2011, 12:48
Hey, thanks for reading.
Since I started using sscanf in my account-load function (as a replacement of split(); ) it's having some problems.
Sometimes, the player's stats are not correctly loaded. Some of the variables such as 'username' are empty. That's a real problem, because I use SetPlayerName later on in my script, and if the input of SetPlayerName is blank, the server will crash. That has happened a few times now.
So I want to get rid of this bug, but how? I've worked over a year with sscanf now, and i really cannot explain this.
I tried e<> for the enum, i tried changing some datatypes in my database (from VARCHAR to float) but that doesn't work either. I would be very glad if someone could help me.
At last, the code causing the problem:
Greetz,
Danny
Since I started using sscanf in my account-load function (as a replacement of split(); ) it's having some problems.
Sometimes, the player's stats are not correctly loaded. Some of the variables such as 'username' are empty. That's a real problem, because I use SetPlayerName later on in my script, and if the input of SetPlayerName is blank, the server will crash. That has happened a few times now.
So I want to get rid of this bug, but how? I've worked over a year with sscanf now, and i really cannot explain this.
I tried e<> for the enum, i tried changing some datatypes in my database (from VARCHAR to float) but that doesn't work either. I would be very glad if someone could help me.
At last, the code causing the problem:
pawn Код:
mysql_fetch_row_format(mysqlquery, "|");
if(!sscanf(mysqlquery,"p<|>ds[25]s[42]s[40]s[20]dddddddddds[50]s[50]s[50]dddddddffffdddds[15]dddddddddddddddddddd",
AccountInfo[extraid][identification],
AccountInfo[extraid][username],
AccountInfo[extraid][spassword],
AccountInfo[extraid][emailaddress],
AccountInfo[extraid][ipaddress],
AccountInfo[extraid][status],
AccountInfo[extraid][autologin],
AccountInfo[extraid][language],
AccountInfo[extraid][age],
AccountInfo[extraid][carlicense],
AccountInfo[extraid][flylicense],
AccountInfo[extraid][boatlicense],
AccountInfo[extraid][viprank],
AccountInfo[extraid][property1],
AccountInfo[extraid][property2],
AccountInfo[extraid][warnreason1],
AccountInfo[extraid][warnreason2],
AccountInfo[extraid][warnreason3],
AccountInfo[extraid][serversounds],
AccountInfo[extraid][phone],
AccountInfo[extraid][daysplayed],
AccountInfo[extraid][hoursplayed],
AccountInfo[extraid][minutesplayed],
AccountInfo[extraid][money],
AccountInfo[extraid][bankmoney],
AccountInfo[extraid][positionx],
AccountInfo[extraid][positiony],
AccountInfo[extraid][positionz],
AccountInfo[extraid][angle],
AccountInfo[extraid][interior],
AccountInfo[extraid][faction],
AccountInfo[extraid][frank],
AccountInfo[extraid][factioncode],
AccountInfo[extraid][fjoindate],
AccountInfo[extraid][fishingexp],
AccountInfo[extraid][fish],
AccountInfo[extraid][cigarettes],
AccountInfo[extraid][beer],
AccountInfo[extraid][sprunk],
pWeapons[extraid][0][0],
pWeapons[extraid][0][1],
pWeapons[extraid][1][0],
pWeapons[extraid][1][1],
pWeapons[extraid][2][0],
pWeapons[extraid][2][1],
pWeapons[extraid][3][0],
pWeapons[extraid][3][1],
pWeapons[extraid][4][0],
pWeapons[extraid][4][1],
pWeapons[extraid][5][0],
pWeapons[extraid][5][1],
pWeapons[extraid][6][0],
pWeapons[extraid][6][1],
JailInfo[extraid][2])) printf("[ERROR]: Something went wrong on LoadAccount. Accountname: %s",PlayerName[extraid]);
Danny