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

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
Reply
#2

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.
Reply
#3

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.
Reply
#4

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;
    }
Reply
#5

Thanks all for help but Konstantinos helped me
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)