Dialog Error
#1

So I've tried to add in a dialog message for registering age and I can't understand why I'm getting an error.

The code is
PHP код:
1   if(dialogid == 51//Age
2   {
3        if(!response)
4        {
5            Kick(playerid);
6        }
7        else
8        {
9            new age strval(inputtext);
10          if(age 18 || age 99) return SendClientMessage(playeridCOLOR_GREY"SERVER: Age must be between 18 and 99");
11            {
12                DisplayDialogForPlayer(playerid51);
13            }
14            else
15            {
16                new string[128];
17                PlayerInfo[playerid][pAge] = age;
18                format(stringsizeof(string), "SERVER: You've set your character's age to %d"PlayerInfo[playerid][pAge]);
19                SendClientMessage(playeridCOLOR_GREYstring);
20            }
21        }
22        return 1;
23    
And the error message is:
Код:
C:(6902) : error 029: invalid expression, assumed zero
Which is line 14 above, - "else"

Anyone have any idea why this error is appearing?
Reply
#2

Try this one
pawn Код:
if(dialogid == 51) //Age
{
      if(!response)
      {
            Kick(playerid);
      }
      else
      {
         new string[128];
         new age = strval(inputtext);
         if(age < 18 || age > 99)
         {
             DisplayDialogForPlayer(playerid, 51);
             SendClientMessage(playerid, COLOR_GREY, "SERVER: Age must be between 18 and 99");
             return 1;
         }
         PlayerInfo[playerid][pAge] = age;
         format(string, sizeof(string), "SERVER: You've set your character's age to %d", PlayerInfo[playerid][pAge]);
         SendClientMessage(playerid, COLOR_GREY, string);
      }
      return 1;
}
Reply
#3

Worked, thank you!
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)