Error in a command
#1

Hello
I want to do a base for on dialog repsonse
so i did like that
______________________
Код:
if(dialogid ==  DIALOG_GANG)
{
    if(response)
        {


            if(listitem == 0)
            {


              //TEXT
              }
if(listitem == 1) 
            {
                //TEXT
            }
            if(listitem == 2) 
            {
                //TEXT
            }
                  if(listitem == 3) 
            {
              //TEXT
            }
            if(listitem == 4) 
            {
                //TEXT
            }
            if(listitem == 5) 
            {
                //TEXT
            }
         
   return 1;
   }
  }
     return 0;
}
Код:
ShowPlayerDialog(playerid, DIALOG_GANG, DIALOG_STYLE_LIST, "Gangs", "Grove\n/Ballas\nPenguins\nTrhoops\nBrains\nStreet Shit", "Select", "Close");
i did defined that dialog_gang
Код:
 warning 225: unreachable code
thats the error
thanks for helpers.
Reply
#2

Unreachable code means when you use return and the next line had some text that could be executed , Would you mind if you showed us full code of OnDialogResponse ? to fix your problem , also show us in which line you get this error.
Reply
#3

Quote:
Originally Posted by SilentSoul
Посмотреть сообщение
Unreachable code means when you use return and the next line had some text that could be executed , Would you mind if you showed us full code of OnDialogResponse ? to fix your problem , also show us in which line you get this error.
The error line is 790 - if(dialogid == DIALOG_GANG)
heres the dialog before that one
Код:
  if(dialogid == DIALOG_LOGIN)
  {
    if(!response) return SetTimerEx("IsKick" ,10 ,false ,"i" ,playerid),SendClientMessage(playerid,0xFF0000C8,".бзшъ мцаъ одщшъ");
    if(!strlen(inputtext)) return ShowPlayerDialog(playerid,DIALOG_LOGIN,DIALOG_STYLE_INPUT,"{00FF00}Login","{00FF00}шщен аъ сйсоък","дъзбшеъ","йцйад");
    if(strcmp(inputtext,DOF2_GetString(RFile(playerid),"Password"),true))
    {
	  if(LongPass[playerid] == true)
	  {
        LongPass[playerid] = false;
	    ShowPlayerDialog(playerid,DIALOG_LONG,DIALOG_STYLE_MSGBOX,"{FF0000}Eror Password:","{FF0000}.бвмм щитйъ 2 фтойн бсйсод зифъ чйч","айщеш","йцйад");
	    SetTimerEx("IsKick" ,10 ,false ,"i" ,playerid);
        return 1;
	  }
	  LongPass[playerid] = true;
	  format(String,sizeof(String),"{FF0000}дсйсоа щдчщъ айрд рлерд\n{FF0000}[%d/2] :рщаш мк тег осфш фтойн бщбйм мвмеъ аъ дсйсод",LongPass[playerid]);
	  ShowPlayerDialog(playerid,DIALOG_LOGIN,DIALOG_STYLE_INPUT,"{FF0000}Eror Password:",String,"дъзбшеъ","йцйад");
	  return 1;
    }
    SendClientMessage(playerid,-1,"{00FFFF}!дъзбшъ мщшъ бдцмзд");
	format(String,sizeof(String),"{00FFFF}дъзбш мщшъ бдцмзд %s дщзчп",GetName(playerid));
	SendClientMessage(playerid, -1 , String);
	Loged[playerid] = true;
  }
  return 1;

      if(dialogid ==  DIALOG_GANG)
    {
        if(response)
        {

            if(listitem == 0)
            {

			 SendClientMessage(playerid,0xFF0000AA," бзшъ щма мдйеъ збш бщен варв! ");
			  }
            if(listitem == 1)
            {
                //TEXT
            }
            if(listitem == 2)
            {
				//TEXT
            }
                  if(listitem == 3)
            {
              //TEXT
            }
            if(listitem == 4)
            {
                //TEXT
            }
            if(listitem == 5)
            {
                //TEXT
            }

   return 1;
   }
  }
  return 0;
  }
this jibrish is my lang btw
Reply
#4

Just remove the "return 1;" just before line 790.
This line exits the OnDialogResponse callback and prevents line 790 onward to be executed.
That's why the error points to line 790.

Another suggestion:
If you have alot of dialogs, it's easier to use switch-case instead of if's for every dialog.
Reply
#5

Quote:
Originally Posted by PowerPC603
Посмотреть сообщение
Just remove the "return 1;" just before line 790.
This line exits the OnDialogResponse callback and prevents line 790 onward to be executed.
That's why the error points to line 790.
O-M-G thank you so much!
ALWAYS peoples say do switch and stuff,esay slove by you
thanks!
Lock the post please
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)