#10

Quote:
Originally Posted by Sascha
Посмотреть сообщение
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...
thx, i will try this one... but what did you changed?
Reply


Messages In This Thread
bank - by omer5198 - 16.02.2011, 13:42
Re: bank - by Serbish - 16.02.2011, 14:26
Re: bank - by omer5198 - 16.02.2011, 15:21
Re: bank - by Serbish - 17.02.2011, 14:41
Re: bank - by 77ther - 17.02.2011, 14:42
Re: bank - by thimo - 17.02.2011, 14:48
Re: bank - by _Tommy - 17.02.2011, 14:48
Re: bank - by omer5198 - 17.02.2011, 17:37
Re: bank - by Sascha - 17.02.2011, 17:46
Re: bank - by omer5198 - 18.02.2011, 09:30

Forum Jump:


Users browsing this thread: 1 Guest(s)