Array probs
#1

This:
Код:
public OnGameModeInit()
{
   new float:cfiaCor[MAX_PLAYERS][5];
   SetTimerEx("cfiaTimeUpdate", 60000, 1, "a", MAX_PLAYERS, cfiaCor);
}
And this:
Код:
1975 forward cfiaTimeUpdate(cfiaCor);
1976 public cfiaTimeUpdate(cfiaCor)
1977 {
1978   for(new i=0; i<MAX_PLAYERS; i++)
1979   {
1980     cfiaCor[i][0] = cfiaCor[i][3];
1981     cfiaCor[i][1] = cfiaCor[i][4];
1982     cfiaCor[i][2] = cfiaCor[i][5];
1983     
1984     new Float:tempx,Float:tempy,Float:tempz;
1985 	GetPlayerPos(playerid,tempx,tempy,tempz);
1986 	cfiaCor[i][3] = tempx;
1987 	cfiaCor[i][4] = tempy;
1988 	cfiaCor[i][5] = tempz;
1989   }
1990 }
is my code ... i get these errors:
Код:
C:\Documents and Settings\Rien\My Documents\Samp server 2\gamemodes\ronserver.pwn(1980) : error 028: invalid subscript (not an array or too many subscripts): "cfiaCor"
C:\Documents and Settings\Rien\My Documents\Samp server 2\gamemodes\ronserver.pwn(1980) : warning 215: expression has no effect
C:\Documents and Settings\Rien\My Documents\Samp server 2\gamemodes\ronserver.pwn(1980) : error 001: expected token: ";", but found "]"
C:\Documents and Settings\Rien\My Documents\Samp server 2\gamemodes\ronserver.pwn(1980) : error 029: invalid expression, assumed zero
C:\Documents and Settings\Rien\My Documents\Samp server 2\gamemodes\ronserver.pwn(1980) : fatal error 107: too many error messages on one line
alright peeps, this sounds stupid ("this is my code and these are my errors") but djeez pawno got some issues with arrays or something??

I can't get it right here, i've tried 3D arrays ... etc. lot's of thing but nothing would change any of my errors, any advanced scripter between the readers here? i hope u can help me out!

Greetzz
Reply
#2

You should check the wiki for variable use.

new variable[5]; That means there are now 5 variables named 'variable'.
'0' counts as one of them, so only these exist:
variable[0]
variable[1]
variable[2]
variable[3]
variable[4]


that's 5 variables."cfiaCor[i][5] = tempz;" is not possible if "new float:cfiaCor[MAX_PLAYERS][5];" is done.
Reply
#3

I changed

Код:
new float:cfiaCor[MAX_PLAYERS][5];
into
Код:
new float:cfiaCor[MAX_PLAYERS][6];
nothing solved

Greetz Rizzy
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)