invalid subscript (not an array or too many subscripts) error
#1

Hello, I thought it's possible to do something like that:

Код:
enum map
{
	name[128],
	played,
	likes,
	Float:racer_x[4], Float:racer_y[4], Float:racer_z[4], Float:racer_h[4], // 4 positions for racer
	Float:cop_x[4], Float:cop_y[4], Float:cop_z[4], Float:cop_h[4] // 4 positions for cop
};
new MapI[MAX_MAPS][map];
Код:
				mysql_get_field("position_id", str);
				position_id = strval(str);

				mysql_get_field("x", str);
				MapI[map_id][racer_x[position_id]] = floatstr(str);

				mysql_get_field("y", str);
				MapI[map_id][racer_y[position_id]] = floatstr(str);

				mysql_get_field("z", str);
				MapI[map_id][racer_z[position_id]] = floatstr(str);

				mysql_get_field("heading", str);
				MapI[map_id][racer_h[position_id]] = floatstr(str);
But, I'm getting an error:
Код:
: error 028: invalid subscript (not an array or too many subscripts): "racer_h"
Is there any other way to store x,y,z,heading (4 positions per map) for each map, without making new variables like pos_x_1, pos_x_2 and etc? My array for positions isn't working. :S
Reply
#2

pawn Код:
mysql_get_field("position_id", str);
position_id = strval(str);

mysql_get_field("x", str);
MapI[map_id][racer_x][position_id] = floatstr(str);

mysql_get_field("y", str);
MapI[map_id][racer_y][position_id] = floatstr(str);

mysql_get_field("z", str);
MapI[map_id][racer_z][position_id] = floatstr(str);

mysql_get_field("heading", str);
MapI[map_id][racer_h][position_id] = floatstr(str);
Reply
#3

Oh damn, of course!
Thank you.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)