error 028: invalid subscript (not an array or too many subscripts): "carData"
#1

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);
	}
Reply
#2

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

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

Remove the ; after }
Reply
#5

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

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

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);
	}
Reply
#8

BUMP
Reply
#9

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
Reply
#10

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];
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)