|
1 | 1 | # Dialogs-Samp
|
2 | 2 | Include to make easy your life with dialogs.
|
| 3 | + |
| 4 | +| Total downloads | Latest release | |
| 5 | +| :---: | :---: | |
| 6 | +[]() | [](https://github.com/Dayvison/Dialogs-Samp/releases) <br> [](https://github.com/Dayvison/Dialogs-Samp/releases) | |
| 7 | + |
| 8 | +## Features |
| 9 | +* Response for dialogs(Like ZCMD processor) |
| 10 | +* Create dynamic dialogs |
| 11 | +* Format the info directly in the dialog, without need use format. |
| 12 | +* A new callback `OnDialogPerformed`, called before showing dialog to player |
| 13 | + |
| 14 | +## Examples |
| 15 | + |
| 16 | +### Creating and show the dialog for player |
| 17 | +```pawn |
| 18 | +CreateDialog:Dialog(playerid, style, caption[], info[], button1[], button2[]) |
| 19 | +{ |
| 20 | + style = DIALOG_STYLE_MSGBOX; |
| 21 | + caption = "Hello World!"; |
| 22 | + button1 = "Hello"; |
| 23 | + button2 = "World"; |
| 24 | + new name[MAX_PLAYER_NAME]; |
| 25 | + GetPlayerName(playerid, name, sizeof(name)); |
| 26 | + format(info, sizeof(info), "Hello %s. What you think about?", name); |
| 27 | +} |
| 28 | +public OnPlayerConnect(playerid) |
| 29 | +{ |
| 30 | + ShowDialog(playerid, Dialog); |
| 31 | +} |
| 32 | +Dialog:Dialog(playerid, dialogid, response, listitem, inputtext[]) |
| 33 | +{ |
| 34 | + SendClientMessage(playerid, -1, response ? "You clicked at button 1" : "You clicked at button 0"); |
| 35 | + return true; |
| 36 | +} |
| 37 | +``` |
| 38 | + |
| 39 | +### Show dialog without create |
| 40 | +```pawn |
| 41 | +public OnPlayerConnect(playerid) |
| 42 | +{ |
| 43 | + new name[MAX_PLAYER_NAME]; |
| 44 | + GetPlayerName(playerid, name, sizeof(name)); |
| 45 | + ShowPlayerDialog(playerid, Dialog, DIALOG_STYLE_MSGBOX, "Hello World!", "Hello %s. What you think about?", "Hello", "World", name); |
| 46 | +} |
| 47 | +Dialog:Dialog(playerid, dialogid, response, listitem, inputtext[]) |
| 48 | +{ |
| 49 | + SendClientMessage(playerid, -1, response ? "You clicked at button 1" : "You clicked at button 0"); |
| 50 | + return true; |
| 51 | +} |
| 52 | +``` |
0 commit comments