#1

i am getting errors when adding these codes to on playerdialog response,
actually its a fs code and i want to add in my gm which has many co functions of ondialogue response
PHP код:
{
    switch( 
dialogid )
    {
        case 
DIALOG_BANK:
        {
            if(
response)
            {
                if(
listitem == 0)
                {
                    new 
str[128];
                    
format(str,sizeof(str),"Your Curret Balance Is : $%d\nEnter The Amount You Want To Deposit Below :",bankBalance[playerid]);
                      
ShowPlayerDialog(playeridDIALOG_DEPOSITDIALOG_STYLE_INPUT"Deposit",str"Deposit""Back");
                }
                if(
listitem == 1)
                {
                    new 
str[128];
                    
format(str,sizeof(str),"Your Curret Balance Is : $%d\nEnter The Amount You Want To Withdraw Below :",bankBalance[playerid]);
                      
ShowPlayerDialog(playeridDIALOG_WITHDRAWDIALOG_STYLE_INPUT"Withdraw",str"Withdraw""Back");
                }
                if(
listitem == 2)
                {
                    new 
str[128];
                    
format(str,sizeof(str),"Your Current Balance Is : $%d\nEnter The Player ID You Want To Transfer To Below :",bankBalance[playerid]);
                    
ShowPlayerDialog(playerid,DIALOG_TRANSFER1,DIALOG_STYLE_INPUT,"Transfer",str,"Next","Back");
                }
                if(
listitem == 3)
                {
                    new 
str[128];
                    
format(strsizeof(str), "Your current bank balance is: $%d"bankBalance[playerid]);
                    
ShowPlayerDialog(playeridDIALOG_BALANCEDIALOG_STYLE_MSGBOX"Bank account"str"Back""");
                }
            }
        }
  case 
DIALOG_DEPOSIT:
        {
            if(!
response) return ShowPlayerDialog(playeridDIALOG_BANKDIALOG_STYLE_LIST"{007A00}Bank account"" Deposit \n Withdraw \n Balance""Select""Cancel");
            else if(
strval(inputtext) > GetPlayerMoney(playerid)) return SendClientMessage(playerid,COLOR_RED,"You Don't Have That Amount!");
            else if(!
IsNumeric(inputtext))
            {
                new 
str[128];
                
format(str,sizeof(str),"Your Current Balance Is : $%d\nEnter The Amount You Want To Deposit Below :",bankBalance[playerid]);
                   
ShowPlayerDialog(playeridDIALOG_DEPOSITDIALOG_STYLE_INPUT"Deposit",str"Deposit""Back");
                
SendClientMessage(playerid,COLOR_RED,"Please Use Numbers");
            }
            else
            {
                new 
str[128];
                
PInfo[playerid][Money]=PInfo[playerid][Money]-= strval(inputtext);
                
format(strsizeof(str), "You have deposited $%d into your account. New balance: $%d"inputtextbankBalance[playerid]);
                
SendClientMessage(playerid0x008000FFstr);
            }
        }
        case 
DIALOG_WITHDRAW:
        {
            if(!
response) return ShowPlayerDialog(playeridDIALOG_BANKDIALOG_STYLE_LIST"{007A00}Bank account"" Deposit \n Withdraw \n Balance""Select""Cancel");
            else if(
strval(inputtext) > bankBalance[playerid]) return SendClientMessage(playerid,COLOR_RED,"You Don't Have That Amount in your bank");
            else if(!
IsNumeric(inputtext))
            {
                new 
str[128];
                
format(str,sizeof(str),"Your Curret Balance Is : $%d\nEnter The Amount You Want To Withdraw Below :",bankBalance[playerid]);
                   
ShowPlayerDialog(playeridDIALOG_WITHDRAWDIALOG_STYLE_INPUT"Withdraw",str"Withdraw""Back");
                
SendClientMessage(playerid,COLOR_RED,"Please Use Numbers");
            }
            else
            {
                new 
str[128];
                new 
inputext strval(inputtext);
                new 
pCash[MAX_PLAYERS];
                
bankBalance[playerid] -= inputext;
                
PInfo[playerid][Money]=PInfo[playerid][Money]+= inputext;
                
format(strsizeof(str), "You have withdrawn $%d out of your account. New balance: $%d"inputextbankBalance[playerid]);
                
SendClientMessage(playerid0x008000FFstr);
            }
        }
        case 
DIALOG_TRANSFER1:
        {
            if(!
response) return ShowPlayerDialog(playeridDIALOG_BANKDIALOG_STYLE_LIST"{007A00}Bank account"" Deposit \n Withdraw \n Balance""Select""Cancel");
            else if(
strval(inputtext) == INVALID_PLAYER_ID) return SendClientMessage(playerid,COLOR_RED,"Player Not Online");
            else if(!
IsNumeric(inputtext))
            {
                new 
str[128];
                
format(str,sizeof(str),"Your Current Balance Is : $%d\nEnter The Player ID You Want To Transfer To Below :"bankBalance[playerid]);
                
ShowPlayerDialog(playerid,1130,DIALOG_STYLE_INPUT,"Transfer",str,"Next","Back");
                
SendClientMessage(playerid,COLOR_RED,"Please Use ID Not Name");
            }
            else
            {
                new 
chosenpid strval(inputtext);
                new 
str[128];
                
format(str,sizeof(str),"Balance : %d\nChosen Player ID : %d\nNow Enter The Amount You Want To Transfer",bankBalance[playerid],chosenpid);
                
ShowPlayerDialog(playerid,DIALOG_TRANSFER2,DIALOG_STYLE_INPUT,"Transfer",str,"Transfer","Back");
            }
        }
        case 
DIALOG_TRANSFER2:
        {
            new 
chosenpid strval(inputtext);
            if(!
response) return ShowPlayerDialog(playeridDIALOG_BANKDIALOG_STYLE_LIST"{007A00}Bank account"" Deposit \n Withdraw \n Balance""Select""Cancel");
            else if(
strval(inputtext) > bankBalance[playerid]) return SendClientMessage(playerid,COLOR_RED,"You Don't Have That Amount In Bank To Transfer");
            else if(!
IsNumeric(inputtext))
            {
                new 
str[128];
                
format(str,sizeof(str),"Chosen Player ID : %d\nNow Enter The Amount You Want To Transfer",chosenpid);
                
ShowPlayerDialog(playerid,1131,DIALOG_STYLE_INPUT,"Transfer",str,"Transfer","Back");
                
SendClientMessage(playerid,COLOR_RED,"Please Use Numbers");
            }
            else
            {
                new 
pCash[MAX_PLAYERS];
                
bankBalance[playerid] -= strval(inputtext);
                
pCash[chosenpid] += strval(inputtext);
                new 
str[128];
                
format(str,sizeof(str),"You Transfered $%d To ID %d's Bank Account",strval(inputtext),chosenpid);
                
SendClientMessage(playerid0x008000FFstr);
                new 
str2[128];
                
format(str2,128,"Your New Balance Is : $%d",bankBalance[playerid]);
                
SendClientMessage(playerid,0x008000FF,str2);
                new 
str3[128];
                
format(str3,128,"ID : %d Transfered $%d To Your Bank Account",playerid,strval(inputtext));
                
SendClientMessage(chosenpid,0x008000FF,str3);
                new 
str4[128];
                
format(str4128"Your New Balance : $%d",pCash[chosenpid]);
                
SendClientMessage(chosenpid0x008000FFstr4);
                
ShowPlayerDialog(playerid,1125,DIALOG_STYLE_LIST,"Bank","Deposit\nWithdraw\nBalance\nTransfer","Select","Cancel");
            }
        }
        case 
DIALOG_BALANCE:
        {
            if(
response)
            {
                
ShowPlayerDialog(playeridDIALOG_BANKDIALOG_STYLE_LIST"{007A00}Bank account"" Deposit \n Withdraw \n Balance""Select""Cancel");
            }
        }
    }
    return 
1;

Reply
#2

What are the errors you facing with , and show only lines that has the error.
Reply
#3

actually not error my pawno crashes
Reply
#4

Код:
 { 
    switch( dialogid ) 
    { 
        case DIALOG_BANK: 
        { 
            if(response) 
            { 
                if(listitem == 0) 
                { 
                    new str[128]; 
                    format(str,sizeof(str),"Your Curret Balance Is : $%d\nEnter The Amount You Want To Deposit Below :",bankBalance[playerid]); 
                      ShowPlayerDialog(playerid, DIALOG_DEPOSIT, DIALOG_STYLE_INPUT, "Deposit",str, "Deposit", "Back"); 
                } 
                if(listitem == 1) 
                { 
                    new str[128]; 
                    format(str,sizeof(str),"Your Curret Balance Is : $%d\nEnter The Amount You Want To Withdraw Below :",bankBalance[playerid]); 
                      ShowPlayerDialog(playerid, DIALOG_WITHDRAW, DIALOG_STYLE_INPUT, "Withdraw",str, "Withdraw", "Back"); 
                } 
                if(listitem == 2) 
                { 
                    new str[128]; 
                    format(str,sizeof(str),"Your Current Balance Is : $%d\nEnter The Player ID You Want To Transfer To Below :",bankBalance[playerid]); 
                    ShowPlayerDialog(playerid,DIALOG_TRANSFER1,DIALOG_STYLE_INPUT,"Transfer",str,"Next","Back"); 
                } 
                if(listitem == 3) 
                { 
                    new str[128]; 
                    format(str, sizeof(str), "Your current bank balance is: $%d", bankBalance[playerid]); 
                    ShowPlayerDialog(playerid, DIALOG_BALANCE, DIALOG_STYLE_MSGBOX, "Bank account", str, "Back", ""); 
                } 
            } 
        } 
  case DIALOG_DEPOSIT: 
        { 
            if(!response) return ShowPlayerDialog(playerid, DIALOG_BANK, DIALOG_STYLE_LIST, "{007A00}Bank account", " Deposit \n Withdraw \n Balance", "Select", "Cancel"); 
            else if(strval(inputtext) > GetPlayerMoney(playerid)) return SendClientMessage(playerid,COLOR_RED,"You Don't Have That Amount!"); 
            else if(!IsNumeric(inputtext)) 
            { 
                new str[128]; 
                format(str,sizeof(str),"Your Current Balance Is : $%d\nEnter The Amount You Want To Deposit Below :",bankBalance[playerid]); 
                   ShowPlayerDialog(playerid, DIALOG_DEPOSIT, DIALOG_STYLE_INPUT, "Deposit",str, "Deposit", "Back"); 
                SendClientMessage(playerid,COLOR_RED,"Please Use Numbers"); 
            } 
            else 
            { 
                new str[128]; 
                PInfo[playerid][Money]=PInfo[playerid][Money]-= strval(inputtext); 
                format(str, sizeof(str), "You have deposited $%d into your account. New balance: $%d", inputtext, bankBalance[playerid]); 
                SendClientMessage(playerid, 0x008000FF, str); 
            } 
        } 
        case DIALOG_WITHDRAW: 
        { 
            if(!response) return ShowPlayerDialog(playerid, DIALOG_BANK, DIALOG_STYLE_LIST, "{007A00}Bank account", " Deposit \n Withdraw \n Balance", "Select", "Cancel"); 
            else if(strval(inputtext) > bankBalance[playerid]) return SendClientMessage(playerid,COLOR_RED,"You Don't Have That Amount in your bank"); 
            else if(!IsNumeric(inputtext)) 
            { 
                new str[128]; 
                format(str,sizeof(str),"Your Curret Balance Is : $%d\nEnter The Amount You Want To Withdraw Below :",bankBalance[playerid]); 
                   ShowPlayerDialog(playerid, DIALOG_WITHDRAW, DIALOG_STYLE_INPUT, "Withdraw",str, "Withdraw", "Back"); 
                SendClientMessage(playerid,COLOR_RED,"Please Use Numbers"); 
            } 
            else 
            { 
                new str[128]; 
                new inputext = strval(inputtext); 
                new pCash[MAX_PLAYERS]; 
                bankBalance[playerid] -= inputext; 
                PInfo[playerid][Money]=PInfo[playerid][Money]+= inputext; 
                format(str, sizeof(str), "You have withdrawn $%d out of your account. New balance: $%d", inputext, bankBalance[playerid]); 
                SendClientMessage(playerid, 0x008000FF, str); 
            } 
        } 
        case DIALOG_TRANSFER1: 
        { 
            if(!response) return ShowPlayerDialog(playerid, DIALOG_BANK, DIALOG_STYLE_LIST, "{007A00}Bank account", " Deposit \n Withdraw \n Balance", "Select", "Cancel"); 
            else if(strval(inputtext) == INVALID_PLAYER_ID) return SendClientMessage(playerid,COLOR_RED,"Player Not Online"); 
            else if(!IsNumeric(inputtext)) 
            { 
                new str[128]; 
                format(str,sizeof(str),"Your Current Balance Is : $%d\nEnter The Player ID You Want To Transfer To Below :", bankBalance[playerid]); 
                ShowPlayerDialog(playerid,1130,DIALOG_STYLE_INPUT,"Transfer",str,"Next","Back"); 
                SendClientMessage(playerid,COLOR_RED,"Please Use ID Not Name"); 
            } 
            else 
            { 
                new chosenpid = strval(inputtext); 
                new str[128]; 
                format(str,sizeof(str),"Balance : %d\nChosen Player ID : %d\nNow Enter The Amount You Want To Transfer",bankBalance[playerid],chosenpid); 
                ShowPlayerDialog(playerid,DIALOG_TRANSFER2,DIALOG_STYLE_INPUT,"Transfer",str,"Transfer","Back"); 
            } 
        } 
        case DIALOG_TRANSFER2: 
        { 
            new chosenpid = strval(inputtext); 
            if(!response) return ShowPlayerDialog(playerid, DIALOG_BANK, DIALOG_STYLE_LIST, "{007A00}Bank account", " Deposit \n Withdraw \n Balance", "Select", "Cancel"); 
            else if(strval(inputtext) > bankBalance[playerid]) return SendClientMessage(playerid,COLOR_RED,"You Don't Have That Amount In Bank To Transfer"); 
            else if(!IsNumeric(inputtext)) 
            { 
                new str[128]; 
                format(str,sizeof(str),"Chosen Player ID : %d\nNow Enter The Amount You Want To Transfer",chosenpid); 
                ShowPlayerDialog(playerid,1131,DIALOG_STYLE_INPUT,"Transfer",str,"Transfer","Back"); 
                SendClientMessage(playerid,COLOR_RED,"Please Use Numbers"); 
            } 
            else 
            { 
                new pCash[MAX_PLAYERS]; 
                bankBalance[playerid] -= strval(inputtext); 
                pCash[chosenpid] += strval(inputtext); 
                new str[128]; 
                format(str,sizeof(str),"You Transfered $%d To ID %d's Bank Account",strval(inputtext),chosenpid); 
                SendClientMessage(playerid, 0x008000FF, str); 
                new str2[128]; 
                format(str2,128,"Your New Balance Is : $%d",bankBalance[playerid]); 
                SendClientMessage(playerid,0x008000FF,str2); 
                new str3[128]; 
                format(str3,128,"ID : %d Transfered $%d To Your Bank Account",playerid,strval(inputtext)); 
                SendClientMessage(chosenpid,0x008000FF,str3); 
                new str4[128]; 
                format(str4, 128, "Your New Balance : $%d",pCash[chosenpid]); 
                SendClientMessage(chosenpid, 0x008000FF, str4); 
                ShowPlayerDialog(playerid,1125,DIALOG_STYLE_LIST,"Bank","Deposit\nWithdraw\nBalance\nTransfer","Select","Cancel"); 
            } 
        } 
        case DIALOG_BALANCE: 
        { 
            if(response) 
            { 
                ShowPlayerDialog(playerid, DIALOG_BANK, DIALOG_STYLE_LIST, "{007A00}Bank account", " Deposit \n Withdraw \n Balance", "Select", "Cancel"); 

            } 
          }
          }
        } 

    } 
    return 1; 

}
Try now, you had some unclose brackets.
Reply
#5

Still it crashes
Reply
#6

Quote:
Originally Posted by Shaheen
Посмотреть сообщение
Still it crashes
the code you posted above has nothing to do with the crash i am compiling the code without crashing
Reply
#7

my current ondialogresponce contains many dialoges in it.
for ex:
PHP код:
public OnDialogResponse(playeriddialogidresponselistiteminputtext[])
{
    if(
dialogid == coupon2)
    {
        if(
response)
        {
            new 
query[450];
            
format(query,sizeof(query),"SELECT cUsed FROM coupons WHERE cID='%d' LIMIT 1"ClaimingCoupon[playerid]);
            
mysql_query(query);
            
mysql_store_result();
            new 
IsCouponUsed mysql_fetch_int();
            if(
mysql_num_rows() > && IsCouponUsed == 0//It exists and
            
{
                new 
coolname[MAX_PLAYER_NAME]; format(coolname,sizeof(coolname),"%s"PlayerName(playerid));
                
mysql_real_escape_string(coolname,coolname);
                
format(query,sizeof(query),"UPDATE coupons SET cUsed='1',cClaimer='%s' WHERE cID='%d' LIMIT 1"coolname,ClaimingCoupon[playerid]);
                
mysql_query(query);
                
PInfo[playerid][Money]=PInfo[playerid][Money]+ClaimingCouponReward[playerid];
                
GivePlayerMoney(playeridClaimingCouponReward[playerid]);
                
format(query,sizeof(query),"[Coupon ID %d] You have used the coupon code and have claimed a reward of $%d."ClaimingCoupon[playerid], ClaimingCouponReward[playerid]);
                
SendClientMessage(playeridCOLOR_ORANGEquery); //Orange Colour.
                
format(query,sizeof(query),"[Coupon] %s (%d) has claimed the [%s] coupon code and has won $%d!"PlayerName(playerid), playeridClaimingCouponName[playerid], ClaimingCouponReward[playerid]);
                
SendClientMessageToAll(COLOR_ORANGEquery);
                
PayLog(PlayerName(playerid), ClaimingCouponReward[playerid], "Claimed Coupon"PlayerName(playerid), "Server");
                
ClaimingCoupon[playerid] = 0ClaimingCouponReward[playerid] = 0;
                
mysql_free_result();
                return 
1;
            }
            else
            {
                
mysql_free_result();
                
SendClientMessage(playeridCOLOR_ERROR"An error occured while processing the coupon code.");
                return 
1;
            }
        }
    }
    if(
dialogid == coupon1)
    {
        if(
response)
        {
              if(!
strlen(inputtext))
               {
                
SendClientMessage(playeridCOLOR_ERROR"You must type a coupon code first!");
                return 
1;
            }
            if(
strlen(inputtext) >= 15)
            {
                
SendClientMessage(playeridCOLOR_ERROR"Coupon code is too long!");
                return 
1;
            }
            
mysql_real_escape_string(inputtext,inputtext);
            new 
query[500]; 
Reply
#8

I think you should do
switch(listitem)
then put the of your code
Reply
#9

Usually brackets crashes the pawno when there are less.
Reply
#10

Quote:
Originally Posted by Eoussama
Посмотреть сообщение
I think you should do
switch(listitem)
then put the of your code
could u give an example i am totally out with it
Reply


Forum Jump:


Users browsing this thread: 2 Guest(s)