Code not working correctly?
#1

This doesn't seem to work as I thought it would, anyone got any ideas?

pawn Код:
if (iNumber <= 12 && iNumber >= 100)
    {
    format(tut, sizeof(tut), "Character Questions: %s.", plname);
    ShowPlayerDialog(playerid, DIALOG_TUT_3, DIALOG_STYLE_LIST, tut, "American\nAfrican American\nHispanic\nAsian", "Contiune", "Quit");
    PlayerInfo[playerid][pAge]=iNumber;
    }
    else
    format(tut, sizeof(tut), "Character Questions: %s.", plname);
    ShowPlayerDialog(playerid,DIALOG_TUT_2, DIALOG_STYLE_INPUT, tut, "You have to pick a age between 12 and 100.", "Contiune", "Cancel");
    }
Reply
#2

Well when you test it what's the problem ?
Reply
#3

I haven't been scripting in awhile, so I'm not sure if I am doing it correctly.

If someone puts in a number lower than twelve, or higher than a 100 in the dialog, it should go towards the bottom and tell them to pick a number between 12-100. After they pick the number 12-100, there age gets set to the number they've choosen.
Reply
#4

pawn Код:
if(iNumber <= 12 || iNumber >= 100)
{
    format(tut, sizeof(tut), "Character Questions: %s.", plname);
    ShowPlayerDialog(playerid, DIALOG_TUT_3, DIALOG_STYLE_LIST, tut, "American\nAfrican American\nHispanic\nAsian", "Contiune", "Quit");
    PlayerInfo[playerid][pAge]=iNumber;
}
else
{
    format(tut, sizeof(tut), "Character Questions: %s.", plname);
    ShowPlayerDialog(playerid,DIALOG_TUT_2, DIALOG_STYLE_INPUT, tut, "You have to pick a age between 12 and 100.", "Contiune", "Cancel");
}
Reply
#5

Adding that one little bracket actually gives me an error.
Quote:

error 029: invalid expression, assumed zero

Reply
#6

Quote:
Originally Posted by iLcke
Посмотреть сообщение
Adding that one little bracket actually gives me an error.
On which line?

I assumed on this: PlayerInfo[playerid][pAge]=iNumber;
Reply
#7

The bracket you added, it winds up giving me that error.
iNumber is defined, it's fine.
Reply
#8

This is never true:

pawn Код:
if (iNumber <= 12 && iNumber >= 100)
It would be true if iNumber was smaller than 13 AND bigger than 99 at the same time. Instead of &&, use ||

Btw, it's "an age"
Reply
#9

You have to set PlayerInfo[playerid][pAge]=iNumber; on DIALOG_TUT response.
Reply
#10

Quote:
Originally Posted by Rimeau
Посмотреть сообщение
This is never true:

pawn Код:
if (iNumber <= 12 && iNumber >= 100)
It would be true if iNumber was smaller than 13 AND bigger than 99 at the same time. Instead of &&, use ||

Btw, it's "an age"
What he said you need to use
pawn Код:
if(iNumber <= 12 || iNumber >= 100)
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)