error 001: expected token: ";", but found ")" - Printable Version
+- SA-MP Forums Archive (
https://sampforum.blast.hk)
+-- Forum: SA-MP Scripting and Plugins (
https://sampforum.blast.hk/forumdisplay.php?fid=8)
+--- Forum: Scripting Help (
https://sampforum.blast.hk/forumdisplay.php?fid=12)
+--- Thread: error 001: expected token: ";", but found ")" (
/showthread.php?tid=511599)
error 001: expected token: ";", but found ")" -
SandKing94 - 06.05.2014
Errors:
PHP код:
warning 211: possibly unintended assignment
error 022: must be lvalue (non-constant)
warning 215: expression has no effect
error 001: expected token: ";", but found ")"
error 029: invalid expression, assumed zero
fatal error 107: too many error messages on one line
Script:
PHP код:
if(RPJS(playerid, strval(params)) < 50) left = 50 - RPJS(playerid, strval(params));
else if(RPJS(playerid, strval(params)) < 100) left = 100 - RPJS(playerid, strval(params));
else if(RPJS(playerid, strval(params)) < 150) left = 150 - RPJS(playerid, strval(params));
else if(RPJS(playerid, strval(params)) < 200) left = 200 - RPJS(playerid, strval(params));
else if(RPJS(playerid, strval(params)) = 200) left = 0;
Error line:Last line
Re: error 001: expected token: ";", but found ")" -
Ghazal - 06.05.2014
Maybe because, You just made, the " 200 " RPGJS 2 times?
Re: error 001: expected token: ";", but found ")" -
PrivatioBoni - 06.05.2014
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.
Re: error 001: expected token: ";", but found ")" -
Konstantinos - 06.05.2014
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;
}
Re: error 001: expected token: ";", but found ")" -
SandKing94 - 06.05.2014
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 ?
Re: error 001: expected token: ";", but found ")" -
Konstantinos - 06.05.2014
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;
}