error: array sizes do not match
#1

hi ppl i need help when i compile gm i have 2 errors

D:\Lumix\LARP\LA-RPv1.5\gamemodes\larp.pwn(1629 : error 047: array sizes do not match, or destination array is too small
D:\Lumix\LARP\LA-RPv1.5\gamemodes\larp.pwn(16795) : error 047: array sizes do not match, or destination array is too small
Pawn compiler 3.2.3664 Copyright © 1997-2006, ITB CompuPhase


2 Errors.



this errors


Script:
-----------------------------------------------------
if(strcmp(cmd, "/trunk", true) == 0)
{
if(IsPlayerConnected(playerid))
{
new x_nr[64];
x_nr = strtok(cmdtext, idx); <--- i think something here is wrong please help(Line:16795)
if(!strlen(x_nr))
{

------------------------------------------------------



Reply
#2

i don't see anything wrong. Try replacing cmdtext with cmd
Reply
#3

thx bro but dont work same errors any helps?
Reply
#4

Increase the size of the string from [64] to [128], if it works then decrease the string until you get the errors so you're not stuff you don't need.
Reply
#5

Worksssssssssssssssss thxxxxxxxxxxxxxxx man thank you ))) [64] changed to [256]
Reply
#6

Ah, an edit.
Anyways, you should consider using SSCANF + ZCMD instead of STRCMP + STRTOK, because ZCMD + SSCANF is much faster!
Reply
#7

why [256], use [128]!
Reply
#8

Quote:
Originally Posted by Code8976Man
Посмотреть сообщение
why [256], use [128]!
Because TMP size must be minimum of 255, otherwise it will give you the same error. Also, strtok is outdated and slow, use SSCANF!
Reply
#9

yea i used 128 too but same errors, with 256 works fine
Reply
#10

you just use one of the fucked up strtok's with an array size of 256
Even in the wiki or pawn-lang.pdf are the versions with the index 20
Just copy this code and use the cmd array instead of a new one

But I rly advise to use sscanf, the plugin or the old pawn code version which are both faster and easier than strtok
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)