A litthe problem
#1

Hi. Can you help me with this little code please?
Errors:
PHP код:
(7644) : error 001expected token")"but found ";"
(7656) : error 001expected token"]"but found ";"
(7660) : error 001expected token")"but found "["
(7660) : error 029invalid expressionassumed zero
(7660) : warning 215expression has no effect
(7660) : error 001expected token";"but found "]"
(7660) : fatal error 107too many error messages on one line
Compilation aborted
.Pawn compiler 3.2.3664              Copyright (c1997-2006ITB 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=
};
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]; } 
Reply
#2

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 ;
Reply
#3

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 ?
Reply
#4

Konstantinos told you add semicolon...how can that give same error while doing that?
Код:
new Iterator:AIIterator<MAX_AI> ;
Reply
#5

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.
Reply
#6

But..What can I do ? Can you tell me more please?
Reply
#7

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.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)