error 033: array must be indexed (variable "CP")
#1

Hello, anyone can help me to fix this? I need your help please, thanks!


ERROR notice when i compile the gamemodes

Код:
C:\Users\pc-01\Desktop\Roleplay\gamemodes\Roleplay.pwn(35310) : error 033: array must be indexed (variable "CP")
This is the error script on line 35310
PHP код:
BlackMarketInfo[NewBPID][CP] = CreateDynamicCP(BlackMarketInfo[NewBPID][BPX], BlackMarketInfo[NewBPID][BPY],BlackMarketInfo[NewBPID][BPZ], 200, -18.0); 
And this the full Create Blackmarket script
PHP код:
CMD:createbp(playeridparams[])
{
    new 
string[128];
    if(
PlayerInfo[playerid][pAdmin] >= 99999)
     {
        new 
NewBPID SpawnedBlackMarket+1;
        if(
NewBPID >= MAX_BLACKMARKET)
        {
            
SendClientMessageExplayeridCOLOR_WHITE"Too many MPs are currently spawned!");
        }
        new 
Float:xFloat:yFloat:z;
        
GetPlayerPos(playeridxyz);
        
formatstringsizeof( string ), "Black Market/BP_%d.ini"NewBPID);
        if(
dini_Exists(string))
        {
            
SpawnedBlackMarket++;
             
formatstringsizeof( string ), "Map (ID: %d) already exist!"NewBPID);
               
SendClientMessageExplayeridCOLOR_GREYstring);
             
SendClientMessageExplayeridCOLOR_YELLOW"Please try again by typing /createbp complete" );
           }
        else
           {
               new 
bex[128];
               
BlackMarketInfo[NewBPID][BPX] = x;
            
BlackMarketInfo[NewBPID][BPY] = y;
            
BlackMarketInfo[NewBPID][BPZ] = z;
            
dini_Create(string);
               for(new 
cMAX_BMITEMSc++)
            {
                
BMItemsInfo[NewBPID][c][Price] = 0;
                
BMItemsInfo[NewBPID][c][ExDate] = 999;
                
BMItemsInfo[NewBPID][c][ExYear] = 9999;
                
BMItemsInfo[NewBPID][c][GunAmmo] = 0;
                
BMItemsInfo[NewBPID][c][GunID] = 0;
                
format(BMItemsInfo[NewBPID][c][Owner], 255"None");
                
format(bexsizeof(bex), "Price%d"c);
                
dini_Set(stringbexBMItemsInfo[NewBPID][c][Price]);
                
format(bexsizeof(bex), "Date%d"c);
                
dini_Set(stringbexBMItemsInfo[NewBPID][c][ExDate]);
                
format(bexsizeof(bex), "Year%d"c);
                
dini_Set(stringbexBMItemsInfo[NewBPID][c][ExYear]);
                
format(bexsizeof(bex), "GunID%d"c);
                
dini_Set(stringbexBMItemsInfo[NewBPID][c][GunID]);
                
format(bexsizeof(bex), "GunAmmo%d"c);
                
dini_Set(stringbexBMItemsInfo[NewBPID][c][GunAmmo]);
                
format(bexsizeof(bex), "Owner%d"c);
                
dini_Set(stringbexBMItemsInfo[NewBPID][c][Owner]);
            }
            
dini_FloatSetstring"X"BlackMarketInfo[NewBPID][BPX]);
            
dini_FloatSetstring"Y"BlackMarketInfo[NewBPID][BPY]);
            
dini_FloatSetstring"Z"BlackMarketInfo[NewBPID][BPZ]);
            
SpawnedBlackMarket++;
            
format(stringsizeof(string), "{FFFF00}[Black Market ID %d]\n{FFFFFF}/blackmarket untuk membuka opsi"NewBPID);
            
blackmarket[NewBPID] = CreateStreamed3DTextLabel(stringCOLOR_GREENBlackMarketInfo[NewBPID][BPX], BlackMarketInfo[NewBPID][BPY], BlackMarketInfo[NewBPID][BPZ], 10.00);
               
SendClientMessageExplayeridCOLOR_LIGHTBLUE"Black Market berhasil dibuat!" );
            
BlackMarketInfo[NewBPID][Pickup] = CreateDynamicPickup(123923BlackMarketInfo[NewBPID][BPX], BlackMarketInfo[NewBPID][BPY], BlackMarketInfo[NewBPID][BPZ], -1, -1, -110.0);
            
BlackMarketInfo[NewBPID][CP] = CreateDynamicCP(BlackMarketInfo[NewBPID][BPX], BlackMarketInfo[NewBPID][BPY],BlackMarketInfo[NewBPID][BPZ], 200, -18.0);
            
format(stringsizeof( string ), "ID Black Market baru: %d."NewBPID);
            
SendClientMessageEx(playeridCOLOR_WHITEstring);
        }
    }
     else
    {
        
SendClientMessageExplayeridCOLOR_GREY"You are not authorized to use this command!" );
    }
    return 
1;

Reply
#2

Post up how you created CP.


The line with
Код:
new CP.........
Reply
#3

Код:
new CP[MAX_PLAYERS];
Reply
#4

Is that in the BlackMarket enum, or on it's own?

If it's on its own, you should use another name for that one, and go through and change the CP references which aren't part of this section, or the enum.


It's almost like you've made one syatem, then added another and used the same variable names without thinking.
Reply
#5

if its
pawn Код:
new CP[MAX_PLAYERS];
Use
pawn Код:
BlackMarketInfo[NewBPID][CP][playerid]
but its not a Um good practice. add the CP option inside BlackMarket enum as Sew_Sumi said and remove the different CP variable.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)