dialog messed?
#1

Well when i open from something after i enter the CP and click someone on the dialog nothing pops out
pawn Код:
{
        if(response)
        {
            if(listitem == 0)
            {
                if(PlayerData[playerid][Bank] < 0)
                {
                    format(str,sizeof(str),"Choose the amount you want to withdraw from your bank account\nYou have {FF0000}$%d {FFFFFF}in your bank account",PlayerData[playerid][Bank]);
                    ShowPlayerDialog(playerid,13,DIALOG_STYLE_INPUT,"Withdraw",str,"Withdraw","Back");
                }
                if(PlayerData[playerid][Bank] > 0)
                {
                    format(str,sizeof(str),"Choose the amount you want to withdraw from your bank account\nYou have {2BD600}$%d {FFFFFF}in your bank account",PlayerData[playerid][Bank]);
                    ShowPlayerDialog(playerid,13,DIALOG_STYLE_INPUT,"Withdraw",str,"Withdraw","Back");
                }
            }
            if(listitem == 1)
            {
                if(PlayerData[playerid][Bank] < 0)
                {
                    format(str,sizeof(str),"Choose the amount you want to deposit to your bank account\nYou have {FF0000}$%d {FFFFFF}in your bank account",PlayerData[playerid][Bank]);
                    ShowPlayerDialog(playerid,14,DIALOG_STYLE_INPUT,"Deposit",str,"Deposit","Back");
                }
                if(PlayerData[playerid][Bank] > 0)
                {
                    format(str,sizeof(str),"Choose the amount you want to deposit to your bank account\nYou have {2BD600}$%d {FFFFFF}in your bank account",PlayerData[playerid][Bank]);
                    ShowPlayerDialog(playerid,14,DIALOG_STYLE_INPUT,"Deposit",str,"Deposit","Back");
                }
            }
            if(listitem == 2)
            {
                if(PlayerData[playerid][Bank] < 0)
                {
                    format(str,sizeof(str),"Your balance in your bank account is {FF0000}$%d",PlayerData[playerid][Bank]);
                    SendClientMessage(playerid,Niceyellow,str);
                    ShowPlayerDialog(playerid,12,DIALOG_STYLE_LIST,"Bank","Withdraw\nDeposit\nBalance\nTransfer","Open","Close");
                }
                if(PlayerData[playerid][Bank] > 0)
                {
                    format(str,sizeof(str),"Your balance in your bank account is {2BD600}$%d",PlayerData[playerid][Bank]);
                    SendClientMessage(playerid,Niceyellow,str);
                    ShowPlayerDialog(playerid,12,DIALOG_STYLE_LIST,"Bank","Withdraw\nDeposit\nBalance\nTransfer","Open","Close");
                }
            }
            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_INPUT,"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_INPUT,"Transfer",str,"Transfer","Back");
                }
            }
        }
        return 1;
    }
    if(dialogid == 13)
    {
        if(response)
        {
            if(strval(inputtext)>0)
            {
                if(PlayerData[playerid][Bank] < strval(inputtext)) return SendClientMessage(playerid,red, "ERROR: You don't have that much money in your bank account");
                GivePlayerMoney(playerid,strval(inputtext));
                PlayerData[playerid][Bank]-=strval(inputtext);
                format(str,sizeof(str),"You have withdrawed {2BD600}$%d {FFFFFF}from your bank account",inputtext);
                SendClientMessage(playerid,Niceyellow,str);
                format(str,sizeof(str),"Your new bank balance is {2BD600}$%d",PlayerData[playerid][Bank]);
                SendClientMessage(playerid,Niceyellow,str);
                ShowPlayerDialog(playerid,12,DIALOG_STYLE_LIST,"Bank","Withdraw\nDeposit\nBalance\nTransfer","Open","Close");
            }
            else return SendClientMessage(playerid,red,"ERROR: You cannot withdraw negative numbers");
        }
        if(!response)
        {
            ShowPlayerDialog(playerid,12,DIALOG_STYLE_LIST,"Bank","Withdraw\nDeposit\nBalance\nTransfer","Open","Close");
        }
        return 1;
    }
    if(dialogid == 14)
    {
        if(response)
        {
            if(strval(inputtext)>0)
            {
                if(GetPlayerMoney(playerid) < strval(inputtext))  return SendClientMessage(playerid,red,"ERROR: You don't have that much money in your wallet");
                GivePlayerMoney(playerid,-strval(inputtext));
                PlayerData[playerid][Bank]+=strval(inputtext);
                format(str,sizeof(str),"You have deposited {2BD600}$%d {FFFFFF}in your bank account",inputtext);
                SendClientMessage(playerid,Niceyellow,str);
                ShowPlayerDialog(playerid,12,DIALOG_STYLE_LIST,"Bank","Withdraw\nDeposit\nBalance\nTransfer","Open","Close");
                if(PlayerData[playerid][Bank] < 0)
                {
                    format(str,sizeof(str),"Your new bank balance is {FF0000}$%d",PlayerData[playerid][Bank]);
                    SendClientMessage(playerid,Niceyellow,str);
                }
                if(PlayerData[playerid][Bank] > 0)
                {
                    format(str,sizeof(str),"Your new bank balance is {2BD600}$%d",PlayerData[playerid][Bank]);
                    SendClientMessage(playerid,Niceyellow,str);
                }
            }
            else return SendClientMessage(playerid,red,"ERROR: You cannot withdraw negative numbers");
        }
        if(!response)
        {
            ShowPlayerDialog(playerid,12,DIALOG_STYLE_LIST,"Bank","Withdraw\nDeposit\nBalance\nTransfer","Open","Close");
        }
        return 1;
    }
    if(dialogid == 15)
    {
        if(response)
        {
            if(strval(inputtext)>0)
            {
                CheckMySQL();
                GetPlayerName(sellerid,Nam,sizeof(Nam));
                mysql_real_escape_string(Nam,escapename);
                format(str,sizeof(str),"SELECT * FROM accounts WHERE Name = %s",Nam);
                mysql_query(str);
                mysql_store_result();
                if(mysql_num_rows() != 0)
                {
                    ShowPlayerDialog(playerid,16,DIALOG_STYLE_INPUT,"Transfer","Enter the amount you want to give your cash to","Send","Back");
                }
                else
                {
                    ShowPlayerDialog(playerid,12,DIALOG_STYLE_LIST,"Bank","Withdraw\nDeposit\nBalance\nTransfer","Open","Close");
                    SendClientMessage(playerid,red,"ERROR: That username is not registered.");
                }
            }
            else return SendClientMessage(playerid,red,"ERROR: You cannot give negative numbers to others");
        }
        if(!response)
        {
            ShowPlayerDialog(playerid,12,DIALOG_STYLE_LIST,"Bank","Withdraw\nDeposit\nBalance\nTransfer","Open","Close");
        }
        return 1;
    }
    if(dialogid == 16)
    {
        if(response)
        {
            if(strval(inputtext)>0)
            {
                if(PlayerData[playerid][Bank] < strval(inputtext)) return SendClientMessage(playerid,red,"ERROR: You don't have that much money in your bank account");
                CheckMySQL();
                GetPlayerName(sellerid,Nam,sizeof(Nam));
                mysql_real_escape_string(Nam,escapename);
                format(str,sizeof(str),"SELECT Bank FROM accounts WHERE Name = %s",Nam);
                mysql_query(str);
                mysql_store_result();
                if(mysql_num_rows() != 0)
                {
                    mysql_free_result();
                    format(query,sizeof(query),"UPDATE accounts SET Bank = Bank + %d WHERE Name = '%s'",inputtext,Nam);
                    mysql_query(query);
                    format(str,sizeof(str),"You have transfer %d from your money to %s account",inputtext,Nam);
                    SendClientMessage(playerid,Niceyellow,str);
                    ShowPlayerDialog(playerid,12,DIALOG_STYLE_LIST,"Bank","Withdraw\nDeposit\nBalance\nTransfer","Open","Close");
                }
                else
                {
                    ShowPlayerDialog(playerid,12,DIALOG_STYLE_LIST,"Bank","Withdraw\nDeposit\nBalance\nTransfer","Open","Close");
                    SendClientMessage(playerid,red,"ERROR: That username is not registered.");
                }
            }
            else return SendClientMessage(playerid,red,"ERROR: You cannot send negative numbers");
        }
        if(!response)
        {
            ShowPlayerDialog(playerid,12,DIALOG_STYLE_LIST,"Bank","Withdraw\nDeposit\nBalance\nTransfer","Open","Close");
        }
        return 1;
    }
Reply
#2

Is this in a GM or a FS?
Reply
#3

Gamemode
Reply
#4

Does OnDialogResponse return 1 or 0?
Reply
#5

return 0; in the end
Reply
#6

In a gamemode you have to return 1 in that callback, change it to 1 and try again
Reply
#7

i did but the dialog wont open
Reply
#8

Are you sure the dialogid's you are using are not used already?
Reply
#9

pawn Код:
if(dialogid == 12)
    {
        if(response)
        {
            if(listitem == 0)
            {
                if(PlayerData[playerid][Bank] < 0)
                {
                    format(str,sizeof(str),"Choose the amount you want to withdraw from your bank account\nYou have {FF0000}$%d {FFFFFF}in your bank account",PlayerData[playerid][Bank]);
                    ShowPlayerDialog(playerid,13,DIALOG_STYLE_INPUT,"Withdraw",str,"Withdraw","Back");
                }
                if(PlayerData[playerid][Bank] > 0)
                {
                    format(str,sizeof(str),"Choose the amount you want to withdraw from your bank account\nYou have {2BD600}$%d {FFFFFF}in your bank account",PlayerData[playerid][Bank]);
                    ShowPlayerDialog(playerid,13,DIALOG_STYLE_INPUT,"Withdraw",str,"Withdraw","Back");
                }
            }
            if(listitem == 1)
            {
                if(PlayerData[playerid][Bank] < 0)
                {
                    format(str,sizeof(str),"Choose the amount you want to deposit to your bank account\nYou have {FF0000}$%d {FFFFFF}in your bank account",PlayerData[playerid][Bank]);
                    ShowPlayerDialog(playerid,14,DIALOG_STYLE_INPUT,"Deposit",str,"Deposit","Back");
                }
                if(PlayerData[playerid][Bank] > 0)
                {
                    format(str,sizeof(str),"Choose the amount you want to deposit to your bank account\nYou have {2BD600}$%d {FFFFFF}in your bank account",PlayerData[playerid][Bank]);
                    ShowPlayerDialog(playerid,14,DIALOG_STYLE_INPUT,"Deposit",str,"Deposit","Back");
                }
            }
            if(listitem == 2)
            {
                if(PlayerData[playerid][Bank] < 0)
                {
                    format(str,sizeof(str),"Your balance in your bank account is {FF0000}$%d",PlayerData[playerid][Bank]);
                    SendClientMessage(playerid,Niceyellow,str);
                    ShowPlayerDialog(playerid,12,DIALOG_STYLE_LIST,"Bank","Withdraw\nDeposit\nBalance\nTransfer","Open","Close");
                }
                if(PlayerData[playerid][Bank] > 0)
                {
                    format(str,sizeof(str),"Your balance in your bank account is {2BD600}$%d",PlayerData[playerid][Bank]);
                    SendClientMessage(playerid,Niceyellow,str);
                    ShowPlayerDialog(playerid,12,DIALOG_STYLE_LIST,"Bank","Withdraw\nDeposit\nBalance\nTransfer","Open","Close");
                }
            }
            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_INPUT,"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_INPUT,"Transfer",str,"Transfer","Back");
                }
            }
        }
        return 1;
    }
Thats the code for the checkpoint dialog
Reply
#10

I suggest you to keep the Banking system simple with Command's. Too much dialog's always interfere with each other. So why dont you make some Pickup's! Thats all. and use IsPlayerInRangeOfPoint to detect they are there or not and execute the CMD.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)