SA-MP Forums Archive
[Error] Ajuda - Printable Version

+- SA-MP Forums Archive (https://sampforum.blast.hk)
+-- Forum: Non-English (https://sampforum.blast.hk/forumdisplay.php?fid=9)
+--- Forum: Languages (https://sampforum.blast.hk/forumdisplay.php?fid=33)
+---- Forum: Português/Portuguese (https://sampforum.blast.hk/forumdisplay.php?fid=34)
+---- Thread: [Error] Ajuda (/showthread.php?tid=217000)



[Error] Ajuda - mathmach - 26.01.2011

fui compilar o server e deu
Код:
(13480) : error 021: symbol already defined: "strtok"
(13495) : error 047: array sizes do not match, or destination array is too small
oq esta em volta й
Код:
	Checkprop();
	format(string, sizeof(string), "Loteria: Ja comecou a loteria.");
	OOCOff(COLOR_WHITE, string);
	new rand = random(80);
	if(rand < 77) { rand += 3; }
	Lotto(rand);
	return 1;
}
strtok(const string[], &index)
{
	new length = strlen(string);
	while ((index < length) && (string[index] <= ' '))
	{
		index++;
	}

	new offset = index;
	new result[20];
	while ((index < length) && (string[index] > ' ') && ((index - offset) < (sizeof(result) - 1)))
	{
		result[index - offset] = string[index];
		index++;
	}
	result[index - offset] = EOS;
	return result;
}
vlw ai gente


Re: [Error] Ajuda - [BEP]AcerPilot - 26.01.2011

Deleta a strtok do seu GM pois vocк deve ter outro em uma das suas includes ou no prуprio GM e troque new result[20] por new result[128];.


Respuesta: [Error] Ajuda - ipsBruno - 26.01.2011

pawn Код:
stock strtok(cmdtext[],param = 1)
{
    new iLoop = 0,iSpaces = 0,iStr[32];
    while(iSpaces != param) if(cmdtext[++iLoop] == ' ') ++iSpaces;
    ++iLoop,format(iStr,32,cmdtext[iLoop]);
    return iStr;
}
Й mais rбpido.


Re: [Error] Ajuda - [Ips]Guh - 26.01.2011

Muda pra isso tbm funciona :
pawn Код:
Checkprop();
    format(string, sizeof(string), "Loteria: Ja comecou a loteria.");
    OOCOff(COLOR_WHITE, string);
    new rand = random(80);
    if(rand < 77) { rand += 3; }
    Lotto(rand);
    return 1;
}
strtok2(const string[], &index)
{
    new length = strlen(string);
    while ((index < length) && (string[index] <= ' '))
    {
        index++;
    }

    new offset = index;
    new result[20];
    while ((index < length) && (string[index] > ' ') && ((index - offset) < (sizeof(result) - 1)))
    {
        result[index - offset] = string[index];
        index++;
    }
    result[index - offset] = EOS;
    return result;
}
e so mudar de Strtok para Strtok2


Re: [Error] Ajuda - mathmach - 26.01.2011

ae deu gente vlw