SA-MP Forums

Go Back   SA-MP Forums > SA-MP Scripting and Plugins > Scripting Help > Help Archive

 
 
Thread Tools Display Modes
Old 11/02/2011, 08:48 AM   #1
ajwar
Huge Clucker
 
Join Date: May 2009
Location: Norway
Posts: 321
Reputation: 2
Default Unique DIALOG id

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.
ajwar is offline  
Old 11/02/2011, 08:59 AM   #2
Medal Of Honor team
Gangsta
 
Medal Of Honor team's Avatar
 
Join Date: Feb 2011
Location: Osama Bin Laden's house ;)
Posts: 505
Reputation: 2
Default Re: Unique DIALOG id

I also want that
Medal Of Honor team is offline  
Old 11/02/2011, 09:07 AM   #3
xRyder
Huge Clucker
 
xRyder's Avatar
 
Join Date: Jan 2011
Location: Right above you.
Posts: 371
Reputation: 0
Default Re: Unique DIALOG id

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


On top you put:
pawn Code:
#define DefaultDialogID 0
Then when you want to show player a dialog:
pawn Code:
ShowPlayerDialog(playerid, DefaultDialogID/* +1 , +2, +3*/, //............ );
And on dialog response:
pawn Code:
public OnDialogResponse(playerid, dialogid, response, listitem, inputtext[])
{
    if(dialogid == DefaultDialogID/* +1 , +2, +3*/)
xRyder is offline  
Old 11/02/2011, 12:31 PM   #4
Calgon
Banned
 
Join Date: Jan 2009
Posts: 6,140
Reputation: 1127
Default Re: Unique DIALOG id

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.
Calgon is offline  
Old 11/02/2011, 01:13 PM   #5
Rachael
Huge Clucker
 
Rachael's Avatar
 
Join Date: Feb 2010
Posts: 380
Reputation: 28
Default Re: Unique DIALOG id

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 Code:
#define DIALOG_SOMETHING
#define DIALOG_NEXT_THING

and then use a switch statement under OnDialogResponse case DIALOG_SOMETHING: etc
Rachael is offline  
 

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
Dialog returns to the first dialog in secs. THE_KNOWN Help Archive 0 17/01/2011 04:07 PM
Dialog returns to the first dialog in secs. THE_KNOWN Help Archive 6 15/01/2011 05:34 PM
SetPlayerTeamFromClass(playerid, classid); from dialog with dialog Haydz Help Archive 6 28/11/2010 10:21 AM
uniQue Production | Fighting Styles Dialog iRemix Filterscripts 7 15/02/2010 08:09 PM


All times are GMT. The time now is 08:05 AM.


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