Mysql Threaded Question
#1

I have this code, but It doesn't work. I'm trying to still learn these new functions before I convert my gamemode. Anyone tell me if I'm doing something wrong, thanks in advance.

pawn Код:
public BankAccBal(account) {

    new bal, bals[64];

    format(myquery, sizeof(myquery), "SELECT balance FROM saes_bank_accounts WHERE number='%i'", account);
    mysql_function_query(1, myquery, true, "OnBankBal", "d", account);
    return 1;
   
}

forward OnBankBal(account);
public OnBankBal(account)
{
    new rows, fields;
    cache_get_data(rows, fields);
    new temp[64];
    new bal;
    cache_get_field_content(1, "balance", temp);
    bal = strval(temp);
    return bal;
}


CMD:getbalance(playerid, params[])
{
    new num, balance;
    if(sscanf(params, "d", num)) return SendClientMessage(playerid, -1, "> /getbalance accountnumber");
   
    balance = BankAccBal(num);
   
    format(msgstring, sizeof(msgstring), "Bank account %d has %d dollars in it.", num, balance);
    SendClientMessage(playerid, -1, msgstring);
   
    return 1;
}
It always says: Bank account numberhere has 1 dollars in it. It always say 1 dollar, so not sure what i'm doing wrong.
Reply


Messages In This Thread
Mysql Threaded Question - by Abreezy - 17.06.2013, 23:56
Re: Mysql Threaded Question - by Enforcer501 - 18.06.2013, 00:01
Re: Mysql Threaded Question - by Abreezy - 18.06.2013, 02:47
Re: Mysql Threaded Question - by Abreezy - 18.06.2013, 16:27
Re: Mysql Threaded Question - by Vince - 18.06.2013, 17:34
Re: Mysql Threaded Question - by Abreezy - 18.06.2013, 18:45

Forum Jump:


Users browsing this thread: 1 Guest(s)