SA-MP Forums Archive
Unique DIALOG id - 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: Scripting Help (https://sampforum.blast.hk/forumdisplay.php?fid=12)
+---- Forum: Help Archive (https://sampforum.blast.hk/forumdisplay.php?fid=89)
+---- Thread: Unique DIALOG id (/showthread.php?tid=224159)



Unique DIALOG id - ajwar - 11.02.2011

Hi, is there any way to make function that checks if the dialog id allready exists? If it do that, so it increases id value until it reaches free DIALOG id.


Re: Unique DIALOG id - Medal Of Honor team - 11.02.2011

I also want that


Re: Unique DIALOG id - xRyder - 11.02.2011

Why bothering to create some functions for that when you can do it rather simply.


On top you put:
pawn Код:
#define DefaultDialogID 0
Then when you want to show player a dialog:
pawn Код:
ShowPlayerDialog(playerid, DefaultDialogID/* +1 , +2, +3*/, //............ );
And on dialog response:
pawn Код:
public OnDialogResponse(playerid, dialogid, response, listitem, inputtext[])
{
    if(dialogid == DefaultDialogID/* +1 , +2, +3*/)



Re: Unique DIALOG id - Calgon - 11.02.2011

xRyder's solution of creating a macro to store dialog IDs in is probably the most logical, and it's the method that I use for tracing dialog IDs.

There are other ways, but they're more complicated and redundant.


Re: Unique DIALOG id - Rachael - 11.02.2011

I'm interested to know why you would need to go to this much trouble.

Surely if you script your dialogs carefully, the combination of dialog id and playerid should be enough to avoid any input / out put errors.

I would gladly admit that I am wrong if you can give me a simple example.

[edit] for my dialogs I simply use
pawn Код:
#define DIALOG_SOMETHING
#define DIALOG_NEXT_THING
and then use a switch statement under OnDialogResponse case DIALOG_SOMETHING: etc