SA-MP Forums Archive
error. :/ - 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)
+---- Forum: Help Archive (https://sampforum.blast.hk/forumdisplay.php?fid=89)
+---- Thread: error. :/ (/showthread.php?tid=224279)



error. :/ - Gh0sT_ - 11.02.2011

pawn Код:
stock KraunamVerslus( )
{
    for( new ID = 0; ID < MAX_BUSINESS; ID ++ )
    {
        new
            Failas[ 38 ]
        ;
        format( Failas, 38, "DuomenuBaze/Verslai/%d.ini", ID );
        if( dini_Exists( Failas ) )
        {
            VersluCP[ ID ] = CreateDynamicCP( dini_Float( Failas, "bX" ), dini_Float( Failas, "bY" ), dini_Float( Failas, "bZ" ), 1.5, -1, -1, -1, 100.0 );
            new
                Stringas[ 211 ]
            ;
            if( dini_Int( Failas, "Parduotas" ) == 0 )
            {
                format( Stringas, 211, ""#h_Geltona"Biznis %s yra "#h_Raudona"parduodamas\n"#h_Balta"Kaina: "#h_Zalia"%d\n"#h_Balta"Pelnas: "#h_Zalia"%d", dini_Get( Failas, "Pavadinimas" ), dini_Int( Failas, "Kaina" ), dini_Int( Failas, "Pelnas" ) );
                VersluText[ ID ] = Create3DTextLabel( Stringas, -1, dini_Float( Failas, "bX" ), dini_Float( Failas, "bY" ), dini_Float( Failas, "bZ" ), 25, 0, 0 );
            }
            else
            {
                format( Stringas, 111, ""#h_Geltona"Biznis %s nлra "#h_Raudona"parduodamas\n"#h_Balta"Savininkas: "#h_Zalia"%s", dini_Get( Failas, "Pavadinimas" ), dini_Get( Failas, "Savininkas" ) );
                VersluText[ ID ] = Create3DTextLabel( Stringas, -1, dini_Float( Failas, "bX" ), dini_Float( Failas, "bY" ), dini_Float( Failas, "bZ" ), 25, 0, 0 );
            }
            VersluDB[ ID ][ bKaina ] = dini_Int( Failas, "Kaina" );
            VersluDB[ ID ][ bPelnas ][ 0 ] = dini_Int( Failas, "Fondas" );
            VersluDB[ ID ][ bPelnas ][ 0 ] = dini_Int( Failas, "Uzdirbama" );
            VersluDB[ ID ][ bNupirktas ] = dini_Int( Failas, "Parduotas" );
            VersluDB[ ID ][ bPardavimas ] = dini_Int( Failas, "Pardavimas" );
            VersluDB[ ID ][ bPavadinimas ] = dini_Get( Failas, "Pavadinimas" );
            VersluDB[ ID ][ bSavininkas ] = dini_Get( Failas, "Savininkas" );
        }
    }
    return true;
}
Quote:

C:\Documents and Settings\Admin\Desktop\Andriaus\SAMP\Fort Carson Gyvenimas\gamemodes\NEW.pwn(224) : error 047: array sizes do not match, or destination array is too small
C:\Documents and Settings\Admin\Desktop\Andriaus\SAMP\Fort Carson Gyvenimas\gamemodes\NEW.pwn(225) : error 047: array sizes do not match, or destination array is too small

and enum:

pawn Код:
enum BizniuDB
{
    bKaina,
    bPavadinimas[ 76 ],
    bSavininkas[ 24 ],
    Float: bPozicija[ 3 ],
    bPardavimas,
    bPelnas[ 2 ],
    bNupirktas
};
new VersluDB[ MAX_BUSINESS ][ BizniuDB ];
Lines 224, 225:

pawn Код:
VersluDB[ ID ][ bPavadinimas ] = dini_Get( Failas, "Pavadinimas" );
VersluDB[ ID ][ bSavininkas ] = dini_Get( Failas, "Savininkas" );



Re: error. :/ - Lorenc_ - 11.02.2011

"array sizes do not match"

simplified:

The array sizes do not match the actual arrays code.

You might have something like:

new g[5];

g[24] = 1;

etc. double check.


Re: error. :/ - Gh0sT_ - 11.02.2011

So, I need to use strlen at this moment? >.>


Re: error. :/ - dice7 - 11.02.2011

dini_Get returns an array the size of 256 cells, so you need to make your bPavadinimas and bSavininkas 256 cells big

OR you could use format, strcat, strins, etc..
https://sampwiki.blast.hk/wiki/Format
https://sampwiki.blast.hk/wiki/Strcat
https://sampwiki.blast.hk/wiki/Strins


Re: error. :/ - JaTochNietDan - 11.02.2011

That's not what the error means, the error actually means that the array dini_Get returns is larger than the array he is trying to store it in. Which means there isn't enough space according to the compiler, the size of the array returned by dini_Get is 256 by default I believe?

Which means you would have to make your strings 256 in size, or bypass the error by using a function like format, for example:

pawn Код:
format(VersluDB[ ID ][ bPavadinimas ], 76, "%s", dini_Get( Failas, "Pavadinimas" ));
Edit: dice7 beat me to it


Re: error. :/ - Gh0sT_ - 11.02.2011

thanks all


Re: error. :/ - Gh0sT_ - 11.02.2011

another problem with biz creating ://

Error line:

pawn Код:
SukurtiVersla( "FC Parduotuve", -77.9726, 1110.2327, 19.4751, 100000, 32000, 10 );
SukurtiVersla stock:

pawn Код:
stock SukurtiVersla( pPavadinimas[ ], pX, pY, pZ, pKaina, pPardavimas, pUzdirbama )
{
    Bizniai ++;
    VersluDB[ Bizniai ][ bPozicija ][ 0 ] = pX;
    VersluDB[ Bizniai ][ bPozicija ][ 1 ] = pY;
    VersluDB[ Bizniai ][ bPozicija ][ 2 ] = pZ;
    VersluDB[ Bizniai ][ bKaina ] = pKaina;
    VersluDB[ Bizniai ][ bPardavimas ] = pPardavimas;
    VersluDB[ Bizniai ][ bPelnas ][ 1 ] = pUzdirbama;
    VersluDB[ Bizniai ][ bNupirktas ] = 0;
    VersluDB[ Bizniai ][ bPelnas ][ 0 ] = 0;
    VersluCP[ Bizniai ] = CreateDynamicCP( pX, pY, pZ, 1.5, -1, -1, -1, 100.0 );
    format( VersluDB[ Bizniai ][ bPavadinimas ], 60, "%s", pPavadinimas );
    new
        Stringas[ 198 ],
        Failas[ 39 ]
    ;
    format( Stringas, 198, ""#h_Balta"Verslas „%s“ yra "#h_Raudona"PARDUODAMAS.\n"#h_Balta"Kaina: "#h_Raudona"%d\n"#h_Balta"Pelnas: "#h_Raudona"%d", pPavadinimas, pKaina, pUzdirbama );
    VersluText[ Bizniai ] = Create3DTextLabel( Stringas, -1, pX, pY, pZ, 50, 0, 0 );
    format( Failas, 39, "DuomenuBaze/Verslai/%d.ini", Bizniai );
    dini_Create( Failas );
    dini_IntSet( Failas, "Parduotas", VersluDB[ Bizniai ][ bNupirktas ] );
    dini_IntSet( Failas, "Kaina", VersluDB[ Bizniai ][ bKaina ] );
    dini_IntSet( Failas, "Fondas", VersluDB[ Bizniai ][ bPelnas ][ 0 ] );
    dini_IntSet( Failas, "Uzdirbama", VersluDB[ Bizniai ][ bPelnas ][ 1 ] );
    dini_IntSet( Failas, "Pardavimas", VersluDB[ Bizniai ][ bPardavimas ] );
    dini_Set( Failas, "Pavadinimas", VersluDB[ Bizniai ][ bPavadinimas ] );
    return true;
}
Errors:

Quote:

C:\Documents and Settings\Admin\Desktop\Andriaus\SAMP\Fort Carson Gyvenimas\gamemodes\NEW.pwn(269) : warning 213: tag mismatch
C:\Documents and Settings\Admin\Desktop\Andriaus\SAMP\Fort Carson Gyvenimas\gamemodes\NEW.pwn(269) : warning 213: tag mismatch
C:\Documents and Settings\Admin\Desktop\Andriaus\SAMP\Fort Carson Gyvenimas\gamemodes\NEW.pwn(269) : warning 213: tag mismatch




Re: error. :/ - Gh0sT_ - 11.02.2011

bump. :/