SA-MP Forums Archive
Anyone know how to fix this?? - 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: Anyone know how to fix this?? (/showthread.php?tid=327307)



Anyone know how to fix this?? - Passout - 20.03.2012

Код:
gamemodes\udmlv2.pwn(3693) : error 047: array sizes do not match, or destination array is too small
gamemodes\udmlv2.pwn(4066) : error 047: array sizes do not match, or destination array is too small
gamemodes\udmlv2.pwn(4398) : error 047: array sizes do not match, or destination array is too small
gamemodes\udmlv2.pwn(4756) : error 047: array sizes do not match, or destination array is too small
gamemodes\udmlv2.pwn(4765) : error 047: array sizes do not match, or destination array is too small
gamemodes\udmlv2.pwn(4801) : error 047: array sizes do not match, or destination array is too small
gamemodes\udmlv2.pwn(4870) : error 047: array sizes do not match, or destination array is too small
gamemodes\udmlv2.pwn(4966) : error 047: array sizes do not match, or destination array is too small
gamemodes\udmlv2.pwn(5034) : error 047: array sizes do not match, or destination array is too small
gamemodes\udmlv2.pwn(5043) : error 047: array sizes do not match, or destination array is too small
gamemodes\udmlv2.pwn(5074) : error 047: array sizes do not match, or destination array is too small
gamemodes\udmlv2.pwn(5083) : error 047: array sizes do not match, or destination array is too small
gamemodes\udmlv2.pwn(5114) : error 047: array sizes do not match, or destination array is too small
gamemodes\udmlv2.pwn(5123) : error 047: array sizes do not match, or destination array is too small
gamemodes\udmlv2.pwn(5153) : error 047: array sizes do not match, or destination array is too small
gamemodes\udmlv2.pwn(5162) : error 047: array sizes do not match, or destination array is too small
gamemodes\udmlv2.pwn(5215) : error 047: array sizes do not match, or destination array is too small
gamemodes\udmlv2.pwn(5262) : error 047: array sizes do not match, or destination array is too small
gamemodes\udmlv2.pwn(5270) : error 047: array sizes do not match, or destination array is too small
gamemodes\udmlv2.pwn(5381) : error 047: array sizes do not match, or destination array is too small
gamemodes\udmlv2.pwn(5391) : error 047: array sizes do not match, or destination array is too small
gamemodes\udmlv2.pwn(5402) : error 047: array sizes do not match, or destination array is too small
gamemodes\udmlv2.pwn(5428) : error 047: array sizes do not match, or destination array is too small
gamemodes\udmlv2.pwn(5437) : error 047: array sizes do not match, or destination array is too small
gamemodes\udmlv2.pwn(5460) : error 047: array sizes do not match, or destination array is too small
gamemodes\udmlv2.pwn(5469) : error 047: array sizes do not match, or destination array is too small

Compilation aborted.Pawn compiler 3.2.3664	 	 	Copyright © 1997-2006, ITB CompuPhase


26 Errors.
Код:
\gamemodes\udmlv2.pwn(3693) : error 047: array sizes do not match, or destination array is too small
\gamemodes\udmlv2.pwn(4066) : error 047: array sizes do not match, or destination array is too small
\gamemodes\udmlv2.pwn(4398) : error 047: array sizes do not match, or destination array is too small
3693: tmp = strtok(cmdtext, idx);
4060: tmp = strtok(cmdtext, idx);
4398: tmp = strtok(cmdtext, idx);

^^^^^^
The lines are pretty much all the same.

new tmp[125];

I had "strtok" defined but removed it because I got another error saying it was "Already Defined".
I can't remember why this error started occurring...But I really can't figure out how to fix it. Someone please help.

If this comes to any help,I'm using these include files
#include <core>
#include <float>
#include <dini>
#include <dudb>
#include <utils>


Re: Anyone know how to fix this?? - spd_sahil - 20.03.2012

show me how u defined idx

and also cmdtext


Re: Anyone know how to fix this?? - Skribblez - 20.03.2012

check the array sizes that you're using, make sure that wherever you assign them is larger or equal to where you get the data from. can you post those lines which says there's an error?


Re: Anyone know how to fix this?? - Passout - 20.03.2012

Quote:
Originally Posted by spd_sahil
Посмотреть сообщение
show me how u defined idx

and also cmdtext
new idx;
new cmd[256];
new tmp[250];
cmd = strtok(cmdtext, idx);

cmdtext is defined under OnPlayerCommandText(playerid, cmdtext[]) ? Isn't it...


Re: Anyone know how to fix this?? - Passout - 20.03.2012

Quote:
Originally Posted by Skribblez
Посмотреть сообщение
check the array sizes that you're using, make sure that wherever you assign them is larger or equal to where you get the data from. can you post those lines which says there's an error?
Код:
\gamemodes\udmlv2.pwn(3693) : error 047: array sizes do not match, or destination array is too small
\gamemodes\udmlv2.pwn(4066) : error 047: array sizes do not match, or destination array is too small
\gamemodes\udmlv2.pwn(4398) : error 047: array sizes do not match, or destination array is too small
3693: tmp = strtok(cmdtext, idx);
4060: tmp = strtok(cmdtext, idx);
4398: tmp = strtok(cmdtext, idx);

There is 26 total...They are all pretty much the same as the three above


Re: Anyone know how to fix this?? - Passout - 20.03.2012

Sorry for so many replies :P Just want to keep my post organized and easy to understand...
Anyway so I figured out that those errors were occurring because of the include
#include <dudb>

I'm still not completely sure why,so if anyone could still figure out the solution that would be so great


Re: Anyone know how to fix this?? - Skribblez - 20.03.2012

Quote:
Originally Posted by Passout
Посмотреть сообщение
new idx;
new cmd[256];
new tmp[250];
cmd = strtok(cmdtext, idx);

cmdtext is defined under OnPlayerCommandText(playerid, cmdtext[]) ? Isn't it...
they're too big in my opinion when it comes to command string lengths. try using equal sizes for both, that might be able to fix it.

pawn Код:
new cmd[128], tmp[128];

// alternatively...

new cmd[64], tmp[64];



Re: Anyone know how to fix this?? - Passout - 20.03.2012

Quote:
Originally Posted by Skribblez
Посмотреть сообщение
they're too big in my opinion when it comes to command string lengths. try using equal sizes for both, that might be able to fix it.

pawn Код:
new cmd[128], tmp[128];

// alternatively...

new cmd[64], tmp[64];
I'll give that a try...but the error was being caused by some include...Everything was fine the way it was until I started attempting certain things with a filter-script..


Re: Anyone know how to fix this?? - Skribblez - 20.03.2012

Quote:
Originally Posted by Passout
Посмотреть сообщение
I'll give that a try...but the error was being caused by some include...Everything was fine the way it was until I started attempting certain things with a filter-script..
if it was an include that messes up your script, try putting in the function itself into your script.

pawn Код:
strtok(const string[], &index)
{
    new length = strlen(string);
    while ((index < length) && (string[index] <= ' '))
    {
        index++;
    }
    new offset = index;
    new result[20];
    while ((index < length) && (string[index] > ' ') && ((index - offset) < (sizeof(result) - 1)))
    {
        result[index - offset] = string[index];
        index++;
    }
    result[index - offset] = EOS;
    return result;
}