SA-MP Forums

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

Reply
 
Thread Tools Display Modes
Old 09/08/2015, 10:23 AM   #1
sexybeast
Little Clucker
 
Join Date: Apr 2009
Posts: 27
Reputation: 0
Default Dialog Error

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 Code:
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:
Code:
C:(6902) : error 029: invalid expression, assumed zero
Which is line 14 above, - "else"

Anyone have any idea why this error is appearing?
sexybeast is offline   Reply With Quote
Old 09/08/2015, 10:28 AM   #2
IceBilizard
Gangsta
 
Join Date: Feb 2012
Posts: 864
Reputation: 44
Default Re: Dialog Error

Try this one
Code:
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;
}
__________________


IceBilizard is offline   Reply With Quote
Old 09/08/2015, 10:39 AM   #3
sexybeast
Little Clucker
 
Join Date: Apr 2009
Posts: 27
Reputation: 0
Default Re: Dialog Error

Worked, thank you!
sexybeast 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
[HELP]Dialog Error. TwingkiOYEE Scripting Help 3 22/06/2013 03:29 PM
Dialog error :S MagedXp Scripting Help 4 30/03/2013 01:27 PM
Dialog error, dialog does'nt show up. MathijsS Scripting Help 11 27/11/2011 06:28 PM
Trafipax error, crash te pawn, Dialog error? Finging Help Archive 1 21/06/2011 10:21 AM


All times are GMT. The time now is 08:04 AM.


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