error 047: array sizes do not match, or destination array is too small
#1

I tried every single way around this error, it just doesn't want to work. I am trying to save a hex string in an array but whenever I do so, it gives me this error: error 047: array sizes do not match, or destination array is too small

The array in the enum is exactly same as in the command. Here is the observable code:

PHP код:
enum PLAYER_DATA
{
        
donorlevel,
    
color[6],
    
chatcolor[6],
}
new 
pinfo[MAX_PLAYERS][PLAYER_DATA];
public 
OnPlayerText(playeridtext[])
{
    switch(
pinfo[playerid][donorlevel])
        {
            case 
5:
        {
            new 
str[256];
            if(
pinfo[playerid][usingnick] == 1)
            {
                
format(str,sizeof(str),"{%x}%s (%d): {%x}%s",pinfo[playerid][color],pinfo[playerid][nickname],playerid,pinfo[playerid][chatcolor],playerid,text);
                
SendClientMessageToAll(-1,str);
            }
            else
            {
                
format(str,sizeof(str),"{%x}%s (%d): {%x}%s",pinfo[playerid][color],pinfo[playerid][name],playerid,pinfo[playerid][chatcolor],playerid,text);
                
SendClientMessageToAll(-1,str);
            }
        }
    }
    return 
0;

and the command:
PHP код:
CMD:changecolor(playerid,params[])
{
    new 
plcolor[50];
    if(
pinfo[playerid][donorlevel] < 1) return 0;
    else if(
pinfo[playerid][donorlevel] < 5) return SendClientMessage(playerid,COLOR_RED,"ERROR: Only donors level 5 have access to this command.");
    if(
sscanf(params"s",plcolor)) return SendClientMessage(playerid,COLOR_RED,"USAGE: /changecolor [color]");
    if(!
strcmp(plcolor,"red"))
    {
        
pinfo[playerid][color] = "ff0000"//line 466
        
pinfo[playerid][chatcolor] = "ff4c4c"//line 467
    
}
    if(!
strcmp(plcolor,"blue"))
    {
        
pinfo[playerid][color] = "00ffff"//line 471
        
pinfo[playerid][chatcolor] = "66ffff"//line 472
    
}
    if(!
strcmp(plcolor,"yellow"))
    {
        
pinfo[playerid][color] = "FFFF00"//line 476
        
pinfo[playerid][chatcolor] = "ffff66"//line 477
    
}
    if(!
strcmp(plcolor,"black"))
    {
        
pinfo[playerid][color] = "1e1e1e"//line 481
        
pinfo[playerid][chatcolor] = "616161"//line 482
    
}
    return 
1;

and the errors I am getting:
Код:
C:\Users\Abderrahmene\Desktop\0.3.7\gamemodes\testserver1.pwn(466) : error 047: array sizes do not match, or destination array is too small
C:\Users\Abderrahmene\Desktop\0.3.7\gamemodes\testserver1.pwn(467) : error 047: array sizes do not match, or destination array is too small
C:\Users\Abderrahmene\Desktop\0.3.7\gamemodes\testserver1.pwn(471) : error 047: array sizes do not match, or destination array is too small
C:\Users\Abderrahmene\Desktop\0.3.7\gamemodes\testserver1.pwn(472) : error 047: array sizes do not match, or destination array is too small
C:\Users\Abderrahmene\Desktop\0.3.7\gamemodes\testserver1.pwn(476) : error 047: array sizes do not match, or destination array is too small
C:\Users\Abderrahmene\Desktop\0.3.7\gamemodes\testserver1.pwn(477) : error 047: array sizes do not match, or destination array is too small
C:\Users\Abderrahmene\Desktop\0.3.7\gamemodes\testserver1.pwn(481) : error 047: array sizes do not match, or destination array is too small
C:\Users\Abderrahmene\Desktop\0.3.7\gamemodes\testserver1.pwn(482) : error 047: array sizes do not match, or destination array is too small
Reply


Messages In This Thread

Forum Jump:


Users browsing this thread: 1 Guest(s)