Enum for all dialogs? Instead of ids?
#1

Hello,

Im sick of all these IDs and defining them is also a pain in the ass. So I was wondering, if I could make a enum with names only? and use that as reference?

Is that good as the other methods?
Reply
#2

pawn Код:
enum eDialogs
{
    diagAuthentication,
    diagRegistration,
    diagRegConfirmation,
    diagReportLog,
    diagCMDS,
    diagACMDS
};
You can basically just add to the enum and use the define straight away. So if I wanted to add a new dialog, diagHelp, I would just add "diagHelp" under "diagACMDS" and I can immediately start using diagHelp w/o dealing with any dialog numbers.
Reply
#3

pawn Код:
enum {
    D_LOGIN,
    D_REGISTER
}
//Which is in this case equivalent to:
#define D_LOGIN         0
#define D_REGISTER  1
Wiki shows usage of enums as well: https://sampwiki.blast.hk/wiki/ShowPlayerDialog

Check out this thread about enums for more info:
https://sampforum.blast.hk/showthread.php?tid=318307
Reply
#4

No, bad...
Код:
enum (+= 1) {
d_none, // 0
d_login = 1, // 1
d_register // 2 (others +1)
};
Use:
Код:
// spd
ShowPlayerDialog (playerid, d_login, ...);
// or
if (dialogid == d_login) { }
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)