Error 032
#1

pawn Код:
enum cInfo
{
    Trucker,
    Delivery,
    Pilot,
    Farmer,
    Police,
    RoadWorker,
    Busdriver,
    Traindriver,
    Mafia
}
new PClass[200][cInfo];
pawn Код:
case 0,1,2,3:
        {
            GameTextForPlayer(playerid, "~r~Trucker", 2000, 5);
            SetPlayerInterior(playerid,14);
            SetPlayerPos(playerid,258.4893,-41.4008,1002.0234);
            SetPlayerFacingAngle(playerid, 90.0);
            SetPlayerCameraPos(playerid,256.0815,-43.0475,1003.0234);
            SetPlayerCameraLookAt(playerid,258.4893,-41.4008,1002.0234);
            PlayerPlaySound(playerid,SOUND_MUSIC1,258.4893,-41.4008,1002.0234);
           
            PClass[playerid][cInfo] = Trucker; // This Gives Me error
        }
pawn Код:
C:\Users\carlo\Desktop\SA-MP Server\My Own Trucking\gamemodes\public.pwn(247) : error 032: array index out of bounds (variable "PClass")
REP+
Reply
#2

use MAX_PLAYERS instead of 200 in the declaration of PClass

pawn Код:
new PClass[ MAX_PLAYERS ][ cInfo ];
Reply
#3

Not sure but why don't you just use
pawn Код:
new PClass[MAX_PLAYERS][cInfo];
instead of
pawn Код:
new PClass[200][cInfo];
EDIT: Sorry for double posting i didn't see "LarzI's" post.
Reply
#4

Same Error
Reply
#5

What is this?
pawn Код:
PClass[playerid][cInfo] = Trucker;
It shouldn't be the cInfo there.
pawn Код:
PClass[playerid][Trucker] = value;
Reply
#6

Oh, okay. cInfo is the enum containing all the values like "Trucker". I'm not sure why you do it this way, but the "fix" would be doing this:
pawn Код:
PClass[ playerid ][ Trucker ] = 1;
Although it would be easier if you removed the enum and rather just made macros for class IDs, then using a variable like this one:
pawn Код:
new PClass[ MAX_PLAYERS ];
The macros would be something like this:
pawn Код:
#define TRUCKER (0) //trucker is ID 0
#define DELIVERY (1) //delivery is ID 1
#define PILOT (2)
#define FARMER (3)
#define POLICE (4)
#define ROADWORKER (5)
#define BUSDRIVER (6)
#define TRAINDRIVER (7)
#define MAFIA (8)
You could then set the variable to, e.g. MAFIA, like so:
pawn Код:
PClass[ playerid ] = MAFIA;
//the playerclass is now set to MAFIA - which is a macro for "8" - aka ID 8.
Reply
#7

Quote:
Originally Posted by Dwane
Посмотреть сообщение
What is this?
pawn Код:
PClass[playerid][cInfo] = Trucker;
It shouldn't be the cInfo there.
pawn Код:
PClass[playerid][Trucker] = value;
pawn Код:
C:\Users\carlo\Desktop\SA-MP Server\My Own Trucking\gamemodes\public.pwn(246) : error 017: undefined symbol "value"
Reply
#8

Quote:
Originally Posted by windrush
Посмотреть сообщение
pawn Код:
C:\Users\carlo\Desktop\SA-MP Server\My Own Trucking\gamemodes\public.pwn(246) : error 017: undefined symbol "value"
It is supposed value is a number. I am not sure what do you want to do and I didn't add a number and make you confused.

Change value to the number you want. For example, if you want to set Trucket to 1, then change value to 1.
Reply
#9

Fixed!! Tnx Dwane Rep+
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)