Код:
case DIALOG_WITHDRAW:
{
if(!response) return 1;
if(response)
{
new query[256],pname[MAX_PLAYER_NAME],rows;
GetPlayerName(playerid, pname, sizeof(pname));
format(query,sizeof(query), "SELECT * FROM users WHERE username = '%s'",pname);
mysql_query(query);
mysql_store_result();
rows = mysql_num_rows();
if(!rows)
{
SCM(playerid, RED, "You don't have an account in Bank");
ShowPlayerDialog(playerid, DIALOG_BANK, DIALOG_STYLE_LIST, "H-Bank", "CreateAccount\nStats\nDeposit\nWithdraw", "OK", "Cancel");
mysql_free_result();
return 1;
}
if(rows == 1)
{
new value = strval(inputtext);
new money[9];
format(query, sizeof(query), "SELECT money FROM users WHERE username = '%s'", pname);
mysql_query(query);
mysql_fetch_field_row(money, "money");
if(value > strval(money)) return SCM(playerid, RED, "You don't have that amount in your bank account");
format(query, sizeof(query), "UPDATE users SET money = '-%i' WHERE username = '%s'", value, pname);
mysql_query(query);
GivePlayerMoney(playerid, value);
return 1;
}
mysql_free_result();
return 1;
}
So when i go ingame to test it it says You don't have that amount in your bank account, but when i check MYSQL i have that amount.