[Include] u_dlg.inc | ZCMD analog, but with SA-MP GUI - Printable Version
+- SA-MP Forums Archive (
https://sampforum.blast.hk)
+-- Forum: SA-MP Scripting and Plugins (
https://sampforum.blast.hk/forumdisplay.php?fid=8)
+--- Forum: Filterscripts (
https://sampforum.blast.hk/forumdisplay.php?fid=17)
+---- Forum: Includes (
https://sampforum.blast.hk/forumdisplay.php?fid=83)
+---- Thread: [Include] u_dlg.inc | ZCMD analog, but with SA-MP GUI (
/showthread.php?tid=602813)
Simple dialog processor -
Untonyst - 13.03.2016
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:
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;
}
Re: u_dlg.inc | ZCMD analog, but with SA-MP GUI -
SecretBoss - 13.03.2016
It's a nice idea, but something similar is already released from Emmet_ called easyDialog
https://sampforum.blast.hk/showthread.php?tid=475838
Re: u_dlg.inc | ZCMD analog, but with SA-MP GUI -
OstGot - 13.03.2016
Good job
Re: u_dlg.inc | ZCMD analog, but with SA-MP GUI -
Roozevelt - 13.03.2016
Nice work
Re: u_dlg.inc | ZCMD analog, but with SA-MP GUI -
N0FeaR - 13.03.2016
Good job, rep!
Re: u_dlg.inc | ZCMD analog, but with SA-MP GUI -
Untonyst - 17.04.2016
New version:
- added the function IsPlayerUseDialog
- added a protect for dialogs
- added callback the OnPlayerUseDialogHider
Re: u_dlg.inc | ZCMD analog, but with SA-MP GUI -
kristo - 17.04.2016
You should rename IsPlayerUseDialog to IsPlayerUsingDialog.
Re: u_dlg.inc | ZCMD analog, but with SA-MP GUI -
Untonyst - 17.04.2016
Quote:
Originally Posted by kvann
You should rename IsPlayerUseDialog to IsPlayerUsingDialog.
|
Thanks
Re: u_dlg.inc | ZCMD analog, but with SA-MP GUI -
iKevin - 17.04.2016
Good job.
Re: u_dlg.inc | ZCMD analog, but with SA-MP GUI -
Untonyst - 17.04.2016
Quote:
Originally Posted by KevinExec
Good job.
|
Thank you :3