How can i update another person bank account if they are online or offline? Well im making bank and for Transfer what do i use to transfer money to another account even if they are offline? I use MYSQL
pawn Код:
if(listitem == 3)
{
if(PlayerData[playerid][Bank] < 0)
{
format(str,sizeof(str),"You got {FF0000}$%d {FFFFFF}in your bank account\nEnter the name of the player you want to give your cash to",PlayerData[playerid][Bank]);
ShowPlayerDialog(playerid,15,DIALOG_STYLE_LIST,"Transfer",str,"Transfer","Back");
}
if(PlayerData[playerid][Bank] > 0)
{
format(str,sizeof(str),"You got {2BD600}$%d {FFFFFF}in your bank account\nEnter the name of the player you want to give your cash to",PlayerData[playerid][Bank]);
ShowPlayerDialog(playerid,15,DIALOG_STYLE_LIST,"Transfer",str,"Transfer","Back");
}
}
Код:
mysql_real_escape_string(inputtext,inputtext);
format(query,sizeof(query),"SELECT bankAccMoney FROM players WHERE username = '%s'",inputtext);
mysql_query(query);
mysql_store_result();
if(mysql_num_rows() == 0)
{
mysql_free_result();
//username doesn't exist, send error msg
}
else
{
mysql_free_result();
//username does exist..
format(query,sizeof(query),"UPDATE players SET bankAccMoney = bankAccMoney + moneyTransferred WHERE username = '%s'",inputtext);
mysql_query(query);
}