Page 1 of 1

mismatch error

Posted: 30 Jun 2020, 04:43
by Filiq_
deja mi am facut prea multi draci si cred ca am dat de 100 de ori compile incercand sa rezolv bugul asta, deci vreau sa dau explode la un string preluat din baza de date, am facut asa

new skins[256],
mySkins[512 + MAX_PLAYER_SKINS][11]

SQL_ReadResult(Query, 9, skins, charsmax(skins))

iar acum vine problema cu explode, am incercat cred ca peste 20 de stockuri si nici un rezultat, am incercat si versiunea amxx 1.8.3, dar degaba

explode_string(skins, "|", mySkins, 512 + MAX_PLAYER_SKINS, 10)
cateva stockuri de le am incercat | Afiseaza codul
stock ExplodeString( p_szOutput[][], p_nMax, p_nSize, p_szInput[], p_szDelimiter )
{
    new nIdx = 0, l = strlen(p_szInput)
    new nLen = (1 + copyc( p_szOutput[nIdx], p_nSize, p_szInput, p_szDelimiter ))
    while( (nLen < l) && (++nIdx < p_nMax) )
        nLen += (1 + copyc( p_szOutput[nIdx], p_nSize, p_szInput[nLen], p_szDelimiter ))
    return nIdx
}

stock str_explode(const string[], delimiter, output[][], output_size, output_len)
{
	new i, pos, len = strlen(string);
	
	do
	{
		pos += (copyc(output[i++], output_len, string[pos], delimiter) + 1);
	}
	while(pos < len && i < output_size);
	
	return i;
}

stock ExplodeString(const string[], output[], olen = sizeof output)
{
    new len = strlen( string ); // We retrieve the length of the current string passed.
 
    if ( !len )  { return 0; } // If the string is empty we stop there.
 
    new i, c, j, count;
    new number[ 12 ];
 
    do
    {
        while ( string[ i ] == ' ' ) i++; // One or more spaces can be used between 2 numbers, so we move forward until we find a number.
        while ( ( number[ j++ ] = c = string[ i++ ] ) && c != ' ' ) {} // We loop and save the number found until the next space found or end of string.
 
        output[ count++ ] = str_to_num( number ); // We convert the number saved previously into a number and we stored in output at the slot count.
        j = 0;
    }
    while ( i < len && count < olen ); // We should looping while we have not cross the string length.
 
    return count;
}
edit: am rezolvat, aveam o variabila globala "skins" si din cauza asta nu mergea...