Code not working correctly? -
iLcke - 26.09.2012
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");
}
Re: Code not working correctly? -
MarTaTa - 26.09.2012
Well when you test it what's the problem ?
Re: Code not working correctly? -
iLcke - 26.09.2012
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.
Re: Code not working correctly? -
RedJohn - 26.09.2012
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");
}
Re: Code not working correctly? -
iLcke - 26.09.2012
Adding that one little bracket actually gives me an error.
Quote:
error 029: invalid expression, assumed zero
|
Re: Code not working correctly? -
RedJohn - 26.09.2012
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;
Re: Code not working correctly? -
iLcke - 26.09.2012
The bracket you added, it winds up giving me that error.
iNumber is defined, it's fine.
Re: Code not working correctly? -
Rimeau - 26.09.2012
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"
Re: Code not working correctly? -
RedJohn - 26.09.2012
You have to set PlayerInfo[playerid][pAge]=iNumber; on DIALOG_TUT response.
Re: Code not working correctly? -
MarTaTa - 26.09.2012
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)