error 001: expected token: ";", but found ")"
#1

Errors:
PHP код:
warning 211possibly unintended assignment
error 022
must be lvalue (non-constant)
warning 215expression has no effect
error 001
expected token";"but found ")"
error 029invalid expressionassumed zero
fatal error 107
too many error messages on one line 
Script:
PHP код:
    if(RPJS(playeridstrval(params)) < 50left 50 RPJS(playeridstrval(params));
    else if(
RPJS(playeridstrval(params)) < 100left 100 RPJS(playeridstrval(params));
    else if(
RPJS(playeridstrval(params)) < 150left 150 RPJS(playeridstrval(params));
    else if(
RPJS(playeridstrval(params)) < 200left 200 RPJS(playeridstrval(params));
    else if(
RPJS(playeridstrval(params)) = 200left 0
Error line:Last line
Reply
#2

Maybe because, You just made, the " 200 " RPGJS 2 times?
Reply
#3

You have too many brackets in some places.
Also:
pawn Код:
else if(RPJS(playerid, strval(params)) = 200) left = 0;
Should be:
pawn Код:
else if(RPJS(playerid, strval(params)) == 200) left = 0;

EDIT: actually, your brackets look OK to me though.
Reply
#4

pawn Код:
new
    amount = RPJS(playerid, strval(params);

switch (amount)
{
    case 0 .. 49: left = 50 - amount);
    case 50 .. 99: left = 100 - amount);
    case 100 ... 149: left = 150 - amount);
    case 150 .. 199: left = 200 - amount);
    case 200: left = 0;
}
Reply
#5

Quote:
Originally Posted by Konstantinos
Посмотреть сообщение
pawn Код:
new
    amount = RPJS(playerid, strval(params);

switch (amount)
{
    case 0 .. 49: left = 50 - amount);
    case 50 .. 99: left = 100 - amount);
    case 100 ... 149: left = 150 - amount);
    case 150 .. 199: left = 200 - amount);
    case 200: left = 0;
}
What ?
Reply
#6

I used switch because it's faster than using if/else if statements. You also don't need to call RPJS so many times.

I forgot to remove the close parenthesis though:
pawn Код:
new
    amount = RPJS(playerid, strval(params);

switch (amount)
{
    case 0 .. 49: left = 50 - amount;
    case 50 .. 99: left = 100 - amount;
    case 100 ... 149: left = 150 - amount;
    case 150 .. 199: left = 200 - amount;
    case 200: left = 0;
}
Reply


Forum Jump:


Users browsing this thread: 2 Guest(s)