27.04.2011, 07:54
Hello.This is my first tutorial.
In this tutotial i want to show you 3 Dialog Styles and how to use them
Ok. Lets start it
In all Dialog styles you can use colours:
You can use Colours in all 3 Dialog Styles
------------------------------------------------------------------------------------------------
First Style - DIALOG_STYLE_MSGBOX
You can use MSGBOX for stats,rules,other.
Dialog Parameters
Example of using DIALOG_STYLE_MSGBOX
To make a new line you need to use \n.
Also u can use \t to tabulate.
If you want to make long dialog but you get errors cuz its too long try to use Dialog Streamer
------------------------------------------------------------------------------------------------
DIALOG_STYLE_LIST
You can use this dialog styles when you buy vehicles,weapons,other
In this style you can use colours too.
Example of using DIALOG_STYLE_LIST
Write your command to select some weapons.
Add your weapon list,and now go to " OnDialogResponse "
Don't forgot to add \n
DIALOG_STYLE_LIST Parameters:
You always need to start from " if(listitem == 0) "
------------------------------------------------------------------------------------------------
3 - DIALOG_STYLE_INPUT
You can use DIALOG_STYLE_INPUT For Register/login sistems
Register/login sistem by Kwarde
http://forum.sa-mp.com/showthread.ph...OG_STYLE_INPUT
Good luck
In this tutotial i want to show you 3 Dialog Styles and how to use them
Code:
0 - DIALOG_STYLE_MSGBOX 1 - DIALOG_STYLE_INPUT 2 - DIALOG_STYLE_LIST
In all Dialog styles you can use colours:
Code:
{FFFFFF}White {F3FF02}Yellow {FFAF00}Orange {F81414}Red {0049FF}Blue {B700FF}Purple {00FFEE}Cyan {6EF83C}Green {0E0101}Black Or go to to make your own colour<<<@!1!@>>>
------------------------------------------------------------------------------------------------
First Style - DIALOG_STYLE_MSGBOX
You can use MSGBOX for stats,rules,other.
Dialog Parameters
pawn Code:
playerid The ID of the player to show the dialog to.
dialogid An ID to assign this dialog to, so responses can be processed. Max dialogid is 32767. Using negative values will close any open dialog.
style The style of the dialog.
caption[] The title at the top of the dialog. The length of the caption can not exceed more than 64 characters before it starts to cut off.
info[] The text to display in the dialog. Use \n to start a new line and \t to tabulate.
button1[] The text on the left button.
button2[] The text on the right button. Leave it blank to hide it.
Returns This function doesn't return a specific value
pawn Code:
if (strcmp("/dialog", cmdtext, true, 10) == 0)
{
ShowPlayerDialog(playerid,1, DIALOG_STYLE_MSGBOX, "Type something here","This is dialog test.\nSecond Line\nThird line\n{FFAF00}Orange colour", "Cancel", "Continue"); return 1;
}
Also u can use \t to tabulate.
If you want to make long dialog but you get errors cuz its too long try to use Dialog Streamer
pawn Code:
if (strcmp("/sdialog", cmdtext, true, 10) == 0)
{
new HugeString[1024];
format(HugeString, sizeof(HugeString), "{FFFFFF}White Colour\n{F3FF02}Yellow Colour\n{F81414}Red Colour\n ");
format(HugeString, sizeof(HugeString), "%s{0049FF}Blue Colour\n{B700FF}Purple colour\n{00FFEE}Cyan Colour\n{6EF83C}Green Colour \n{FFC0CB}Pink Colour\n{0E0101}Black Colour", HugeString);
ShowPlayerDialog(playerid, 100, DIALOG_STYLE_MSGBOX, "Dialog Streamer", HugeString, "OK", "");
return 1;
}
DIALOG_STYLE_LIST
You can use this dialog styles when you buy vehicles,weapons,other
In this style you can use colours too.
Example of using DIALOG_STYLE_LIST
Write your command to select some weapons.
Add your weapon list,and now go to " OnDialogResponse "
Don't forgot to add \n
DIALOG_STYLE_LIST Parameters:
pawn Code:
playerid The ID of the player who responded to the dialog box.
dialogid The ID of the dialog the player responded to, assigned in ShowPlayerDialog.
response 1 for first button and 0 for second button
listitem The ID of the list item selected by the player.
inputtext[] The text entered into the input box by the player or the selected list item text.
pawn Code:
if (strcmp("/dweapons", cmdtext, true, 10) == 0)
{
ShowPlayerDialog(playerid, 1, DIALOG_STYLE_LIST, "{00FFEE}Select weapon","{F3FF02}Sawn-Off\n{F81414}Minigun\n{0049FF}RPG\n{B700FF}Dildo\n{6EF83C}Flowers\n{FFC0CB}Desert Eagle","OK","Cancel");
return 1;
}
pawn Code:
public OnDialogResponse(playerid, dialogid, response, listitem, inputtext[])
{
if(dialogid == 1)
{
if(!response) return SendClientMessage(playerid, 0xFF0000FF, "You canceled!");
}
if(listitem == 0)
{
GivePlayerWeapon(playerid,26,500);
SendClientMessage(playerid,0xFFFFFFFF,"You recivied a Sawn-Off Shotgun");
return 1;
}
if(listitem == 1)
{
GivePlayerWeapon(playerid,38,500);
SendClientMessage(playerid,0xFFFFFFFF,"You recivied a Minigun");
return 1;
}
if(listitem == 2)
{
GivePlayerWeapon(playerid,35,500);
SendClientMessage(playerid,0xFFFFFFFF,"You recivied a RPG");
return 1;
}
if(listitem == 3)
{
GivePlayerWeapon(playerid,10,500);
SendClientMessage(playerid,0xFFFFFFFF,"You recivied a Dildo");
return 1;
}
if(listitem == 4)
{
GivePlayerWeapon(playerid,14,500);
SendClientMessage(playerid,0xFFFFFFFF,"You recivied Flowers");
return 1;
}
if(listitem == 5)
{
GivePlayerWeapon(playerid,24,500);
SendClientMessage(playerid,0xFFFFFFFF,"You recivied a Desert Eagle");
return 1;
}
return 0;
}
------------------------------------------------------------------------------------------------
3 - DIALOG_STYLE_INPUT
You can use DIALOG_STYLE_INPUT For Register/login sistems
Register/login sistem by Kwarde
http://forum.sa-mp.com/showthread.ph...OG_STYLE_INPUT
Good luck