28.10.2010, 02:41
This is the whole transfer code:
But the problem is with this:
pawn Код:
if(dialogid == TRANSFER_1)
{
if(!strlen(inputtext)) return SendClientMessage(playerid, COLOR_RED, "Error: You didn't enter a player name to transfer money to!");
new file2[50];
format(file2, sizeof(file2), BANK_FILE, inputtext);
if(!dini_Exists(file2)) return SendClientMessage(playerid, COLOR_RED, "Error: Invalid name; or the player does not have a bank account.");
SetPVarString(playerid, "transfer_name", inputtext);
ShowPlayerDialog(playerid, TRANSFER_2, DIALOG_STYLE_INPUT, "Advanced Bank - Transfer (Step 2)", "Insert the amount of money you would like to transfer:", "Submit", "Cancel");
}
if(dialogid == TRANSFER_2)
{
if(!strlen(inputtext))
{
SendClientMessage(playerid, COLOR_RED, "Error: You didn't enter an amount to send to the player.");
SetPVarString(playerid, "transfer_name", " ");
ShowPlayerBankDialog(playerid);
return 1;
}
if(strval(inputtext) > dini_Int(file, "Balance"))
{
SendClientMessage(playerid, COLOR_RED, "Error: You're trying to transfer more money than you have!");
SetPVarString(playerid, "transfer_name", " ");
ShowPlayerBankDialog(playerid);
ShowPlayerBankDialog(playerid);
return 1;
}
new file2[50], string2[MAX_PLAYER_NAME],N[MAX_PLAYERS],sname[MAX_PLAYER_NAME],player;
GetPVarString(playerid, "transfer_name", string2, sizeof(string2));
format(file2, sizeof(file2), BANK_FILE, string2);
dini_IntSet(file, "Balance", dini_Int(file, "Balance")-strval(inputtext));
dini_IntSet(file2, "Balance", dini_Int(file2, "Balance")+strval(inputtext));
format(string, sizeof(string), "Success: You have transfered $%d to %s's account.", strval(inputtext), string2, player);
SendClientMessage(playerid, COLOR_GREEN, string);
{
GetPlayerName(player, sname, sizeof(sname));
format(string, sizeof(string), "$%d has been wired to your account by %s.",strval(inputtext),sname,playerid);
}SendClientMessage(player,0xFFD7C4FF,string);
SetPVarString(playerid, "transfer_name", " ");
ShowPlayerBankDialog(playerid);
pawn Код:
new file2[50], string2[MAX_PLAYER_NAME],N[MAX_PLAYERS],sname[MAX_PLAYER_NAME],player;
GetPVarString(playerid, "transfer_name", string2, sizeof(string2));
format(file2, sizeof(file2), BANK_FILE, string2);
dini_IntSet(file, "Balance", dini_Int(file, "Balance")-strval(inputtext));
dini_IntSet(file2, "Balance", dini_Int(file2, "Balance")+strval(inputtext));
format(string, sizeof(string), "Success: You have transfered $%d to %s's account.", strval(inputtext), string2);
SendClientMessage(playerid, COLOR_GREEN, string);
{
GetPlayerName(player, sname, sizeof(sname));
format(string, sizeof(string), "$%d has been wired to your account by %s.",strval(inputtext),sname);
}SendClientMessage(player,0xFFD7C4FF,string);
SetPVarString(playerid, "transfer_name", " ");
ShowPlayerBankDialog(playerid);