SA-MP Forums Archive
HELP: 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: HELP: array sizes do not match, or destination array is too small (/showthread.php?tid=488046)



HELP: array sizes do not match, or destination array is too small - skydux123 - 16.01.2014

Hello I get an error in my code:

Код HTML:
C:\Users\Donce\Desktop\Donato!\FAILAI\VMG\gamemodes\gm.pwn(3402) : error 047: array sizes do not match, or destination array is too small
The CODE IS HERE:
PHP код:
    if( dialogid == 998 )
    {
    if(
response)
    {
    
erengejas playerid;
    
epavadinimas inputtext//ERROR LINE
    
vykstaeventas true;
    new 
msg[100];
    
format(msg,sizeof(msg), ""HEX_W"INFO:"HEX_Y" Jūs sėkmingai surengėte %s eventą. "HEX_R"Valdymas: /evaldymas"epavadinimas);
    
SendClientMessage(playerid, -1msg);
    }
    return 
1;
    } 
Thanks for help


Re: HELP: array sizes do not match, or destination array is too small - Konstantinos - 16.01.2014

That's not how you copy a string to another.

pawn Код:
new epavadinimas[128]; // or smaller size - depending on what it's used for.
pawn Код:
if( dialogid == 998 )
{
    if(response)
    {
        erengejas = playerid;
        strcpy(epavadinimas, inputtext, sizeof (epavadinimas));
        vykstaeventas = true;
        new msg[100];
        format(msg,sizeof(msg), ""HEX_W"INFO:"HEX_Y" Jūs sėkmingai surengėte %s eventą. "HEX_R"Valdymas: /evaldymas", epavadinimas);
        SendClientMessage(playerid, -1, msg);
    }
    return 1;
}
The strcpy:
pawn Код:
#define strcpy(%0,%1,%2) strcat((%0[0] = '\0', %0), %1, %2)
add it BEFORE.


Re: HELP: array sizes do not match, or destination array is too small - Ace155 - 16.01.2014

Just increase the array size.
PHP код:
new msg[170];
    
format(msg,sizeof(msg), ""HEX_W"INFO:"HEX_Y" Jūs sėkmingai surengėte %s eventą. "HEX_R"Valdymas: /evaldymas"epavadinimas);
    
SendClientMessage(playerid, -1msg); 
This should help.


Respuesta: HELP: array sizes do not match, or destination array is too small - Swedky - 16.01.2014

And this way?

pawn Код:
//
    if( dialogid == 998 )
    {
    if(response)
    {
    erengejas = playerid;
    vykstaeventas = true;
    new msg[100];
    format(msg,sizeof(msg), ""HEX_W"INFO:"HEX_Y" Jūs sėkmingai surengėte %s eventą. "HEX_R"Valdymas: /evaldymas", inputtext);
    SendClientMessage(playerid, -1, msg);
    }
    return 1;
    }



Re: HELP: array sizes do not match, or destination array is too small - skydux123 - 16.01.2014

Thanks all for help but Konstantinos helped me