SA-MP Forums

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

Reply
 
Thread Tools Display Modes
Old 10/06/2019, 07:32 AM   #1
nbx2000
Big Clucker
 
Join Date: Dec 2016
Posts: 160
Reputation: 5
Default ShowPlayerDialog ID NECESSARY?

Hello, guys, I have a question. Is it necessary to put an id or definition ShowPlayerDialog?


I WILL NOT USE YOU WITH OnDialogResponse CLARIFICATION

ARE THE TWO FORMS CORRECT?
example

#define DIALOG_RULES 9001

CMD:rules (playerid, params[])
{
new Menu[187]; // Número de caracteres que usará dentro del dialog (todos los caracteres).
Menu[0]='\0'; // Variable del dialog, definida antes.
strcat(Menu, "Este es el texto que será mostrado dentro del dialog. Puede añadir otra\n", 73); // 73 es el número de caracteres en esta línea.
strcat(Menu, "línea usando el símbolo de la línea anterior (n). No necesita\n", 137); // 137 es el número de caracteres en otras líneas sumado a esta línea.
strcat(Menu, "colocar el símbolo en la última línea del dialog.", 187); // Estos son todos los caracteres usados en el dialog.
ShowPlayerDialog(playerid, DIALOG_RULES , DIALOG_STYLE_MSGBOX, "Ayuda de dialog", Menu, "Aceptar", "Cancelar");
return 1;
}

WITH AN ID 78 EXAMPLE
CMD:rules (playerid, params[])
{
new Menu[187]; // Número de caracteres que usará dentro del dialog (todos los caracteres).
Menu[0]='\0'; // Variable del dialog, definida antes.
strcat(Menu, "Este es el texto que será mostrado dentro del dialog. Puede añadir otra\n", 73); // 73 es el número de caracteres en esta línea.
strcat(Menu, "línea usando el símbolo de la línea anterior (n). No necesita\n", 137); // 137 es el número de caracteres en otras líneas sumado a esta línea.
strcat(Menu, "colocar el símbolo en la última línea del dialog.", 187); // Estos son todos los caracteres usados en el dialog.
ShowPlayerDialog(playerid, 78 , DIALOG_STYLE_MSGBOX, "Ayuda de dialog", Menu, "Aceptar", "Cancelar");
return 1;
}
nbx2000 is offline   Reply With Quote
Old 10/06/2019, 09:13 AM   #2
khRamin78
Huge Clucker
 
Join Date: Jun 2015
Posts: 315
Reputation: 30
Default Re: ShowPlayerDialog ID NECESSARY?

dialog ids are useful when you are about to use it in dialog response ! you can assign a value for dialogs that you don't need them in response and assign that id to all of that kind dialogs! but beware there is a limit of 32767 in dialog ids,
and you can put id and definition both ! in case of using definition it makes code clear and dialogs ids won't mess with each other! the better way is using enumeration like below

PHP Code:
enum 
{
    
Dialog_First,
    
Dialog_Sec,
    
Dialog_Useless

khRamin78 is online now   Reply With Quote
Old 10/06/2019, 09:34 AM   #3
nbx2000
Big Clucker
 
Join Date: Dec 2016
Posts: 160
Reputation: 5
Default Re: ShowPlayerDialog ID NECESSARY?

I already understand enum is organized and clean and another is to use # Define?
Enum
{
Rules,
Help2
}
Or
#define dialog_rules 900
#define diálog_help 901

Last edited by nbx2000; 10/06/2019 at 09:53 PM.
nbx2000 is offline   Reply With Quote
Old 11/06/2019, 02:04 AM   #4
nbx2000
Big Clucker
 
Join Date: Dec 2016
Posts: 160
Reputation: 5
Default Re: ShowPlayerDialog ID NECESSARY?

two forms is correct?
nbx2000 is offline   Reply With Quote
Old 11/06/2019, 03:38 AM   #5
TheToretto
Gangsta
 
TheToretto's Avatar
 
Join Date: Jul 2015
Posts: 592
Reputation: 66
Default Re: ShowPlayerDialog ID NECESSARY?

Quote:
Originally Posted by nbx2000 View Post
two forms is correct?
Yes both will work the same way, as long as they have unique values.
__________________






Toretto#9902

Rest in peace grandpa, 03 November 2018
TheToretto is offline   Reply With Quote
Old 11/06/2019, 04:34 AM   #6
Koreadars
Big Clucker
 
Join Date: Mar 2019
Location: Czech Republic, Prdelákov.
Posts: 127
Reputation: 6
Default Re: ShowPlayerDialog ID NECESSARY?

Quote:
Originally Posted by nbx2000 View Post
two forms is correct?
In fact it's correct, but not the same.

pawn Code:
enum{
    Rules,
    Help2,
}
- The ID begins with 0. Not with 900, like you want here:
pawn Code:
#define dialog_rules 900
#define dialog_help 901

But what you can do to make it the same is:
pawn Code:
enum{
    Rules = 900,
    Help2,
}
Koreadars is offline   Reply With Quote
Old 11/06/2019, 07:19 AM   #7
nbx2000
Big Clucker
 
Join Date: Dec 2016
Posts: 160
Reputation: 5
Default Re: ShowPlayerDialog ID NECESSARY?

Quote:
Originally Posted by Koreadars View Post
In fact it's correct, but not the same.

pawn Code:
enum{
    Rules,
    Help2,
}
- The ID begins with 0. Not with 900, like you want here:
pawn Code:
#define dialog_rules 900
#define dialog_help 901

But what you can do to make it the same is:
pawn Code:
enum{
    Rules = 900,
    Help2,
}
I knew that but I knew the two ways I asked nomas about define 900 rules I put that number so that there was no problem with id dialog
Realmente I want to put a simple identification will not be used in OnDialogResponse .. it will only be used with command. Can you use enum without numbers?

so
enum
{
DIALOG_RULES,
DIALOG_HELP
}
DEFINE RULES 900
DEFINE HELP 901
nbx2000 is offline   Reply With Quote
Old 11/06/2019, 09:50 AM   #8
Koreadars
Big Clucker
 
Join Date: Mar 2019
Location: Czech Republic, Prdelákov.
Posts: 127
Reputation: 6
Default Re: ShowPlayerDialog ID NECESSARY?

Yes, you can. But without numbers the values are: 0, 1, 2...
Koreadars 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
[Ajuda] ShowPlayerDialog unamed Português/Portuguese 3 17/09/2013 06:58 PM
ShowPlayerDialog Kudoz Scripting Help 12 25/01/2013 07:53 AM
ShowPlayerDialog Help Please! nateykurgan Help Archive 7 31/03/2011 09:07 PM
ShowPlayerDialog help FrankC Help Archive 14 24/09/2010 07:03 PM


All times are GMT. The time now is 08:59 PM.


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