pawn Код:
public OnDialogResponse(playerid, dialogid, response, listitem, inputtext[])
{
new name[MAX_PLAYER_NAME], file[256];
GetPlayerName(playerid, name, sizeof(name));
format(file, sizeof(file), SERVER_USER_FILE, name);
if(dialogid == 4)
{
if(!response){
SetPlayerPos(playerid, 1958.3783, 1343.1572, 15.3746);
}
switch(listitem)
{
case 0:
{
ShowPlayerDialog(playerid,5,DIALOG_STYLE_INPUT,"Deposit","Enter the amount below:","deposit","Cancel");
}
case 1:
{
ShowPlayerDialog(playerid,6,DIALOG_STYLE_INPUT,"Withdraw","Enter the amount below:","withdraw","Cancel");
}
case 2:
{
new string[128];
format(string, sizeof(string), "You have on you bank account %d money", PlayerInfo[playerid][BankMoney]);
SendClientMessage(playerid, COLOUR_YELLOW, string);
}
}
}
if(dialogid == 5)
{
new string[128];
new playermoney = GetPlayerMoney(playerid);
new money = strval(inputtext);
new cash = (PlayerInfo[playerid][BankMoney] + money);
if(!response)
{
SetPlayerPos(playerid, 1958.3783, 1343.1572, 15.3746);
}
if(strlen(inputtext) > 0)
{
if(playermoney >= money)
{
GivePlayerMoney(playerid, -money);
format(string, sizeof(string), "You deposited %d cash in your bank account. now you have %d in you bank account", money, cash);
SendClientMessage(playerid, COLOUR_YELLOW, string);
dini_Create(file);
dini_IntSet(file, "Bank Money",cash);
PlayerInfo[playerid][BankMoney] += money;
return 1;
}
else
{
SendClientMessage(playerid, COLOUR_RED, "You do not have this amount of money!!!");
return 1;
}
}
else
{
SendClientMessage(playerid, COLOUR_RED, "You did not type in any number!!!!!!");
}
}
if(dialogid == 6)
{
new string[128];
new playermoney = GetPlayerMoney(playerid);
new money = strval(inputtext);
new cash = (PlayerInfo[playerid][BankMoney] - money);
if(!response)
{
SetPlayerPos(playerid, 1958.3783, 1343.1572, 15.3746);
}
if(strlen(inputtext) > 0)
{
if(PlayerInfo[playerid][BankMoney] >= money)
{
dini_IntSet(file, "BankMoney",cash);
GivePlayerMoney(playerid, money);
format(string, sizeof(string), "You withdraw %d from your bank account. now you have %d in you bank account", money, cash);
SendClientMessage(playerid, COLOUR_GREEN, string);
PlayerInfo[playerid][BankMoney] -= money;
return 1;
}
else
{
SendClientMessage(playerid, COLOUR_RED, "You do not have this amount of money on your bank account!!!");
return 1;
}
}
else
{
SendClientMessage(playerid, COLOUR_RED, "You did not type in any number!!!!");
}
}
return 1;
}
try this one out.... I didn't change much as I didn't find something which was really wrong... maybe it helps a bit...