SA-MP Forums Archive
error 028: invalid subscript (not an array or too many subscripts): "carData" - 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: error 028: invalid subscript (not an array or too many subscripts): "carData" (/showthread.php?tid=595328)



error 028: invalid subscript (not an array or too many subscripts): "carData" - ervinmasic - 01.12.2015

I have this errors, i want when player join in car to list player name of owner and name of car. Sorry for my bad English.



Errors:
Код:
(19812) : error 028: invalid subscript (not an array or too many subscripts): "carData"
(19812) : error 001: expected token: ";", but found "]"
(19812) : error 029: invalid expression, assumed zero
(19812) : fatal error 107: too many error messages on one line
Enum carData:
Код:
enum carData {
	carID,
	carExists,
	carModel,
	carOwner,
	Float:carPos[4],
	carColor1,
	carColor2,
	carPaintjob,
	carLocked,
	carMods[14],
	carImpounded,
	carImpoundPrice,
	carFaction,
	carWeapons[5],
	carAmmo[5],
	carVehicle
};
Script (OnPlayerStateChange):
Код:
if(Car_IsOwner(vehicleid))
	{
      new vehicle[24];
	  new string[32];
	  GetVehicleModel(vehicleid, vehicle, sizeof(vehicle));
      format(string,sizeof(string),"You enter in car %s (%d)   Car Owner: %s",vehicle, vehicleid, carData[vehicleid][carOwner]);
      SCM(playerid, COLOR_YELLOW, string);
	}



Re: error 028: invalid subscript (not an array or too many subscripts): "carData" - Jefff - 01.12.2015

pawn Код:
enum carData {
    carID,
    carExists,
    carModel,
    carOwner[MAX_PLAYER_NAME],
    Float:carPos[4],
    carColor1,
    carColor2,
    carPaintjob,
    carLocked,
    carMods[14],
    carImpounded,
    carImpoundPrice,
    carFaction,
    carWeapons[5],
    carAmmo[5],
    carVehicle
};

new CarInfo[MAX_VEHICLES][carData];
then you can use CarInfo[vehicleid][carOwner]


Re: error 028: invalid subscript (not an array or too many subscripts): "carData" - ervinmasic - 01.12.2015

Now i have problems, when i connect to server, server crash down
This is log
Код:
[17:38:48] [debug] Server crashed while executing roleplay.amx 
[17:38:48] [debug] AMX backtrace: 
[17:38:48] [debug] #0 00000014 in public OnPlayerStateChange () from roleplay.amx 
[17:38:48] [debug] Native backtrace: 
[17:38:48] [debug] #0 6c1d75d2 in ?? () from C:\Services\RS_SERVERS\3012\plugins\crashdetect.dll 
[17:38:48] [debug] #1 6c1cff6f in ?? () from C:\Services\RS_SERVERS\3012\plugins\crashdetect.dll 
[17:38:48] [debug] #2 6c1d5f7a in ?? () from C:\Services\RS_SERVERS\3012\plugins\crashdetect.dll 
[17:38:48] [debug] #3 0046dff9 in ?? () from C:\Services\RS_SERVERS\3012\samp-server.exe 
[17:38:48] [debug] #4 00482d57 in ?? () from C:\Services\RS_SERVERS\3012\samp-server.exe



Re: error 028: invalid subscript (not an array or too many subscripts): "carData" - UltraScripter - 01.12.2015

Remove the ; after }


Re: error 028: invalid subscript (not an array or too many subscripts): "carData" - ervinmasic - 01.12.2015

Im put this:
Код:
enum carData {
	carID,
	carExists,
	carModel,
	carOwner[MAX_PLAYER_NAME],
	Float:carPos[4],
	carColor1,
	carColor2,
	carPaintjob,
	carLocked,
	carMods[14],
	carImpounded,
	carImpoundPrice,
	carFaction,
	carWeapons[5],
	carAmmo[5],
	carVehicle
}

new CarInfo[MAX_VEHICLES][carData];
And again same problem


Re: error 028: invalid subscript (not an array or too many subscripts): "carData" - Jefff - 01.12.2015

Your GetVehicleModel is wrong, see https://sampwiki.blast.hk/wiki/GetVehicleModel
+
https://github.com/Zeex/samp-plugin-...ith-debug-info
then show line on next crash


Re: error 028: invalid subscript (not an array or too many subscripts): "carData" - ervinmasic - 01.12.2015

With this script i have same problem
Код:
if(Car_IsOwner(vehicleid))
	{
      new vehicle[24];
	  new string[32];
	  
      format(string,sizeof(string),"Car Owner: %s", CarInfo[vehicleid][carOwner]);
      SCM(playerid, COLOR_YELLOW, string);
	}



Re: error 028: invalid subscript (not an array or too many subscripts): "carData" - ervinmasic - 03.12.2015

BUMP


Re: error 028: invalid subscript (not an array or too many subscripts): "carData" - CmZxC - 03.12.2015

In carData, you use "carOwner" has an integer, but in the format you use it as a string.

If you want to use carOwner as a name, define it as a string in the enum, by making it into
PHP код:
carOwner[MAX_PLAYER_NAME



Re: error 028: invalid subscript (not an array or too many subscripts): "carData" - ervinmasic - 03.12.2015

Its already defined
Код:
enum carData {
	carID,
	carExists,
	carModel,
	carOwner[MAX_PLAYER_NAME],
	Float:carPos[4],
	carColor1,
	carColor2,
	carPaintjob,
	carLocked,
	carMods[14],
	carImpounded,
	carImpoundPrice,
	carFaction,
	carWeapons[5],
	carAmmo[5],
	carVehicle
}

new CarInfo[MAX_VEHICLES][carData];