OnDialogResponse
From SA-MP Wiki
OnDialogResponse
Warning: This is a new callback working since SA-MP 0.3. It won't work in previous versions.
This callback is called when a player presses any of the buttons on the dialog created using ShowPlayerDialog.
(playerid, dialogid, response, listitem, inputtext[])
| 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. |
public OnDialogResponse(playerid, dialogid, response, listitem, inputtext[]) { if(!IsPlayerAdmin(playerid)) return 0; // this is an admin only script if(dialogid == 1) { if(!response) SendClientMessage(playerid, 0xFFFFFFFF, "You canceled!"); new message[196]; format(message, sizeof(message), "You replied: %s", inputtext); SendClientMessage(playerid, 0xFFFFFFFF, message); return 1; } return 0; }
Related Functions
The following functions might be useful, as they're related to this callback in one way or another.
- ShowPlayerDialog: Show a dialog to a player.
