SA-MP Forums Archive
array index out of bounds - 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: array index out of bounds (/showthread.php?tid=402569)



array index out of bounds - raddetine - 27.12.2012

pawn erors:

Код:
../Stocks/Stocks.pwn(188) : error 032: array index out of bounds (variable "TDString")
../Stocks/Stocks.pwn(194) : error 032: array index out of bounds (variable "TDString")
../Stocks/Stocks.pwn(206) : error 032: array index out of bounds (variable "TDString")
../Stocks/Stocks.pwn(212) : error 032: array index out of bounds (variable "TDString")
Pawn compiler 3.2.3664	 	 	Copyright © 1997-2006, ITB CompuPhase


4 Errors.
pawno lines:
188-194
Код:
	format( TDString[ 0 ], 256*3, "~r~~h~%s~l~( ~g~~h~ID:~w~%d~l~ ) ~w~has ~g~~h~Joined", PlayerName2(playerid), playerid);
	} else {
	format( TDString[ 3 ], 256*3, "%s", TDString[ 2 ] );
	format( TDString[ 2 ], 256*3, "%s", TDString[ 1 ] );
	format( TDString[ 1 ], 256*3, "%s", TDString[ 0 ] );
	format( TDString[ 0 ], 256*3, "~r~~h~%s~l~( ~g~~h~ID:~w~%d~l~ ) ~w~has ~g~~h~Joined", PlayerName2(playerid), playerid);
	}
	new str[ 256*3 ];
	format( str, sizeof( str ), "%s~n~%s~n~%s~n~%s", TDString[ 0 ], TDString[ 1 ], TDString[ 2 ], TDString[ 3 ] );
206 - 212

Код:
	format( TDString[ 3 ], 256*3, "%s", TDString[ 2 ] );
	format( TDString[ 2 ], 256*3, "%s", TDString[ 1 ] );
	format( TDString[ 1 ], 256*3, "%s", TDString[ 0 ] );
	format( TDString[ 0 ], 256*3, "~r~~h~%s~l~( ~g~~h~ID:~w~%d~l~ ) ~w~has ~p~Leaved", PlayerName2(playerid), playerid);
	}
	new str[ 256*3 ];
	format( str, sizeof( str ), "%s~n~%s~n~%s~n~%s", TDString[ 0 ], TDString[ 1 ], TDString[ 2 ], TDString[ 3 ] );
and TDString :
Код:
new TDString[3][180];
Any ideas?


Re: array index out of bounds - Konstantinos - 27.12.2012

Just use strcat, you don't need a string with 3 arrays more.