07.03.2011, 18:44
(
Last edited by Vero; 08/03/2011 at 04:19 PM.
)
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:
Ok if you understand what you are doing we will move on to Step 2:
Ok now scroll down to:
If you don't have it just add it in!
Now add
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!
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 now scroll down to:
pawn Code:
public OnDialogResponse(playerid, dialogid, response, listitem, inputtext[])
{
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;
}