pawn Код:
#define DBANKQ 2064
#define DBANKW 2065
#define DBANKD 2066
pawn Код:
if (dialogid == DBANKQ)
{
if (response == 1) // Withdraw
{
format(string, sizeof(string), "You have $%d in your account, and $%d in your wallet.\n\nHow much do you want to withdraw from your bank account:", PlayerInfo[playerid][pAccount],GetPlayerMoney(playerid));
ShowPlayerDialog(playerid,DBANKW,DIALOG_STYLE_INPUT,"Q:RP - Bank Question",string,"Ok","Cancel");
}
else // Deposit
{
format(string, sizeof(string), "You have $%d in your account, and $%d in your wallet.\n\nHow much do you want to deposit into your bank account:", PlayerInfo[playerid][pAccount],GetPlayerMoney(playerid));
ShowPlayerDialog(playerid,DBANKD,DIALOG_STYLE_INPUT,"Q:RP - Bank Question",string,"Ok","Cancel");
}
}
if (dialogid == DBANKD) // BANK / DEPOSIT
{
if (response == 1) // OK
{
if(IsNull(inputtext))
{
format(string, sizeof(string), "You have $%d in your account, and $%d in your wallet.\n\nHow much do you want to deposit into your bank account:", PlayerInfo[playerid][pAccount],GetPlayerMoney(playerid));
ShowPlayerDialog(playerid,DBANKD,DIALOG_STYLE_INPUT,"Q:RP - Bank Question",string,"Ok","Cancel");
return 1;
}
if (strval(inputtext) > GetPlayerMoney(playerid) || strval(inputtext) < 1)
{
format(string, sizeof(string), "You have $%d in your account, and $%d in your wallet.\n\nHow much do you want to deposit into your bank account:", PlayerInfo[playerid][pAccount],GetPlayerMoney(playerid));
ShowPlayerDialog(playerid,DBANKD,DIALOG_STYLE_INPUT,"Q:RP - Bank Question",string,"Ok","Cancel");
return 1;
}
SafeGivePlayerMoney(playerid, (0 - strval(inputtext)));
PlayerInfo[playerid][pCash] -= strval(inputtext);
PlayerInfo[playerid][pAccount]=strval(inputtext)+PlayerInfo[playerid][pAccount];
}
else // CANCEL
{
}
return 1;
}
if (dialogid == DBANKW) // WITHDRAW
{
if (response == 1) // OK
{
if(IsNull(inputtext))
{
format(string, sizeof(string), "You have $%d in your account, and $%d in your wallet.\n\nHow much do you want to withdraw from your bank account:", PlayerInfo[playerid][pAccount],GetPlayerMoney(playerid));
ShowPlayerDialog(playerid,DBANKW,DIALOG_STYLE_INPUT,"Q:RP - Bank Question",string,"Ok","Cancel");
return 1;
}
if (strval(inputtext) > PlayerInfo[playerid][pAccount] || strval(inputtext) < 1)
{
format(string, sizeof(string), "You have $%d in your account, and $%d in your wallet.\n\nHow much do you want to withdraw from your bank account:", PlayerInfo[playerid][pAccount],GetPlayerMoney(playerid));
ShowPlayerDialog(playerid,DBANKW,DIALOG_STYLE_INPUT,"Q:RP - Bank Question",string,"Ok","Cancel");
return 1;
}
SafeGivePlayerMoney(playerid,strval(inputtext));
PlayerInfo[playerid][pCash] += strval(inputtext);
PlayerInfo[playerid][pAccount]=PlayerInfo[playerid][pAccount]-strval(inputtext);
}
else // CANCEL
{
}
return 1;
}
pawn Код:
if(strcmp(cmd, "/withdraw", true) == 0)
{
if(IsPlayerConnected(playerid))
{
if(IsPlayerInRangeOfPoint(playerid, 50, -2158.8682,643.0779,1052.3750))
{
format(string, sizeof(string), "You have $%d in your account, and $%d in your wallet.\n\nHow much do you want to withdraw from your bank account:", PlayerInfo[playerid][pAccount],GetPlayerMoney(playerid));
ShowPlayerDialog(playerid,DBANKW,DIALOG_STYLE_INPUT,"Q:RP - Bank Question",string,"Ok","Cancel");
return 1;
}
else
{
SendClientMessage(playerid, COLOR_GREY, " You are not at the Bank !");
return 1;
}
}
return 1;
}
if(strcmp(cmd, "/bank", true) == 0 || strcmp(cmd, "/deposit", true) == 0)
{
if(IsPlayerConnected(playerid))
{
if(!IsPlayerInRangeOfPoint(playerid, 50, -2158.8682,643.0779,1052.3750))
{
SendClientMessage(playerid, COLOR_GREY, " You are not at the Bank !");
return 1;
}
format(string, sizeof(string), "You have $%d in your account, and $%d in your wallet.\n\nHow much do you want to deposit into your bank account:", PlayerInfo[playerid][pAccount],GetPlayerMoney(playerid));
ShowPlayerDialog(playerid,DBANKD,DIALOG_STYLE_INPUT,"Q:RP - Bank Question",string,"Ok","Cancel");
return 1;
}
return 1;
}