enum expected token
#1

what iswrong here?

Код HTML:
enum
{
DIALOG_LOGIN,
DIALOG_REGISTER,
DIALOG_SEX,
DIALOG_AGE,
DIALOG_EMAIL
}
this enum have not name because i use on dialogresponse

ondialogresponse

switch(dialogid)
case DIALOG_LOGIN etc...


error 001: expected token: "-identifier-", but found "-integer value-"
Reply
#2

Nothing wrong with the enum itself. Show the surrounding code for OnDialogResponse.
Reply
#3

PHP код:
public OnDialogResponse(playeriddialogidresponselistiteminputtext[])
{
    static 
string[500],strong[1500],string2[120];
    static 
named[30];
    
GetPlayerName(playerid,named,sizeof(named));
    if(    
strfind(inputtext"%"true) != -1  ||
           
strfind(inputtext"'"true) != -||
           
strfind(inputtext"`"true) != -||
           
strfind(inputtext";"true) != -)
     {
        
SCM(playerid,COLOR_RED,"don't use this characters!");
        return 
0;
    }
     switch(
dialogid)
    {
        case 
DIALOG_LOGIN:
        { 
Reply
#4

so what is the problem?
Reply
#5

I think its because you are not setting the value of the dialogs (dialogids)

Try doing it like this:

Код:
enum dialogs
{
DIALOG_LOGIN,
DIALOG_REGISTER,
DIALOG_SEX,
DIALOG_AGE,
DIALOG_EMAIL
}

new DialogID[dialogs];

DialogID[DIALOG_LOGIN] = 1 /*Any unique id*/;
DialogID[DIALOG_REGISTER] = 2 /*Any unique id*/;
DialogID[DIALOG_SEX] = 3 /*Any unique id*/;
DialogID[DIALOG_AGE] = 4 /*Any unique id*/;
DialogID[DIALOG_EMAIL] = 5 /*Any unique id*/;
Reply
#6

Quote:
Originally Posted by K0P
Посмотреть сообщение
I think its because you are not setting the value of the dialogs (dialogids)

Try doing it like this:

Код:
enum dialogs
{
DIALOG_LOGIN,
DIALOG_REGISTER,
DIALOG_SEX,
DIALOG_AGE,
DIALOG_EMAIL
}

new DialogID[dialogs];

DialogID[DIALOG_LOGIN] = 1 /*Any unique id*/;
DialogID[DIALOG_REGISTER] = 2 /*Any unique id*/;
DialogID[DIALOG_SEX] = 3 /*Any unique id*/;
DialogID[DIALOG_AGE] = 4 /*Any unique id*/;
DialogID[DIALOG_EMAIL] = 5 /*Any unique id*/;
No need to set id''s because enum allready does that

DIALOG_LOGIN //= 0
DIALOG_REGISTER //= 1
...
Reply
#7

Quote:
Originally Posted by Deadpoop
Посмотреть сообщение
No need to set id''s because enum allready does that

DIALOG_LOGIN //= 0
DIALOG_REGISTER //= 1
...
What if you want to set the id to 100 or any other unique id to prevent dialog ids collision?
Read the post before commenting.Or take English learning classes if you can't understand basic sentences.

Quote:
Originally Posted by K0P
Посмотреть сообщение
/*Any unique id*/;
Reply
#8

Quote:
Originally Posted by K0P
Посмотреть сообщение
What if you want to set the id to 100 or any other unique id to prevent dialog ids collision?
Read the post before commenting.Or take English learning classes if you can't understand basic sentences.
You could just do enum { DIALOG_REGISTER = 100 }; then it'll increment.
Reply
#9

Search for "#define DIALOG_LOGIN .." in your script and remove it (where .. is a number).

Quote:
Originally Posted by K0P
Посмотреть сообщение
What if you want to set the id to 100 or any other unique id to prevent dialog ids collision?
Read the post before commenting.Or take English learning classes if you can't understand basic sentences.
Collisions have nothing to do with compiling and the error he gets.
Reply
#10

Quote:
Originally Posted by Konstantinos
Посмотреть сообщение
Search for "#define DIALOG_LOGIN .." in your script and remove it (where .. is a number).



Collisions have nothing to do with compiling and the error he gets.
But it has a bad effect on dialogs that have responses.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)