How to use Dialog Styles. -
Vero - 07.03.2011
Ok well i've decided to make a tutorial on how to make some dialog boxes. These are the following box-styles you can use:
0 - DIALOG_STYLE_MSGBOX
1 - DIALOG_STYLE_INPUT
2 - DIALOG_STYLE_LIST
https://sampwiki.blast.hk/wiki/Dialog This is a link to SAMP wiki if you need to see what they look like!
Ok lets get started, Step 1:
Ok so have a basic command, for example a help command. I will use /info and DIALOG_STYLE_LIST:
pawn Code:
command(info, playerid, params[]) //So the start of your command
{
{
ShowPlayerDialog( playerid, 100, DIALOG_STYLE_LIST, "Information Menu", "Commands\nRules\n", "Select", "Cancel" ); // Okay you can edit this and change it but let me walk you through everything!
}
return 1;
}
pawn Code:
ShowPlayerDialog( playerid //The ID of the player to show the dialog to.
pawn Code:
ShowPlayerDialog( playerid, 100 //100 being the number you want to assign to this dialog (max number is 32767)
pawn Code:
ShowPlayerDialog( playerid, 100, DIALOG_STYLE_LIST //The type of dialog you want it to be.
pawn Code:
ShowPlayerDialog( playerid, 100, DIALOG_STYLE_LIST, "Information Menu" //The title on the dialog
pawn Code:
ShowPlayerDialog( playerid, 100, DIALOG_STYLE_LIST, "Information Menu", "Commands\nRules\n" //What the player can select
pawn Code:
ShowPlayerDialog( playerid, 100, DIALOG_STYLE_LIST, "Information Menu", "Commands\nRules\n", "Select", "Cancel" );// Select or cancel will be displayed at the bottom of the text box, change this to what suits you.
Ok if you understand what you are doing we will move on to Step 2:
Ok now scroll down to:
pawn Code:
public OnDialogResponse(playerid, dialogid, response, listitem, inputtext[])
{
If you don't have it just add it in!
Now add
pawn Code:
public OnDialogResponse(playerid, dialogid, response, listitem, inputtext[])
{
switch(dialogid)
{
case 100: // Whatever number you assigned to your dialog!
{
if(!response)
{
SendClientMessage(playerid, WHITE, "Hmm ok you cancelled!");//If they select cancel
return 1;
}
switch(listitem)
{
case 0: // The amount of cases will be determined by what the player can select! Note always start with case 0!
{
SendClientMessage(playerid, WHITE, "commands go here!" );
}
case 1:
{
SendClientMessage(playerid, WHITE, "rules go here!" );
}
}// You can always add more cases! If you don't want to use return 1;
}
That's it easy! Please make sure you understand everything, also change the colours to your colours or you will get errors. Enjoy and i hope I've helped!
Re: How to use Dialog Styles. -
alpha500delta - 07.03.2011
Looks good...
Re: How to use Dialog Styles. -
Stigg - 07.03.2011
Excellent tut for begginers, well done.
Re: How to use Dialog Styles. -
Raz0r1000 - 07.03.2011
Nice tut (A for effort), but isn't this on the Wiki too?
Re: How to use Dialog Styles. -
Markx - 07.03.2011
its also good to define the dialogs
Re: How to use Dialog Styles. -
Vero - 07.03.2011
Quote:
Originally Posted by Raz0r1000
Nice tut (A for effort), but isn't this on the Wiki too?
|
Yes this is on wiki, however i used my version in my GM and also broke it down more, so it is easier to understand.
Respuesta: How to use Dialog Styles. -
Code8976Man - 07.03.2011
Very good explained, that will be userful for newbies and well by using switch
Re: How to use Dialog Styles. -
BASITJALIL - 08.03.2011
Nice work
Re: How to use Dialog Styles. -
Ironboy - 08.03.2011
Nice tutorial
and it is very usefull
Re: How to use Dialog Styles. -
cloudysky - 08.03.2011
Very Nice, great Tutorial!