What's wrong with this dialog?
#1

pawn Код:
if(dialogid == 1336)
    {
        if (response == 1)
        {
            if(!strcmp(inputtext > 0 || < 80))
        {
        PlayerInfo[playerid][pAge] = check;
        format(string, sizeof(string), "Okay, so you are %d years old.",PlayerInfo[playerid][pAge]);
        SendClientMessage(playerid, COLOR_WHITE, string);
        SendClientMessage(playerid, COLOR_WHITE, "Now that you've completed the questions, we'll take you to the tutorial.");
        RegistrationStep[playerid] = 0;
        CanTalk[playerid] = 1;
        TutTime[playerid] = 0;
        PlayerInfo[playerid][pSafeSpawn] = 1;
        PlayerInfo[playerid][pTut] = 1;
        gOoc[playerid] = 0; gNewbie[playerid] = 0; gNews[playerid] = 0; gFam[playerid] = 0;
        TogglePlayerControllable(playerid, 1);
        PlayerInfo[playerid][pHealth] = 100;
        PlayerInfo[playerid][pArmor] = 0;
        SetPlayerSpawn(playerid);
        PlayerInfo[playerid][pOrigin] = 1;
        TutTime[playerid] = 1;
        CanTalk[playerid] = 0;
        return 0;
        }
      else
        {
            ShowPlayerDialog(playerid, 1336, DIALOG_STYLE_INPUT, "How old are you?", "Input your age in years (18-80)", "Submit", "Cancel");
        }
      else
        {
        SendClientMessage(playerid, -1, "You have cancelled your registration.");
        Kick(playerid);
        }
        return 1;
       }
   return 0;
  }
Код:
(3394) : warning 213: tag mismatch
(3593) : error 033: array must be indexed (variable "inputtext")
(3593) : warning 215: expression has no effect
(3593) : error 001: expected token: ";", but found ")"
(3593) : error 029: invalid expression, assumed zero
Reply
#2

pawn Код:
new value =  strval(inputtext);
if(value  > 0 || value < 80)
{
}
You where trying to compare a variable to a string as inputtext is a string.
Reply
#3

Quote:
Originally Posted by [HiC]TheKiller
Посмотреть сообщение
pawn Код:
new value =  strval(inputtext);
if(value  > 0 || value < 80)
{
}
You where trying to compare a variable to a string as inputtext is a string.
Thankyou, it worked!

EDIT:

But I get invalid expression, assumed 0 on:
pawn Код:
else
        {
            ShowPlayerDialog(playerid, 1336, DIALOG_STYLE_INPUT, "How old are you?", "Input your age in years (18-80)", "Submit", "Cancel");
        }
      else
        {
        SendClientMessage(playerid, -1, "You have cancelled your registration.");
        Kick(playerid);
        }
The last "else".. D:
Reply
#4

You have to post the whole code. But try this ( attention at identation ):
PHP код:
    else
    {
        
ShowPlayerDialog(playerid1336DIALOG_STYLE_INPUT"How old are you?""Input your age in years (18-80)""Submit""Cancel");
    }
}
else
{
    
SendClientMessage(playerid, -1"You have cancelled your registration.");
    
Kick(playerid);

Reply
#5

Quote:
Originally Posted by [HiC]TheKiller
Посмотреть сообщение
pawn Код:
new value =  strval(inputtext);
if(value  > 0 || value < 80)
{
}
You where trying to compare a variable to a string as inputtext is a string.
Isn't it supposed to be:
pawn Код:
new value =  strval(inputtext);
if(value  > 0 && value < 80)
{
}
?

Because.. 999,500,100 is bigger than 0. And any negative is smaller than 80. This will make it wrong.
Replace the || with &&
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)