10.04.2013, 00:19
(
Последний раз редактировалось NinjahZ; 13.08.2013 в 04:06.
)
Dialog Tutorial...
Hello everyone,today I will be making my #1'st tutorial based on what I know allready.
I will be showing you how to make a simple dialog,with a dialog response.
Frequent Q/A
Lets start the actual coding now...
You will need to add 3 defines under your includes at the top of your code,to be sure just comment off 1 line then start your defines.
Allright,now thats out of the way your gonna want to make these dialogs you just defined...
so lets make a simple one...
We will make a Command,that when used shows a dialog.
Where to place this command??
Right at the bottom of your code make a new line and then paste this code...
That will make the dialog pop up when you are ingame and you type /help
but when you click on the box it does nothing,which is okay,but its better to have it do something right,this is called a "Response" figures huh!
This is how you make one....
Hit CTRL+F And type in the textbox that pops up "OnDialogResponse"
If and only IF you find nothing...
You will need to add this near your other public functions...
Like OnGameModeInit or OnPlayerSpawn ETC...
After "{" press enter,that makes a new line to make room for your response for your dialog.
Then this is what you will put into your new line..
That should be near enough finished,once you have done all shown above,your dialog should work,if it dosent,let me know and I will try to help you.
also have you noticed a server that has a dialog with message box's,well know you know how its done if you read below....
The way to change it from a listbox to a message box is like this...
LISTBOX
MESSAGEBOX
See the difference in the two? if not I will show you more easily....
If this helps please let me know cause I will think about making more.
and if anyone knows how to fix the way a code is shown propperly in the code box,please let me know.
Hello everyone,today I will be making my #1'st tutorial based on what I know allready.
I will be showing you how to make a simple dialog,with a dialog response.
Frequent Q/A
Quote:
(Q)What is a Response? (A)It is when you click the buttons on a dialog or click on a listed item. (Q)What is a "listed Item"? (A)Read my tutorial and find out (Q)Why does the code look very messy? (A)It's because the screen cant show it well,when you copy/paste this code,it will be perfect indent. (maybe a lil funky but hey,you can fix it when you know how...) |
You will need to add 3 defines under your includes at the top of your code,to be sure just comment off 1 line then start your defines.
Код:
#define DIALOG_TEST1 1 #define DIALOG_TEST2 2 #define DIALOG_TEST3 3
so lets make a simple one...
We will make a Command,that when used shows a dialog.
Where to place this command??
Right at the bottom of your code make a new line and then paste this code...
pawn Код:
//ZCMD CODES//
CMD:help(playerid, params[])
{
ShowPlayerDialog(playerid, DIALOG_TEST1, DIALOG_STYLE_LIST, "Help","Listitem0\nListitem1", "Select", "Cancel");
}
but when you click on the box it does nothing,which is okay,but its better to have it do something right,this is called a "Response" figures huh!
This is how you make one....
Hit CTRL+F And type in the textbox that pops up "OnDialogResponse"
If and only IF you find nothing...
You will need to add this near your other public functions...
Like OnGameModeInit or OnPlayerSpawn ETC...
pawn Код:
public OnDialogResponse(playerid, dialogid, response, listitem, inputtext[])
{
return 1;
}
Then this is what you will put into your new line..
pawn Код:
if (dialogid == DIALOG_TEST1) //==HELP==//
{
if(response) //means if they clicked left button
{
if(listitem == 0) //==Help==//
{
ShowPlayerDialog(playerid, DIALOG_TEST2, DIALOG_STYLE_LIST, "TITLE", "Listitem0\nListitem1", "Okay", " ");
}
if(listitem == 1) //==Help==//
{
ShowPlayerDialog(playerid, DIALOG_TEST3, DIALOG_STYLE_LIST, "TITLE", "Listitem0\nListitem1", "Okay", " ");
}
}
}
also have you noticed a server that has a dialog with message box's,well know you know how its done if you read below....
The way to change it from a listbox to a message box is like this...
LISTBOX
Код:
ShowPlayerDialog(playerid, DIALOG_TEST3, DIALOG_STYLE_LIST
Код:
ShowPlayerDialog(playerid, DIALOG_TEST3, DIALOG_STYLE_MSGBOX
Код:
A Listbox is shown like this. DIALOG_STYLE_LIST where as a Messagebox is shown like this. DIALOG_STYLE_MSGBOX
and if anyone knows how to fix the way a code is shown propperly in the code box,please let me know.