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

Hi .
I have a problem with my gamemode
If I compile this i get this errors :
C:\Users\Nima\Desktop\Sansor.pwn(26635) : error 047: array sizes do not match, or destination array is too small
C:\Users\Nima\Desktop\Sansor.pwn(26695) : error 047: array sizes do not match, or destination array is too small
C:\Users\Nima\Desktop\Sansor.pwn(2674 : error 047: array sizes do not match, or destination array is too small
C:\Users\Nima\Desktop\Sansor.pwn(27416) : error 047: array sizes do not match, or destination array is too small
C:\Users\Nima\Desktop\Sansor.pwn(27475) : error 047: array sizes do not match, or destination array is too small
C:\Users\Nima\Desktop\Sansor.pwn(28156) : error 047: array sizes do not match, or destination array is too small
C:\Users\Nima\Desktop\Sansor.pwn(28184) : error 047: array sizes do not match, or destination array is too small
C:\Users\Nima\Desktop\Sansor.pwn(28195) : error 047: array sizes do not match, or destination array is too small
C:\Users\Nima\Desktop\Sansor.pwn(28255) : error 047: array sizes do not match, or destination array is too small
C:\Users\Nima\Desktop\Sansor.pwn(28524) : error 047: array sizes do not match, or destination array is too small
C:\Users\Nima\Desktop\Sansor.pwn(28551) : error 047: array sizes do not match, or destination array is too small
C:\Users\Nima\Desktop\Sansor.pwn(28581) : error 047: array sizes do not match, or destination array is too small
C:\Users\Nima\Desktop\Sansor.pwn(28589) : error 047: array sizes do not match, or destination array is too small
C:\Users\Nima\Desktop\Sansor.pwn(28623) : error 047: array sizes do not match, or destination array is too small
C:\Users\Nima\Desktop\Sansor(28631) : error 047: array sizes do not match, or destination array is too small
C:\Users\Nima\Desktop\Sansor.pwn(28664) : error 047: array sizes do not match, or destination array is too small
C:\Users\Nima\Desktop\Sansor.pwn(28709) : error 047: array sizes do not match, or destination array is too small
C:\Users\Nima\Desktop\Sansor.pwn(28772) : error 047: array sizes do not match, or destination array is too small
C:\Users\Nima\Desktop\Sansor.pwn(28830) : error 047: array sizes do not match, or destination array is too small
C:\Users\Nima\Desktop\Sansor.pwn(2883 : error 047: array sizes do not match, or destination array is too small
C:\Users\Nima\Desktop\Sansor.pwn(28873) : error 047: array sizes do not match, or destination array is too small
C:\Users\Nima\Desktop\Sansor.pwn(28881) : error 047: array sizes do not match, or destination array is too small
C:\Users\Nima\Desktop\Sansor.pwn(2910 : error 047: array sizes do not match, or destination array is too small
C:\Users\Nima\Desktop\Sansor.pwn(29162) : error 047: array sizes do not match, or destination array is too small
C:\Users\Nima\Desktop\Sansor.pwn(29215) : error 047: array sizes do not match, or destination array is too small
C:\Users\Nima\Desktop\Sansor.pwn(29527) : error 047: array sizes do not match, or destination array is too small

Quote:

Line 26635

Код:
	cmd = strtok(cmdtext, idx);
Quote:

Line 26695

Код:
tmp = strtok(cmdtext, idx);
And More Line Like line 26695
Please Help Me
ty.
[And Sory For My Bad English]
Reply
#2

Send the whole code please.
Reply
#3

I Attach This Gamemode.
Reply
#4

If I may say this, please use the search function
=> array sizes do not match, or destination array is too small

It's completely the same problem. The answers suggest to use strrest instead of strtok:
Quote:
Originally Posted by smeti
Посмотреть сообщение
strtok original code new result[20]; <-- 20 cell
new tmp[128], tmp2[128], <-- 128 cell

array size do not match tmp(128 cell) not equal result (20 cell)

Use strrest in gl_common.inc.

pawn Код:
#include "../include/gl_common.inc"

//...

new tmp[128], tmp2[128], Index; tmp = strrest(params,Index), tmp2 = strrest(params,Index);
Quote:
Originally Posted by Vince
Посмотреть сообщение
Pretty sure strtok returns only 256 size strings. Yet another reason why you should abolish this method ASAP.
I hope this helps.
Reply
#5

Can you fix it for me ?
I don't understand.
I Give you 2+ rip!
Reply
#6

Quote:
Originally Posted by nimagame
Посмотреть сообщение
Can you fix it for me ?
I don't understand.
I Give you 2+ rip!
Just use strrest instead of strtok. You have to include the function of course if you haven't already.
pawn Код:
#include "../include/gl_common.inc"
You can have a look at both functions >> here <<.
Then you also might be able to figure out the problem. Hint: 20 is smaller than 128, thus "the array sizes do not match".
Reply
#7

I use strrest instead of strtok.
but again I get error array sizes do not match, or destination array is too small
And this errors :
../include/gl_common.inc(80) : error 021: symbol already defined: "strtok"
../include/gl_common.inc(139) : error 021: symbol already defined: "isNumeric"
../include/gl_common.inc(194) : error 021: symbol already defined: "ReturnUser"
Reply
#8

Ok then don't include the file and try just declaring the function:
pawn Код:
stock strrest(const string[], &index)
{
    new length = strlen(string);
    while ((index < length) && (string[index] <= ' '))
    {
        index++;
    }
    new offset = index;
    new result[128];
    while ((index < length) && ((index - offset) < (sizeof(result) - 1)))
    {
        result[index - offset] = string[index];
        index++;
    }
    result[index - offset] = EOS;
    return result;
}
That should really work then, it does for me at least. As you can see, result in strrest has the same size as tmp and cmd.
Reply
#9

I put it under the OnPlayerCommandText
And Again get errors :
Код:
C:\Users\Administrator\Desktop\Iranian RPG\gamemodes\larp.pwn(28271) : error 033: array must be indexed (variable "tmp")
C:\Users\Administrator\Desktop\Iranian RPG\gamemodes\larp.pwn(30197) : error 047: array sizes do not match, or destination array is too small
C:\Users\Administrator\Desktop\Iranian RPG\gamemodes\larp.pwn(30239) : error 047: array sizes do not match, or destination array is too small
C:\Users\Administrator\Desktop\Iranian RPG\gamemodes\larp.pwn(30294) : error 047: array sizes do not match, or destination array is too small
C:\Users\Administrator\Desktop\Iranian RPG\gamemodes\larp.pwn(30651) : error 047: array sizes do not match, or destination array is too small
C:\Users\Administrator\Desktop\Iranian RPG\gamemodes\larp.pwn(31043) : error 047: array sizes do not match, or destination array is too small
C:\Users\Administrator\Desktop\Iranian RPG\gamemodes\larp.pwn(32102) : error 047: array sizes do not match, or destination array is too small
C:\Users\Administrator\Desktop\Iranian RPG\gamemodes\larp.pwn(32298) : error 047: array sizes do not match, or destination array is too small
C:\Users\Administrator\Desktop\Iranian RPG\gamemodes\larp.pwn(32793) : error 047: array sizes do not match, or destination array is too small
C:\Users\Administrator\Desktop\Iranian RPG\gamemodes\larp.pwn(33659) : error 047: array sizes do not match, or destination array is too small
C:\Users\Administrator\Desktop\Iranian RPG\gamemodes\larp.pwn(34248) : error 047: array sizes do not match, or destination array is too small
C:\Users\Administrator\Desktop\Iranian RPG\gamemodes\larp.pwn(47692) : error 047: array sizes do not match, or destination array is too small
C:\Users\Administrator\Desktop\Iranian RPG\gamemodes\larp.pwn(62023) : error 047: array sizes do not match, or destination array is too small
C:\Users\Administrator\Desktop\Iranian RPG\gamemodes\larp.pwn(62125) : error 047: array sizes do not match, or destination array is too small
C:\Users\Administrator\Desktop\Iranian RPG\gamemodes\larp.pwn(62295) : error 047: array sizes do not match, or destination array is too small
C:\Users\Administrator\Desktop\Iranian RPG\gamemodes\larp.pwn(62531) : error 047: array sizes do not match, or destination array is too small
C:\Users\Administrator\Desktop\Iranian RPG\gamemodes\larp.pwn(62733) : error 047: array sizes do not match, or destination array is too small
C:\Users\Administrator\Desktop\Iranian RPG\gamemodes\larp.pwn(63349) : error 047: array sizes do not match, or destination array is too small
C:\Users\Administrator\Desktop\Iranian RPG\gamemodes\larp.pwn(63770) : error 047: array sizes do not match, or destination array is too small
C:\Users\Administrator\Desktop\Iranian RPG\gamemodes\larp.pwn(64106) : error 047: array sizes do not match, or destination array is too small
C:\Users\Administrator\Desktop\Iranian RPG\gamemodes\larp.pwn(64307) : error 047: array sizes do not match, or destination array is too small
C:\Users\Administrator\Desktop\Iranian RPG\gamemodes\larp.pwn(64562) : error 047: array sizes do not match, or destination array is too small
C:\Users\Administrator\Desktop\Iranian RPG\gamemodes\larp.pwn(64780) : error 047: array sizes do not match, or destination array is too small
C:\Users\Administrator\Desktop\Iranian RPG\gamemodes\larp.pwn(64926) : error 047: array sizes do not match, or destination array is too small
C:\Users\Administrator\Desktop\Iranian RPG\gamemodes\larp.pwn(65191) : error 047: array sizes do not match, or destination array is too small
C:\Users\Administrator\Desktop\Iranian RPG\gamemodes\larp.pwn(65233) : error 047: array sizes do not match, or destination array is too small
Reply
#10

Anybody Can Help me ??
Reply


Forum Jump:


Users browsing this thread: 5 Guest(s)