SA-MP Forums Archive
array sizes do not match, or destination array is too small - Printable Version

+- SA-MP Forums Archive (https://sampforum.blast.hk)
+-- Forum: SA-MP Scripting and Plugins (https://sampforum.blast.hk/forumdisplay.php?fid=8)
+--- Forum: Scripting Help (https://sampforum.blast.hk/forumdisplay.php?fid=12)
+--- Thread: array sizes do not match, or destination array is too small (/showthread.php?tid=336470)



array sizes do not match, or destination array is too small - xXitsgodzillaXx - 22.04.2012

having some issues with "raven roleplay"

since there are TONS of lines with these errors. i just give you guys a few. they are all the same error but idk how to fix it lol

Код:
C:\Documents and Settings\Administrator\Desktop\xd\gamemodes\larp.pwn(26588) : error 047: array sizes do not match, or destination array is too small
C:\Documents and Settings\Administrator\Desktop\xd\gamemodes\larp.pwn(26648) : error 047: array sizes do not match, or destination array is too small
C:\Documents and Settings\Administrator\Desktop\xd\gamemodes\larp.pwn(26701) : error 047: array sizes do not match, or destination array is too small
pawn Код:
dcmd(xgoto, 5, cmdtext);
    dcmd(gpsfind, 7, cmdtext);
    dcmd(attach,6,cmdtext);
    dcmd(unattach,8,cmdtext);
    dcmd(acheckcode,10,cmdtext);
    dcmd(alias,5,cmdtext);
    dcmd(ips,3,cmdtext);
    dcmd(getips,6,cmdtext);
    dcmd(getaliases,10,cmdtext);
    dcmd(unban,5,cmdtext);
    //dcmd(saveeverything,14,cmdtext);
    new string[512 char];
    new playermoney;
    new sendername[MAX_PLAYER_NAME];
    new giveplayer[MAX_PLAYER_NAME];
    new playername[MAX_PLAYER_NAME];
    new cmd[128];
    new tmp[128];
    new dancestyle;
    new giveplayerid, moneys, idx;
    new idcar = GetPlayerVehicleID(playerid);
    new pveh = GetVehicleModel(GetPlayerVehicleID(playerid));
    cmd = strtok(cmdtext, idx);                                             // <<---- error line 26588
    GetPlayerName(playerid, sendername, sizeof(sendername));
    new y5, m5, d5;
    new h5,mi5,s5;
    getdate(y5,m5,d5);
    gettime(h5,mi5,s5);
    format(string,sizeof(string), "(%d/%d/%d)[%d:%d:%d] %s [CMD] -> %s",d5,m5,y5,h5,mi5,s5,sendername,cmdtext);
    AllCommandLog(string);
pawn Код:
if (strcmp(cmd, "/breathtest", true) == 0)
    {
        if(IsPlayerConnected(playerid))
        {
            if (IsACop(playerid))
            {
                tmp = strtok(cmdtext, idx);                             //<------- error line 26648
                if(!strlen(tmp))
                {
                    SendClientMessage(playerid, COLOR_GRAD1, "USAGE: /breathtest [playerid/PartOfName]");
                    return 1;
                }
                giveplayerid = ReturnUser(tmp);
                new level = GetPlayerDrunkLevel(giveplayerid);
                GetPlayerName(giveplayerid, giveplayer, sizeof(giveplayer));
                if(IsPlayerConnected(giveplayerid))
                {
                    if(giveplayerid != INVALID_PLAYER_ID)
                    {
                        if(GetDistanceBetweenPlayers(playerid,giveplayerid) < 3)
                        {
                            if(level > 600)
                            {
                                format(string, sizeof(string), "* %s grabs their breathalyzer and puts the tube into %s's mouth.", sendername ,giveplayer);
                                ProxDetector(30.0, playerid, string, COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE);
                                SendClientMessage(playerid, COLOR_LIGHTBLUE, "** Breathalyzer Result: Intoxicated **");
                                GameTextForPlayer(playerid,"~w~This player is~n~~r~Drunk", 8000, 1);
                                return 1;
                            }
                            else
                            {
                                format(string, sizeof(string), "* %s grabs their breathalyzer and puts the tube into %s's mouth.", sendername ,giveplayer);
                                ProxDetector(30.0, playerid, string, COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE);
                                SendClientMessage(playerid, COLOR_LIGHTBLUE, "** Breathalyzer Result: Not Intoxicated **");
                                GameTextForPlayer(playerid,"~w~This player is~n~~r~Not Drunk", 8000, 1);
                                return 1;
                            }
                        }
                    }
                }
                else
                {
                    SendClientMessage(playerid, COLOR_GRAD1, "   This player is offline !");
                }
            }
            else
            {
                SendClientMessage(playerid, COLOR_GRAD1, "   You are not authorized to use this command! (Cops Only)");
            }
        }
        return 1;
    }
pawn Код:
if (strcmp(cmd, "/drugtest", true) == 0)
    {
        if(IsPlayerConnected(playerid))
        {
            if (IsACop(playerid))
            {
                tmp = strtok(cmdtext, idx);     //<----- error line 26701
                if(!strlen(tmp))
                {
                    SendClientMessage(playerid, COLOR_GRAD1, "USAGE: /drugtest [playerid/PartOfName]");
                    return 1;
                }

Thanks in advance! :P


Re: array sizes do not match, or destination array is too small - Tomer!.$ - 22.04.2012

Post your strtok stock.


Re: array sizes do not match, or destination array is too small - xXitsgodzillaXx - 22.04.2012

Quote:
Originally Posted by Tomer!.$
Посмотреть сообщение
Post your strtok stock.
cant seem to find it D: got any key words so i can just CTRL + F to find it?


Re: array sizes do not match, or destination array is too small - Phyrunx - 22.04.2012

hmm try to search strtok
Or Stock strtok


Re: array sizes do not match, or destination array is too small - xXitsgodzillaXx - 22.04.2012

Quote:
Originally Posted by Phyrunx
Посмотреть сообщение
hmm try to search strtok
Or Stock strtok
found nothing D:< maybe i might need to put in a strtok stock <


Re: array sizes do not match, or destination array is too small - xXitsgodzillaXx - 22.04.2012

any ideas anyone?


Re: array sizes do not match, or destination array is too small - MP2 - 22.04.2012

Don't use strtok. lrn2sscanf.

https://sampforum.blast.hk/showthread.php?tid=120356


Re: array sizes do not match, or destination array is too small - xXitsgodzillaXx - 22.04.2012

Quote:
Originally Posted by MP2
Посмотреть сообщение
thats irrelevant. i didnt make this script. someone with some help pls?