SA-MP Forums Archive
Converting this into commands? - Printable Version

+- SA-MP Forums Archive (https://sampforum.blast.hk)
+-- Forum: SA-MP Scripting and Plugins (https://sampforum.blast.hk/forumdisplay.php?fid=8)
+--- Forum: Scripting Help (https://sampforum.blast.hk/forumdisplay.php?fid=12)
+--- Thread: Converting this into commands? (/showthread.php?tid=307730)



Converting this into commands? - PlayHard - 31.12.2011

Hello,

I wonder if you can convert this into commands,

pawn Код:
switch( dialogid ) // this will 'switch' through the dialogids, you can use if() aswell, but if im right its faster with switch()
    {
        case DIALOG_BANKHOME: // when the dialog is DIALOG_BANKHOME (5)
        {
            if( response )
            {
                switch( listitem )
                {
                    case 0: // when you selected the first listitem ('Wealth check') and press the first button
                    {
                        new Wealth[128];
                        format( Wealth, sizeof Wealth, "You have $%i on your bank account. ", PlayerInfo[playerid][BankWealth] ); // this will get the amount of money that is in your bank account
                        SendClientMessage(playerid, COLOR_YELLOW, Wealth); // this will send the message.. hm how is that possible o.O
                        ShowPlayerDialog( playerid, DIALOG_BANKHOME, DIALOG_STYLE_LIST, "Bank home", "Wealth check \nWithdraw money \nDeposit money", "Ok", "Leave" ); // Showing the dialog again, so you dotn have to do /bankhome again
                        return 0;
                    }
                    case 1: // when you selected the listitem 'Withdraw money' and press the first button
                    {
                        ShowPlayerDialog( playerid, DIALOG_BANKWITHDRAW, DIALOG_STYLE_INPUT, "Bank Withdraw", "Please enter the amount of money you want to withdraw. ", "Ok", "Back" ); // showing a new dialog
                    }
                    case 2: // when you selected the listitem 'Deposit money' and press the first button
                    {
                        ShowPlayerDialog( playerid, DIALOG_BANKDEPOSIT, DIALOG_STYLE_INPUT, "Bank Deposit", "Please enter the amoutn of money you want to deposit. ", "Ok", "Back" ); // showing a new dialog
                    }
                }
            }

        }
        case DIALOG_BANKWITHDRAW: // when the dialog is DIALOG_BANKWITHDRAW (6)
        {
            if( response )
            {
                if( !isnumeric( inputtext ) ) return SendClientMessage(playerid, COLOR_RED, "Numbers only! "); // this will check if the inputtext contains numbers
                if( strval( inputtext ) > PlayerInfo[playerid][BankWealth] ) return SendClientMessage( playerid, COLOR_RED, "You dont have that amount of money on your bank! " ), ShowPlayerDialog( playerid, DIALOG_BANKWITHDRAW, DIALOG_STYLE_INPUT, "Bank Withdraw", "Please enter the amount of money you want to withdraw.", "Ok", "Back" ); // if the inputtext is higher then you have on your bank, it will show an error message
                PlayerInfo[playerid][BankWealth] = ( PlayerInfo[playerid][BankWealth] - strval( inputtext ) ); // this will remove the money from your bank account
                GivePlayerMoney( playerid, strval( inputtext ) ); // this will add the money from the bank account to your own money
                new String[128];
                format( String, sizeof String, "You withdrew $%i from your bank, and now got $%i on your bank left. ", strval( inputtext ), PlayerInfo[playerid][BankWealth] ); // formatting amessage which shows the amount you withdrew, and the money you have left
                SendClientMessage( playerid, COLOR_YELLOW, String ); // sending the message
                ShowPlayerDialog( playerid, DIALOG_BANKHOME, DIALOG_STYLE_LIST, "Bank home", "Wealth check \nWithdraw money \nDeposit money", "Ok", "Leave" ); // showing the dialog again, so you dont have to do /bankhome
            }
            else if( !response )
            {
                ShowPlayerDialog( playerid, DIALOG_BANKHOME, DIALOG_STYLE_LIST, "Bank home", "Wealth check \nWithdraw money \nDeposit money", "Ok", "Leave" ); // when you press the button 'Back', it will go to /bankhome
            }
        }
        case DIALOG_BANKDEPOSIT: // when the dialog is DIALOG_BANKDEPOSIT (7)
        {
            if( response )
            {
                if( !isnumeric( inputtext ) ) return SendClientMessage(playerid, COLOR_RED, "Numbers only! "); // this will check if the inputtext contains numbers

                if( GetPlayerMoney( playerid ) < strval( inputtext ) ) return SendClientMessage( playerid, COLOR_RED, "You dont have that amount of money on you. "), ShowPlayerDialog( playerid, DIALOG_BANKDEPOSIT, DIALOG_STYLE_INPUT, "Bank Deposit", "Please enter the amoutn of money you want to deposit. ", "Ok", "Back" ); // if your money is lower as the amount you entered, it will give you an error message and show the same dialog
                PlayerInfo[playerid][BankWealth] = ( PlayerInfo[playerid][BankWealth] + strval( inputtext ) ); // adding the amount of money to your bank account
                GivePlayerMoney( playerid, - strval( inputtext) ); // removing the money from 'pocket'
                new String[128];
                format( String, sizeof String, "You depositted $%i to your bank, and now got $%i on your bank. ", strval( inputtext ), PlayerInfo[playerid][BankWealth] ); // formatting the message which howmutch you depositted, and the amount you now got on your bank
                SendClientMessage( playerid, COLOR_YELLOW, String ); // sending the message
                ShowPlayerDialog( playerid, DIALOG_BANKHOME, DIALOG_STYLE_LIST, "Bank home", "Wealth check \nWithdraw money \nDeposit money", "Ok", "Leave" ); // showing /bankhome dialog again
            }
            else if( !response )
            {
                ShowPlayerDialog( playerid, DIALOG_BANKHOME, DIALOG_STYLE_LIST, "Bank home", "Wealth check \nWithdraw money \nDeposit money", "Ok", "Leave" ); // when you press the button 'Back', it will go to /bankhome
            }
        }
    }
*NOTE: I am trying to do that at the moment.


Re: Converting this into commands? - PlayHard - 31.12.2011

EDIT: Converted but I have the " inputtext " problem, I don't know what to replace it with.

pawn Код:
YCMD:deposit(playerid, params[])
{
    if( !isnumeric( inputtext ) ) return SendClientMessage(playerid, COLOR_RED, "Numbers only! "); // this will check if the inputtext contains numbers
    if( GetPlayerMoney( playerid ) < strval( inputtext ) ) return SendClientMessage( playerid, COLOR_RED, "You dont have that amount of money on you. "), ShowPlayerDialog( playerid, DIALOG_BANKDEPOSIT, DIALOG_STYLE_INPUT, "Bank Deposit", "Please enter the amoutn of money you want to deposit. ", "Ok", "Back" ); // if your money is lower as the amount you entered, it will give you an error message and show the same dialog
    PlayerInfo[playerid][BankWealth] = ( PlayerInfo[playerid][BankWealth] + strval( inputtext ) ); // adding the amount of money to your bank account
    GivePlayerMoney( playerid, - strval( inputtext) ); // removing the money from 'pocket'
    new String[128];
    format( String, sizeof String, "You depositted $%i to your bank, and now got $%i on your bank. ", strval( inputtext ), PlayerInfo[playerid][BankWealth] ); // formatting the message which howmutch you depositted, and the amount you now got on your bank
    SendClientMessage( playerid, COLOR_YELLOW, String ); // sending the message
    return 1;
}
YCMD:withdraw(playerid, params[])
{
    if( !isnumeric( inputtext ) ) return SendClientMessage(playerid, COLOR_RED, "Numbers only! "); // this will check if the inputtext contains numbers
    if( strval( inputtext ) > PlayerInfo[playerid][BankWealth] ) return SendClientMessage( playerid, COLOR_RED, "You dont have that amount of money on your bank! " ), ShowPlayerDialog( playerid, DIALOG_BANKWITHDRAW, DIALOG_STYLE_INPUT, "Bank Withdraw", "Please enter the amount of money you want to withdraw.", "Ok", "Back" ); // if the inputtext is higher then you have on your bank, it will show an error message
    PlayerInfo[playerid][BankWealth] = ( PlayerInfo[playerid][BankWealth] - strval( inputtext ) ); // this will remove the money from your bank account
    GivePlayerMoney( playerid, strval( inputtext ) ); // this will add the money from the bank account to your own money
    new String[128];
    format( String, sizeof String, "You withdrew $%i from your bank, and now got $%i on your bank left. ", strval( inputtext ), PlayerInfo[playerid][BankWealth] ); // formatting amessage which shows the amount you withdrew, and the money you have left
    SendClientMessage( playerid, COLOR_YELLOW, String ); // sending the message
    return 1;
}

pawn Код:
C:\Documents and Settings\Administrator\My Documents\Downloads\samp03dsvr_R2_win32\gamemodes\bc.pwn(1960) : error 017: undefined symbol "inputtext"
C:\Documents and Settings\Administrator\My Documents\Downloads\samp03dsvr_R2_win32\gamemodes\bc.pwn(1961) : error 017: undefined symbol "inputtext"
C:\Documents and Settings\Administrator\My Documents\Downloads\samp03dsvr_R2_win32\gamemodes\bc.pwn(1962) : error 017: undefined symbol "inputtext"
C:\Documents and Settings\Administrator\My Documents\Downloads\samp03dsvr_R2_win32\gamemodes\bc.pwn(1963) : error 017: undefined symbol "inputtext"
C:\Documents and Settings\Administrator\My Documents\Downloads\samp03dsvr_R2_win32\gamemodes\bc.pwn(1965) : error 017: undefined symbol "inputtext"
C:\Documents and Settings\Administrator\My Documents\Downloads\samp03dsvr_R2_win32\gamemodes\bc.pwn(1971) : error 017: undefined symbol "inputtext"
C:\Documents and Settings\Administrator\My Documents\Downloads\samp03dsvr_R2_win32\gamemodes\bc.pwn(1972) : error 017: undefined symbol "inputtext"
C:\Documents and Settings\Administrator\My Documents\Downloads\samp03dsvr_R2_win32\gamemodes\bc.pwn(1973) : error 017: undefined symbol "inputtext"
C:\Documents and Settings\Administrator\My Documents\Downloads\samp03dsvr_R2_win32\gamemodes\bc.pwn(1974) : error 017: undefined symbol "inputtext"
C:\Documents and Settings\Administrator\My Documents\Downloads\samp03dsvr_R2_win32\gamemodes\bc.pwn(1976) : error 017: undefined symbol "inputtext"
Pawn compiler 3.2.3664          Copyright (c) 1997-2006, ITB CompuPhase


10 Errors.



Re: Converting this into commands? - coole210 - 31.12.2011

Your replace inputtext with params.


Re: Converting this into commands? - PlayHard - 31.12.2011

Ops, yeah! Lol thank you ^^. Happy new year!