[Tutorial] [TUT] How To Make A Dialog Menu (LIST And MSGBOX Only!)
#41

Can i make a dialog (list) with one button only?
Reply
#42

This is from 2009 boys there is much better methods for doing dialogs these days on top of that the author didn't mention to use some #define's for the dialogids this tutorial is not a way for someone to learn from.
Reply
#43

Any links...? That will be great
Reply
#44

Well I would concentrate on using a system and there is only two systems that are worth your time to learn in my opinion. We have easydialog and y_inline/y_dialog your probably best off using easydialog to start I think the y_inline/y_dialog method is a little more advanced.

Easy Dialog
https://sampforum.blast.hk/showthread.php?tid=475838

YSI
http://ysi.tl/
Reply
#45

How is it possible to make a dialog with 3 buttons? I saw one in RP server.
Reply
#46

Well,Its easy but using a dialog creator is more easy
Reply
#47

How do I add two list? I made my weapon shop with a Dialog list, Now I want to add a car spawner, But when I try to place the list underneath the first one, It keeps telling me, OnDialogResponce should return a value... I've been playing with return 1; and return 0; ALL DAY!! I have tried different spots but nothing is working for me... Please help.
Reply
#48

Great Guid you doing great on it
Reply
#49

Great tutorial, this helped to understand the dialog system better
Reply
#50

Nice Tutorial, Thanks
Reply
#51

Very nice guide,First guide with everything well explained.
+Rep.
Reply
#52

Can anyone help? Why if I use listitem, it doesnt work, it works for the first line ( 0 ) but for the second( 1)/( (listitem == 1) it doesnt, anyone knows a solution?
Reply
#53

Show us your code please
Reply
#54

Code:
public OnDialogResponse(playerid, dialogid, response, listitem, inputtext[])
{
	
 		if(dialogid == 2)
		{
		if(response)
		{
		if(listitem == 0)
		{
			ShowPlayerDialog(playerid, 3, DIALOG_STYLE_LIST, "Commands", "General Commands \nChat 
                        Commands \nAnimation Commands \nGroup Commands \nPremium Commands \nHelper 
                        Commands \nStaff Commands ", "Select", "Cancel");

		}
		return 1;
		}
		return 1;
		}

                if(dialogid == 2)
		{
		if(response)
		{
		if(listitem == 1)
		{
		    ShowPlayerDialog(playerid, 4, DIALOG_STYLE_LIST, "FAQs", "How to refill an empty water bottle? 
                    \nHow to get weapons? \nHow to speak in the global chat? \nHow to refill an empty jerry canister 
                    \nHow to open,close,lock and unlock doors? \nHow can I know my current location and reach 
                    destinations easily? \nWhy do players have different colors?", "Select", "Close");

		}
		return 1;
		}
		return 1;
		}

		if(dialogid == 2)
		{
		if(response)
		{
		if(listitem == 2)
		{
			ShowPlayerDialog(playerid, 5, DIALOG_STYLE_LIST, "Tutorials", "Stats \nWeapon Management 
                        \nPrivate Tents \nVehicles \nFishing \nBase Building", "Select", "Cancel");

		}
		return 1;
		}
		return 1;
		}

		return 0;
		
 }
then I have this on, this is where it responds. The first one works, like on the "Commands" part, it shows the designated dialog for them, but when it comes to FAQs and Tutorials...it won't work...but there aren't any errors when you compile. It just won't appear....

Code:
public OnPlayerCommandText(playerid, cmdtext[])
{
	if (strcmp("/help", cmdtext, true) == 0)
	{
			ShowPlayerDialog(playerid, 2, DIALOG_STYLE_LIST, "Help Menu", "Commands \nFAQs \nTutorials \nCommunity ", "Select", "Cancel");
			return 1;
	}
	return 0;
}
Reply
#55

This is how it should be
pawn Code:
public OnDialogResponse(playerid, dialogid, response, listitem, inputtext[])
{
    if(dialogid == 2)
    {
         if(response)
        {
              if(listitem == 0)
         {
            ShowPlayerDialog(playerid, 3, DIALOG_STYLE_LIST, "Commands", "General Commands \nChat
                        Commands \nAnimation Commands \nGroup Commands \nPremium Commands \nHelper
                        Commands \nStaff Commands "
, "Select", "Cancel");

         }
         else if(listitem == 1)
         {
            ShowPlayerDialog(playerid, 4, DIALOG_STYLE_LIST, "FAQs", "How to refill an empty water bottle?
                    \nHow to get weapons? \nHow to speak in the global chat? \nHow to refill an empty jerry canister
                    \nHow to open,close,lock and unlock doors? \nHow can I know my current location and reach
                    destinations easily? \nWhy do players have different colors?"
, "Select", "Close");

         }
         else if(listitem == 2)
         {
            ShowPlayerDialog(playerid, 5, DIALOG_STYLE_LIST, "Tutorials", "Stats \nWeapon Management
                        \nPrivate Tents \nVehicles \nFishing \nBase Building"
, "Select", "Cancel");

         }
         }
             return 1;
    }

      return 0;
       
 }
Reply
#56

Quote:
Originally Posted by Flashhiee
View Post
This is how it should be
pawn Code:
public OnDialogResponse(playerid, dialogid, response, listitem, inputtext[])
{
    if(dialogid == 2)
    {
         if(response)
        {
              if(listitem == 0)
         {
            ShowPlayerDialog(playerid, 3, DIALOG_STYLE_LIST, "Commands", "General Commands \nChat
                        Commands \nAnimation Commands \nGroup Commands \nPremium Commands \nHelper
                        Commands \nStaff Commands "
, "Select", "Cancel");

         }
         else if(listitem == 1)
         {
            ShowPlayerDialog(playerid, 4, DIALOG_STYLE_LIST, "FAQs", "How to refill an empty water bottle?
                    \nHow to get weapons? \nHow to speak in the global chat? \nHow to refill an empty jerry canister
                    \nHow to open,close,lock and unlock doors? \nHow can I know my current location and reach
                    destinations easily? \nWhy do players have different colors?"
, "Select", "Close");

         }
         else if(listitem == 2)
         {
            ShowPlayerDialog(playerid, 5, DIALOG_STYLE_LIST, "Tutorials", "Stats \nWeapon Management
                        \nPrivate Tents \nVehicles \nFishing \nBase Building"
, "Select", "Cancel");

         }
         }
             return 1;
    }

      return 0;
       
 }

Ah, it shouldn't be alligned? Oh if thats the matter, thanks a lot!
Reply
#57

The allignment is only important to understand the code better later on. How i alligned the code now(even though its not perfect) is how i usually allign it. Some other people align it differently.
Reply
#58

Quote:
Originally Posted by Flashhiee
View Post
The allignment is only important to understand the code better later on. How i alligned the code now(even though its not perfect) is how i usually allign it. Some other people align it differently.
There is one problem, it won't identify

Code:
if(dialogid == 2)
This is how I did it:

Code:
public OnDialogResponse(playerid, dialogid, response, listitem, inputtext[])
{
    if(dialogid == 1)
	{
	if(response)
	{
	SendClientMessage(playerid,0x008000FF, "Please read the game rules to avoid any issues!");
	}
	else
	{
	SendClientMessage(playerid, 0xFF0000FF, "You selected 'Quit', therefore you got kicked. ");
	Kick(playerid);
	}
	return 1;
	}
	return 1;

				
	if(dialogid == 2)
  	{
 	if(response)
 	{
        if(listitem == 0)
	{
	ShowPlayerDialog(playerid, 3, DIALOG_STYLE_LIST, "Commands", "General Commands \nChat\
	Commands \nAnimation Commands \nGroup Commands \nPremium Commands \nHelper\
	Commands \nStaff Commands ", "Select", "Cancel");
	}
	else if(listitem == 1)
	{
	ShowPlayerDialog(playerid, 4, DIALOG_STYLE_LIST, "FAQs", "How to refill an empty water bottle?\
	\nHow to get weapons? \nHow to speak in the global chat? \nHow to refill an empty jerry canister\
	\nHow to open,close,lock and unlock doors? \nHow can I know my current location and reach\
	destinations easily? \nWhy do players have different colors?", "Select", "Close");
	}
	else if(listitem == 2)
	{
	ShowPlayerDialog(playerid, 5, DIALOG_STYLE_LIST, "Tutorials", "Stats \nWeapon Management\
   	\nPrivate Tents \nVehicles \nFishing \nBase Building", "Select", "Cancel");		 			}
	return 1;
	}
	return 1;
	}
	return 0;
}
Any idea how to fix it?
Reply
#59

You need to #define or put the dialog definition in a enum.
Reply
#60

Quote:
Originally Posted by Debjit
View Post
You need to #define or put the dialog definition in a enum.
Still not working tho,,,,


http://prntscr.com/jbbefa



it is still unreachable code..somehow...the line 242



Edit: NVM, fixed it. Thanks users
Reply


Forum Jump:


Users browsing this thread: 2 Guest(s)