samp.directory
← Scripts y librerías

Open-GTO/mdialog

Modern dialog system

Librería★ 20actualizado ene 2021MITPawnsampctl
Abrir en GitHub

Instalar con sampctl

sampctl package install Open-GTO/mdialog

Ejecútalo en la carpeta de tu proyecto. sampctl descarga el paquete y sus dependencias.

Depende de 1 paquete

README.md

mdialog

Modern dialog system.

Functions

Open dialog
Dialog_Open(playerid, const function[], style, const caption[], const info[], const button1[], const button2[]);
Close dialog
Dialog_Close(playerid, const function[] = "", showDialog = true);
Get name of the current dialog
Dialog_GetCurrent(playerid, function[], const size = sizeof(function))
Check on opening dialog by name or any (if function is empty)
Dialog_IsOpen(playerid, const function[] = "");
Show dialog by name
Dialog_Show(playerid, const function[]);
Show message dialog
Dialog_Message(playerid, const caption[], const info[], const button1[]);
Show message dialog with custom response callback
Dialog_MessageEx(playerid, const response[], const caption[], const info[], const button1[], const button2[]);

zlang support

If MDIALOG_ZLANG_MODE is defined then some mdialog functions take a new view.

Open dialog
Dialog_Open(playerid, const function[], style, const caption[], const info[], const button1[], const button2[], {Float, _}:...);
Show message dialog
Dialog_Message(playerid, const caption[], const info[], const button1[], {Float, _}:...);
Show message dialog with custom response callback
Dialog_MessageEx(playerid, const response[], const caption[], const info[], const button1[], const button2[], {Float, _}:...);

Tags support

You can use tags for markup your dialogs:

TagDescription
\\cCenters the text
\\rAligns the text to the right

You also can disable tags with definition of MDIALOG_DISABLE_TAGS before mdialog including. This can be useful if you are not interested in this feature and wants a little bit more performance.

Usage

You can use DialogCreate:, DialogResponse: and DialogInterrupt: prefixes:

DialogCreate:test(playerid)
{
	Dialog_Open(playerid, Dialog:test, DIALOG_STYLE_MSGBOX,
	            "Hello",
	            "Are you ok?",
	            "Yes", "No");
}

DialogResponse:test(playerid, response, listitem, inputtext[])
{
	if (!response) {
		SendClientMessage(playerid, -1, "This club only for OK guys!");
		Dialog_Show(playerid, Dialog:test);
		return 1;
	}

	SendClientMessage(playerid, -1, "Welcome to the club");
	return 1;
}

DialogInterrupt:test(playerid)
{
	SendClientMessage(playerid, -1, "Dialog \"test\" was closed by Dialog_Close or by opening other dialog");
	return 1;
}

Usage with zlang mode

#define MDIALOG_ZLANG_MODE
#include "mdialog"

DialogCreate:test(playerid)
{
	Dialog_Open(playerid, Dialog:test, DIALOG_STYLE_MSGBOX,
	            "Hello",
	            "LANG_ARE_YOU_OK",
	            "Yes", "BUTTON_NO",
	            playerid);
}

DialogResponse:test(playerid, response, listitem, inputtext[])
{
	if (!response) {
		SendClientMessage(playerid, -1, "This club only for OK guys!");
		Dialog_Show(playerid, Dialog:test);
		return 1;
	}

	SendClientMessage(playerid, -1, "Welcome to the club");
	return 1;
}

Lang file:

LANG_ARE_YOU_OK = Hey id %d, are you ok?
BUTTON_NO = No

Esta página se genera con lo que GitHub publica sobre el repositorio. samp.directory no aloja el código. Informar de un problema con esta ficha

Open-GTO/mdialog: Librería de SA-MP | samp.directory