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

Sooo, after searching in every single thread that talked about this, I wasn't able to fix my problem. I'm trying to convert my single-car personal vehicle system to a multi-car one however it just does not work.
Error codes:
Код:
D:\Scripting\SAMP\Stunt\gamemodes\Stunt.pwn(3922) : error 028: invalid subscript (not an array or too many subscripts): "CarID"
D:\Scripting\SAMP\Stunt\gamemodes\Stunt.pwn(3922) : warning 215: expression has no effect
D:\Scripting\SAMP\Stunt\gamemodes\Stunt.pwn(3922) : error 001: expected token: ";", but found "]"
D:\Scripting\SAMP\Stunt\gamemodes\Stunt.pwn(3922) : error 029: invalid expression, assumed zero
D:\Scripting\SAMP\Stunt\gamemodes\Stunt.pwn(3922) : fatal error 107: too many error messages on one line

Compilation aborted.Pawn compiler 3.2.3664	 	 	Copyright © 1997-2006, ITB CompuPhase


4 Errors.
Here's the enum:
pawn Код:
enum playerData
{
    ID,
    Password[160],
    IP,
    Admin,
    Score,
    Money,
    Coins,
    Banned,
    MuteSeconds,
    Primarydrconpass[160],
    Secondarydrconpass[160],
    VIP,
    Hours,
    Minutes,
    Kills,
    Deaths,
    BanExp,
    BanM,
    BanY,
    BanHour,
    BanMin,
    VipExp,
    VipM,
    VipY,
    VipHour,
    VipMin,
    pRespect,
    nRespect,
    BestKillingSpree,
    DriftPoints,
    StuntPoints,
    RacePoints,
    HouseID,
    BusinessID,
    NoteID,
    ClanID,
    C4,
    Primaryorconpass[160],
    Secondaryorconpass[160],
    HouseExp,
    HouseM,
    HouseY,
    HouseHour,
    HouseMin,
    bool:WeaponSlots[MAX_WEAPONS],
    WeaponDepositID,
    Email[70],
    CarID[MAX_VEHICLES_PER_PLAYER],
};
new pInfo[MAX_PLAYERS][playerData];
And here's the faulty code (line 3922):
pawn Код:
pInfo[plid][CarID[vslot]]=carid;
Also, MAX_VEHICLES_PER_PLAYER is defined to 20, if it helps at all.
Thanks
Reply
#2

Код:
pInfo[plid][CarID][vslot]=carid;
Reply
#3

pawn Код:
pInfo[plid][CarID][vslot]=carid;
EDIT: late
Reply
#4

Quote:
Originally Posted by Yashas
Посмотреть сообщение
Код:
pInfo[plid][CarID][vslot]=carid;
Quote:
Originally Posted by Konstantinos
Посмотреть сообщение
pawn Код:
pInfo[plid][CarID][vslot]=carid;
Wow, I didn't expect such quick replies
I totally forgot about that, thanks to both of you for pointing it out
Reply
#5

Shouldn't this code:

pawn Код:
CarID[MAX_VEHICLES_PER_PLAYER],
doesn't have ","?

It's located In:
pawn Код:
enum playerData
{
    ID,
    Password[160],
    IP,
    Admin,
    Score,
    Money,
    Coins,
    Banned,
    MuteSeconds,
    Primarydrconpass[160],
    Secondarydrconpass[160],
    VIP,
    Hours,
    Minutes,
    Kills,
    Deaths,
    BanExp,
    BanM,
    BanY,
    BanHour,
    BanMin,
    VipExp,
    VipM,
    VipY,
    VipHour,
    VipMin,
    pRespect,
    nRespect,
    BestKillingSpree,
    DriftPoints,
    StuntPoints,
    RacePoints,
    HouseID,
    BusinessID,
    NoteID,
    ClanID,
    C4,
    Primaryorconpass[160],
    Secondaryorconpass[160],
    HouseExp,
    HouseM,
    HouseY,
    HouseHour,
    HouseMin,
    bool:WeaponSlots[MAX_WEAPONS],
    WeaponDepositID,
    Email[70],
    CarID[MAX_VEHICLES_PER_PLAYER],
};
new pInfo[MAX_PLAYERS][playerData];
It should be:
pawn Код:
CarID[MAX_VEHICLES_PER_PLAYER]
Reply
#6

Quote:
Originally Posted by Youssef221
Посмотреть сообщение
Shouldn't this code:

pawn Код:
CarID[MAX_VEHICLES_PER_PLAYER],
doesn't have ","?

It's located In:
pawn Код:
enum playerData
{
    ID,
    Password[160],
    IP,
    Admin,
    Score,
    Money,
    Coins,
    Banned,
    MuteSeconds,
    Primarydrconpass[160],
    Secondarydrconpass[160],
    VIP,
    Hours,
    Minutes,
    Kills,
    Deaths,
    BanExp,
    BanM,
    BanY,
    BanHour,
    BanMin,
    VipExp,
    VipM,
    VipY,
    VipHour,
    VipMin,
    pRespect,
    nRespect,
    BestKillingSpree,
    DriftPoints,
    StuntPoints,
    RacePoints,
    HouseID,
    BusinessID,
    NoteID,
    ClanID,
    C4,
    Primaryorconpass[160],
    Secondaryorconpass[160],
    HouseExp,
    HouseM,
    HouseY,
    HouseHour,
    HouseMin,
    bool:WeaponSlots[MAX_WEAPONS],
    WeaponDepositID,
    Email[70],
    CarID[MAX_VEHICLES_PER_PLAYER],
};
new pInfo[MAX_PLAYERS][playerData];
It should be:
pawn Код:
CarID[MAX_VEHICLES_PER_PLAYER]
I put ; after }, so it should work just fine.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)