SA-MP Forums

Go Back   SA-MP Forums > SA-MP Scripting and Plugins > Scripting Help > Tutorials

Reply
 
Thread Tools Display Modes
Old 13/08/2016, 05:43 PM   #101
princejeet1510
Big Clucker
 
princejeet1510's Avatar
 
Join Date: Mar 2016
Location: Trying to figure it out.
Posts: 115
Reputation: 4
Default Re: [TUT] How To Make A Dialog Menu (LIST And MSGBOX Only!)

Very nice guide,First guide with everything well explained.
+Rep.
__________________
princejeet1510 is offline   Reply With Quote
Old 28/04/2018, 01:39 PM   #102
DarkMythHunter
Big Clucker
 
DarkMythHunter's Avatar
 
Join Date: May 2017
Location: Philippines
Posts: 138
Reputation: 24
Default Re: [TUT] How To Make A Dialog Menu (LIST And MSGBOX Only!)

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?
__________________


DarkMythHunter is offline   Reply With Quote
Old 28/04/2018, 02:15 PM   #103
Flashhiee
Gangsta
 
Flashhiee's Avatar
 
Join Date: Mar 2012
Posts: 922
Reputation: 304
Default Re: [TUT] How To Make A Dialog Menu (LIST And MSGBOX Only!)

Show us your code please
__________________
My maps:
The Hell - Space Station[Module I] - Mansion Interior - Mining Village - Desert Village

I create custom maps of any kind, more details on discord at UnuAlex#6567
Flashhiee is offline   Reply With Quote
Old 28/04/2018, 02:29 PM   #104
DarkMythHunter
Big Clucker
 
DarkMythHunter's Avatar
 
Join Date: May 2017
Location: Philippines
Posts: 138
Reputation: 24
Default Re: [TUT] How To Make A Dialog Menu (LIST And MSGBOX Only!)

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;
}
__________________


DarkMythHunter is offline   Reply With Quote
Old 28/04/2018, 02:39 PM   #105
Flashhiee
Gangsta
 
Flashhiee's Avatar
 
Join Date: Mar 2012
Posts: 922
Reputation: 304
Default Re: [TUT] How To Make A Dialog Menu (LIST And MSGBOX Only!)

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;
       
 }
__________________
My maps:
The Hell - Space Station[Module I] - Mansion Interior - Mining Village - Desert Village

I create custom maps of any kind, more details on discord at UnuAlex#6567
Flashhiee is offline   Reply With Quote
Old 28/04/2018, 02:45 PM   #106
DarkMythHunter
Big Clucker
 
DarkMythHunter's Avatar
 
Join Date: May 2017
Location: Philippines
Posts: 138
Reputation: 24
Post Re: [TUT] How To Make A Dialog Menu (LIST And MSGBOX Only!)

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!
__________________


DarkMythHunter is offline   Reply With Quote
Old 28/04/2018, 02:55 PM   #107
Flashhiee
Gangsta
 
Flashhiee's Avatar
 
Join Date: Mar 2012
Posts: 922
Reputation: 304
Default Re: [TUT] How To Make A Dialog Menu (LIST And MSGBOX Only!)

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.
__________________
My maps:
The Hell - Space Station[Module I] - Mansion Interior - Mining Village - Desert Village

I create custom maps of any kind, more details on discord at UnuAlex#6567
Flashhiee is offline   Reply With Quote
Old 28/04/2018, 04:31 PM   #108
DarkMythHunter
Big Clucker
 
DarkMythHunter's Avatar
 
Join Date: May 2017
Location: Philippines
Posts: 138
Reputation: 24
Default Re: [TUT] How To Make A Dialog Menu (LIST And MSGBOX Only!)

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?
__________________


DarkMythHunter is offline   Reply With Quote
Old 28/04/2018, 04:38 PM   #109
Zeth
Huge Clucker
 
Zeth's Avatar
 
Join Date: Feb 2017
Location: Titan
Posts: 434
Reputation: 114
Default Re: [TUT] How To Make A Dialog Menu (LIST And MSGBOX Only!)

You need to #define or put the dialog definition in a enum.
Zeth is offline   Reply With Quote
Old 28/04/2018, 05:19 PM   #110
DarkMythHunter
Big Clucker
 
DarkMythHunter's Avatar
 
Join Date: May 2017
Location: Philippines
Posts: 138
Reputation: 24
Default Re: [TUT] How To Make A Dialog Menu (LIST And MSGBOX Only!)

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
DarkMythHunter is offline   Reply With Quote
Reply

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
List style Dialog Help Tyler_Idy Help Archive 15 25/06/2010 12:10 AM
Dialog - MSGBOX Mechscape Help Archive 3 29/05/2010 10:36 AM
Help with BIG dialog in msgbox style! Posorkon Help Archive 12 12/02/2010 06:02 AM
Dialog List Help Annihalation Help Archive 2 26/10/2009 12:57 AM


All times are GMT. The time now is 09:13 PM.


Powered by vBulletin® Version 3.8.6
Copyright ©2000 - 2019, Jelsoft Enterprises Ltd.