OnDialogResponse

From SA-MP Wiki

Jump to: navigation, search

OnDialogResponse


Warning: This callback was added in SA-MP version 0.3. It is not available in previous versions.


This callback is called when a player presses any of the buttons on the dialog created using ShowPlayerDialog.


Parameters:
(playerid, dialogid, response, listitem, inputtext[])
playeridThe ID of the player who responded to the dialog box.
dialogidThe ID of the dialog the player responded to, assigned in ShowPlayerDialog.
response1 for first button and 0 for second button
listitemThe 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.

Personal tools
In other languages