A litthe problem - 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: A litthe problem (
/showthread.php?tid=617258)
A litthe problem -
radiobizza - 18.09.2016
Hi. Can you help me with this little code please?
Errors:
PHP код:
(7644) : error 001: expected token: ")", but found ";"
(7656) : error 001: expected token: "]", but found ";"
(7660) : error 001: expected token: ")", but found "["
(7660) : error 029: invalid expression, assumed zero
(7660) : warning 215: expression has no effect
(7660) : error 001: expected token: ";", but found "]"
(7660) : fatal error 107: too many error messages on one line
Compilation aborted.Pawn compiler 3.2.3664 Copyright (c) 1997-2006, ITB CompuPhase
6 Errors.
PHP код:
#define MAX_AI 50
new Iterator:AIIterator<MAX_AI> //line 7644
enum aiEnum {
refID=-1,
targetID=-1,
targetType,
playerFirst,
attackType,
Team,
Paused,
DOD=1
};
static AI_NPCS[MAX_AI][aiEnum]; //7656 line
static AI_Active = 0;
static GetIDByRef(referenceID) {
foreach(new id : AIIterator) { if (AI_NPCS[id][refID] == id) return id; } //7660 line
return -1;
}
static GetRefByID(id) { return AI_NPCS[id][refID]; }
Re: A litthe problem -
Konstantinos - 18.09.2016
Items in enumarators are constants, not what value should have by default. Setting them as -1 will give error 032: array index out of bounds (variable "AI_NPCS").
You forgot to end the line 7644 with a semicolon ;
Re: A litthe problem -
radiobizza - 18.09.2016
Quote:
Originally Posted by Konstantinos
Items in enumarators are constants, not what value should have by default. Setting them as -1 will give error 032: array index out of bounds (variable "AI_NPCS").
You forgot to end the line 7644 with a semicolon ;
|
same error on line 7644. And what can I do to the others line ?
Re: A litthe problem -
SyS - 18.09.2016
Konstantinos told you add semicolon...how can that give same error while doing that?
Код:
new Iterator:AIIterator<MAX_AI> ;
Re: A litthe problem -
Konstantinos - 18.09.2016
I reproduce the errors most of the times but that would give that expected ";" but found "enum". Some of the macros in foreach are messed up. Update
foreach or
y_iterate (YSI).
You might as well check your function because
referenceID is never used.
Re: A litthe problem -
radiobizza - 18.09.2016
But..What can I do ? Can you tell me more please?
Re: A litthe problem -
Konstantinos - 18.09.2016
The first thing you have to do is to update foreach or YSI for y_iterate (depending on which one you are using). I have the links above.
I can't tell much as you don't provide more info as well on what you changed, what the results etc.