22.05.2011, 19:21
I am currently working on a mysql registration system. I have everything working besides taking things out of the database such as score and money. I have money set to 100 in the database and score set to 9. When I go into the game it gives me 53 dollars and 52 score. Can anyone help me sort this out?
Here is the code I am using.
Here is the code I am using.
pawn Код:
case LOGIN_DIALOG:
{
new Query[300];
format(Query,sizeof(Query),"SELECT * FROM `names` WHERE `Username` = '%s' AND `Password` = '%s'", Name(playerid), inputtext);
mysql_query(Query);
mysql_store_result();
if(!mysql_num_rows())
{
SendClientMessage(playerid, red, "Your account isnt registered or your password is wrong!");
LoginDialog(playerid);
}
else
{
new stats[2500];
if(mysql_fetch_row_format(stats))
{
mysql_fetch_field_row(pInfo[playerid][Money],"Money");
mysql_fetch_field_row(pInfo[playerid][Level],"Level");
mysql_fetch_field_row(pInfo[playerid][Score],"Score");
SetPlayerScore(playerid, pInfo[playerid][Score]);
GivePlayerMoney(playerid,pInfo[playerid][Money]);
print(pInfo[playerid][Money]);
print(pInfo[playerid][Score]);
}
pInfo[playerid][logged] = 1;
SendClientMessage(playerid, green, "You have succesfully logged in!");
printf("%s (%i) logged in with password %s", Name(playerid), playerid, inputtext);
}
mysql_free_result();
if(response == 0)
{
SendClientMessage(playerid, red, "You must log in or register to use this server");
}
return 1;
}