Mysql data not properly getting processed into enum
#1

I'm currently trying to load up some account data from mysql into a enum using sscanf, but it doesn't seem to work.

My enum looks like this.
Код:
enum accountinfo {
	ID,
	Username[MAX_PLAYER_NAME],
	Hours,
	Minutes,
	Points,
	Group,
	Race[10],
	Bool:Logged,
	Session,
	// etc etc
};
new AccountData[MAX_PLAYERS][accountinfo];
Код:
stock AccountLogin(playerid){
	new string[100];
	format(string,sizeof(string),"SELECT id,username,hours,minutes,points,groups,race FROM accounts WHERE username = '%s'",AccountData[playerid][Username]);
	mysql_query(string);
	mysql_store_result();
	new query[500];
	if(mysql_fetch_row_format(query,"|")){
	    print(query);
		sscanf(query, "e<p<|>is[24]iiiis[10]>", AccountData[playerid]);
		print(query);
		print(AccountData[playerid][ID]);
		print(AccountData[playerid][Username]);
		print(AccountData[playerid][Hours]);
	}
	mysql_free_result();
	return 1;
}
That's the code I'm having problems with, when printing query it seems correct so I'm suspecting it's something with sscanf, when printing AccounData ID in console it returns a smiley and my username, which makes no sense since its an integer, the ID is supposed to be your mysql assigned ID.

Username prints my username so it's okay, but it's set another place too anyways.
Hours prints <null>

I'm using sscanf 2.8.1
Reply


Messages In This Thread

Forum Jump:


Users browsing this thread: 1 Guest(s)