Giter Club home page Giter Club logo

mdialog's Introduction

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:

Tag Description
\\c Centers the text
\\r Aligns the text to the right

tags example

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

mdialog's People

Contributors

4x11 avatar daniel-cortez avatar soly-olf avatar ziggi avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.