13.03.2016, 08:30
(
Последний раз редактировалось Untonyst; 02.10.2016 в 09:08.
Причина: Updated
)
This is just a little include what uses OnDialogResponse() to process dialogs. A method of creating dialogs like in zcmd. You can show dialog to a player in gamemode and to process dialog, you can in a filterscript.
I wrote this include to simplify the work with dialogs in large scripts (gamemodes).
Change log
Download the latest version.
Project page on GitHub.
Usage:
I wrote this include to simplify the work with dialogs in large scripts (gamemodes).
Change log
Download the latest version.
Project page on GitHub.
Usage:
PHP код:
#include <a_samp>
#include "u_dialogs"
public OnPlayerConnect(playerid)
{
ShowPlayerDialogEx(
playerid, "test", DIALOG_STYLE_MSGBOX,
"Important ",
"Today you are asleep?",
"Yes", "No"
);
return 1;
}
/*
** I decided to make the creation of handler functions similar
** the creation of common functions. Indeed, often, we do not need
** 4, to use all arguments, but rather only two.
**
** Unnecessary arguments can be hidden through
** #pragma unused <arg>
**
** The function should always return any value.
*/
DialogResponse:test(playerid, response, ...)
{
if (!response)
{
SendClientMessage(playerid, -1, "Why you didn't sleep?");
}
else
{
SendClientMessage(playerid, -1, "It is good that you slept. Today there are a lot of affairs!");
}
return 1;
}
/*
** This callback is before treatment and dialogue,
** In the case of the return of zero, it does not handle the dialogue.
** Any other value - handles.
*/
public OnDialogReceived(playerid, function[], response, listitem)
{
if (IsDialog(function, "test"))
{
SendClientMessage(playerid, -1, "You are not allowed to answer this question!");
return 0;
}
return 1;
}