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

I've searched this error but found no promising information. Anywho, whenever I attempt to set a group name based upon the text a player inputed into a dialog, I get the error thats in the title

pawn Код:
case 9003:
           {
               Groups[Player[playerid][GroupCarryID]][GroupName] = inputtext; // This line
               
               new string[255];
               format(string, sizeof string, "Name: %s\nType: %d\nEdit Skins\nEdit Ranks\nEdit Divisions\nEdit Paycheques", Groups[1][GroupName], Groups[1][CommandTypes]);
               ShowPlayerDialog(playerid, 9002, DIALOG_STYLE_LIST, "Edit Group | Group 1", string, "Proceed", "Cancel");
               Player[playerid][GroupCarryID] = 1;
           }
Reply
#2

Show us the enumerator. You can also use strmid to set the array equal to inputtext.
Reply
#3

pawn Код:
enum GroupData
{
    GroupName[255],
    CommandTypes,
    RankName0[255],
    RankName1[255],
    RankName2[255],
    RankName3[255],
    RankName4[255],
    RankName5[255],
    RankName6[255],
    RankName7[255],
    RankName8[255],
    RankName9[255],
    PayRank0,
    PayRank1,
    PayRank2,
    PayRank3,
    PayRank4,
    PayRank5,
    PayRank6,
    PayRank7,
    PayRank8,
    PayRank9,
    DivName0[255],
    DivName1[255],
    DivName2[255],
    DivName3[255],
    DivName4[255],
    DivName5[255],
    DivName6[255],
    Skin0,
    SavedCrack,
    SavedPot,
    Skin1,
    Skin2,
    Skin3,
    Skin4,
    Skin5,
    Skin6,
    HQInteriorID,
    Float: HQInteriorX,
    ChatDisabled,
    Float: HQInteriorY,
    Float: HQInteriorZ,
    HQExteriorID,
    Float: HQExteriorX,
    Float: HQExteriorY,
    Float: HQExteriorZ,
    Float: SafeX,
    Float: SafeY,
    Float: SafeZ,
    SafeInteriorID,
    SafeWorld,
    SafeMoney,
    DisbandHour,
    DisbandMinute,
    DisbandDay,
    DisbandMonth,
    MOTD[255],
    DisbandYear,
    SafePickupID,
    HQPickupID,
    HQLock,
};
Reply
#4

The array size of inputtext is undefined(and you can't define it), but the array size of Groupname is set. Better use the format function
Reply
#5



pawn Код:
case 9003:
{
    new string_inputtext[255];
    strdel(string_inputtext, 0, 255);
    format(string_inputtext, sizeof(string_inputtext), "%s", inputtext);
    Groups[Player[playerid][GroupCarryID]][GroupName] = string_inputtext;

    new string[255];
    format(string, sizeof string, "Name: %s\nType: %d\nEdit Skins\nEdit Ranks\nEdit Divisions\nEdit Paycheques", Groups[1][GroupName], Groups[1][CommandTypes]);
    ShowPlayerDialog(playerid, 9002, DIALOG_STYLE_LIST, "Edit Group | Group 1", string, "Proceed", "Cancel");
    Player[playerid][GroupCarryID] = 1;
}
Reply
#6

pawn Код:
case 9003:
{
    new ID = Player[playerid][GroupCarryID];
    Groups[ ID ][ GroupName ][ 0 ] = EOS;
    strcat(Groups[ ID ][ GroupName ], inputtext, 255); // 255 size of GroupName

    new string[128];
    Player[playerid][GroupCarryID] = 1;
    format(string, sizeof string, "Name: %s\nType: %d\nEdit Skins\nEdit Ranks\nEdit Divisions\nEdit Paycheques", Groups[1][GroupName], Groups[1][CommandTypes]);
    ShowPlayerDialog(playerid, 9002, DIALOG_STYLE_LIST, "Edit Group | Group 1", string, "Proceed", "Cancel");
}
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)