SA-MP Forums

Go Back   SA-MP Forums > SA-MP Scripting and Plugins > Plugin Development

Reply
 
Thread Tools Display Modes
Old 19/03/2018, 12:19 PM   #1
KashCherry
Little Clucker
 
KashCherry's Avatar
 
Join Date: Feb 2018
Location: Estonia
Posts: 30
Reputation: 19
Default Dialog Plugin

Dialog v0.8

Description
This plugin allows you to work with dialogs as with commands

Features
  • Made by analogue mdialog
  • Easy and convenient to use
  • Fast

Callbacks
OnDialogReceived - called before calling the dialog response
OnDialogPerformed - called after calling the dialog response

Functions
Dialog_Open - Open the dialog
Dialog_Show - Open existing dialog
Dialog_EnableFix - Enable fix (replaces % by #, and color codes will be removed)

Example
PHP Code:
public OnDialogReceived(dialog[], playeridresponselistiteminputtext[])
{
  if(
strcmp(dialog,"dialog") && !IsPlayerAdmin(playerid)) return 0// The dialog response will not be called
}

public 
OnDialogResponse(playerid,dialogid,response,listitem,inputtext[])
{
  return -
1// Required
}

public 
OnDialogPerformed(dialog[], playeridresponselistiteminputtext[], result)
{
  if(
result == -1printf("Dialog %s doesn't exists",dialog);
}

DialogCreate:dialog(playerid)
{
  
Dialog_Open(playerid,"dialog",DIALOG_STYLE_MSGBOX,"...","...","...","...");
}

DialogResponse:dialog(playeridresponselistiteminputtext[])
{
  
printf("Dialog \"dialog\" called");
  return 
1// Required

Download
Binaries
Source code

Last edited by KashCherry; 19/03/2018 at 06:54 PM.
KashCherry is offline   Reply With Quote
Old 19/03/2018, 12:39 PM   #2
iLearner
Gangsta
 
iLearner's Avatar
 
Join Date: Apr 2017
Posts: 546
Reputation: 114
Default Re: Dialog Plugin

There are already better things out there, however good job for the effort.
iLearner is offline   Reply With Quote
Old 19/03/2018, 12:41 PM   #3
KashCherry
Little Clucker
 
KashCherry's Avatar
 
Join Date: Feb 2018
Location: Estonia
Posts: 30
Reputation: 19
Default Re: Dialog Plugin

Quote:
Originally Posted by iLearner View Post
There are already better things out there, however good job for the effort.
Yes, I know:
Quote:
Originally Posted by KashCherry
Made by analogue mdialog
My idea was to make a call and handle a faster
KashCherry is offline   Reply With Quote
Old 19/03/2018, 01:59 PM   #4
Kaperstone
High-roller
 
Kaperstone's Avatar
 
Join Date: May 2011
Location: Russia
Posts: 3,354
Reputation: 822
Default Re: Dialog Plugin

What are the benefits of this over easyDialog?
__________________
Kaperstone is offline   Reply With Quote
Old 19/03/2018, 03:11 PM   #5
KashCherry
Little Clucker
 
KashCherry's Avatar
 
Join Date: Feb 2018
Location: Estonia
Posts: 30
Reputation: 19
Default Re: Dialog Plugin

Quote:
Originally Posted by Kaperstone View Post
What are the benefits of this over easyDialog?
You can say that this is the same, but much faster
KashCherry is offline   Reply With Quote
Old 19/03/2018, 03:23 PM   #6
Kaperstone
High-roller
 
Kaperstone's Avatar
 
Join Date: May 2011
Location: Russia
Posts: 3,354
Reputation: 822
Default Re: Dialog Plugin

Quote:
Originally Posted by KashCherry View Post
You can say that this is the same, but much faster
Would love to see benchmarks between this, vanilla and easyDialog.


I personally have a lot of dialogs, if this plugin is faster than the existing solutions, I won't mind rewriting the code.
__________________
Kaperstone is offline   Reply With Quote
Old 19/03/2018, 05:08 PM   #7
KashCherry
Little Clucker
 
KashCherry's Avatar
 
Join Date: Feb 2018
Location: Estonia
Posts: 30
Reputation: 19
Default Re: Dialog Plugin

Quote:
Originally Posted by Kaperstone View Post
Would love to see benchmarks between this, vanilla and easyDialog.


I personally have a lot of dialogs, if this plugin is faster than the existing solutions, I won't mind rewriting the code.
Speed tests between RPC_DialogResponse and dialog (registered 100 dialogs, microseconds):
Vanilla: 33,31,55
This plugin: 23,20,26
easyDialog: 83, 92, 80
KashCherry is offline   Reply With Quote
Old 19/03/2018, 06:07 PM   #8
Kaperstone
High-roller
 
Kaperstone's Avatar
 
Join Date: May 2011
Location: Russia
Posts: 3,354
Reputation: 822
Default Re: Dialog Plugin

Quote:
Originally Posted by KashCherry View Post
Speed tests between RPC_DialogResponse and dialog (registered 100 dialogs, microseconds):
Vanilla: 33,31,55
This plugin: 23,20,26
easyDialog: 83, 92, 80
Can you reveal the source of the benchmark?
__________________
Kaperstone is offline   Reply With Quote
Old 19/03/2018, 06:17 PM   #9
KashCherry
Little Clucker
 
KashCherry's Avatar
 
Join Date: Feb 2018
Location: Estonia
Posts: 30
Reputation: 19
Default Re: Dialog Plugin

Quote:
Originally Posted by Kaperstone View Post
Can you reveal the source of the benchmark?
I used this speedtest with changed address (0x4928A0) on 0x493750
KashCherry is offline   Reply With Quote
Old 20/03/2018, 01:55 AM   #10
Mobtiesgangsa
Big Clucker
 
Mobtiesgangsa's Avatar
 
Join Date: Oct 2016
Location: Skopje, Macedonia
Posts: 94
Reputation: 9
Default Re: Dialog Plugin

Can you implement to your plugin to handle Message box's dialogs to switch between different pages example and have 3 buttons [>] [X] [<] something like that?
__________________
YSI User

Code:
public e_COMMAND_ERRORS:OnPlayerCommandReceived(playerid, cmdtext[], e_COMMAND_ERRORS:success)
{
	switch(success)
	{
	    case COMMAND_UNDEFINED:
	    {
		    TextDrawShowForPlayer(playerid, cmdinfo[playerid]);
		    SetTimerEx("UnknownCommand", 3000, false, "d", playerid);
	    }
	}
	return COMMAND_OK;
}
Mobtiesgangsa is offline   Reply With Quote
Reply

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Centos7 - Streamer plugin and crashdetect plugin Su37Erich Server Support 3 12/08/2016 12:18 AM
Dialog plugin DexX39 Scripting Help 2 06/09/2014 02:32 PM
Very good plugin suggestion (for scripters) and easy to make for the Plugin Developers! Xentiarox Plugin Development 5 29/07/2012 10:48 PM
mysql plugin. loading plugin failed ikkentim Help Archive 2 10/02/2011 02:32 PM


All times are GMT. The time now is 12:25 PM.


Powered by vBulletin® Version 3.8.6
Copyright ©2000 - 2018, Jelsoft Enterprises Ltd.