12.09.2011, 09:53
(
Последний раз редактировалось [Diablo]; 12.09.2011 в 12:49.
)
Hello.
I have problem trying to save the user row from mysql to an enum. For the sake of simplicity i will only use 3 columns.
the sql structure is similar to this -> username | email | money.
My enum looks like this:
After clicking login on "login dialog", i have a function that checks the user in database. If ok, proceeds to the data loading.
here is the function for loading..
For testing purposes i have print the PlayerData[playerid][pUsername] and PlayerData[playerid][pMoney] and I get Username: * and Money: 0
Any help is aprreciated.
I have problem trying to save the user row from mysql to an enum. For the sake of simplicity i will only use 3 columns.
the sql structure is similar to this -> username | email | money.
My enum looks like this:
pawn Код:
enum uAccount
{
pUsername,
pEmail,
pMoney
};
new PlayerData[MAX_PLAYERS][uAccount];
here is the function for loading..
pawn Код:
stock UserLoggedIn(playerid)
{
format(sqlQuery, sizeof(sqlQuery), "SELECT * FROM accounts WHERE username = '%s'", PlayerName(playerid)); // PlayerName returns the name
mysql_query(sqlQuery);
mysql_store_result();
if(mysql_fetch_row(sqlQuery))
{
sscanf(sqlQuery, "p<|>e<s[24]s[255]i>", PlayerData[playerid]);
}
mysql_free_result();
return 1;
}
Any help is aprreciated.