[Ajuda] Erros
#1

Olб a todos, boa noite.
O meu cуdigo estб com os seguintes erros:
Код:
error 029: invalid expression, assumed zero
warning 215: expression has no effect
error 001: expected token: ";", but found ")"
error 029: invalid expression, assumed zero
fatal error 107: too many error messages on one line
Linha:
Код:
while (index < length) && (string[index] > ' ') && ((index - offset) < (sizeof(result) - 1)))
Reply
#2

O erro й na strtok veja se estб assim na sua.

strtok:
Код:
strtok(const string[], &index) 
{ 
	new length = strlen(string); 
	while ((index < length) && (string[index] <= ' ')) index++; 
	new offset = index, result[20]; 
	while ((index < length) && (string[index] > ' ') && ((index - offset) < (sizeof(result) - 1))) 
	{ 
		result[index - offset] = string[index]; 
		index++; 
	} 
	result[index - offset] = EOS; 
	return result; 
}
Reply
#3

O erro foi apenas nгo impor corretamente a precedкncia, faltando parenteses...
PHP код:
while((index length) && (string[index] > ' ') && ((index offset) < (sizeof(result) - 1))) 
Reply
#4

Olб, bom dia, mesmo com a strtok ainda continua com os seguintes errors:

Код:
error 029: invalid expression, assumed zero
warning 215: expression has no effect
error 001: expected token: ";", but found "]"
error 029: invalid expression, assumed zero
fatal error 107: too many error messages on one line
Jб coloquei o strtok dentro da callback, no final do gamemode, antes das callbacks, em baixo das includes em qualquer lugar, ele dб esses errors.

A linha й esta:
Код:
return[index - offset] = EOS;
O cуdigo da strtok que eu uso й este:

Код:
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++;
	}
	return[index - offset] = EOS;
	return result;
}
Jб, sem a strtok ele dб esses errors:

Код:
undefined symbol "strtok"
undefined symbol "strtok"
undefined symbol "strtok"
undefined symbol "strtok"
undefined symbol "strtok"
undefined symbol "strtok"
undefined symbol "strtok"
symbol is assigned a value that is never used: "index"
undefined symbol "strtok"
array must be indexed (variable "cmd")
undefined symbol "strtok"
array must be indexed (variable "tmp")
undefined symbol "strtok"
Nгo sгo sу estes aн, sу coloquei atй aн, durante as prуximas linhas ele fica repetindo-se os mesmos errors.
No total sгo 26 errors, se precisarem das linhas me falem.
Reply
#5

Vocк colocou dois return!
PHP код:
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;

Reply
#6

Mesma coisa, com ou sem strtok, 26 errors.
Reply
#7

Ai parзa tu esqueceu de por ;

No final
Код:
while (index < length) && (string[index] > ' ') && ((index - offset) < (sizeof(result) - 1)))
Usa este
Код:
while (index < length) && (string[index] > ' ') && ((index - offset) < (sizeof(result) - 1)));
Reply
#8

Quote:
Originally Posted by RedMF
Посмотреть сообщение
Ai parзa tu esqueceu de por ;

No final
Код:
while (index < length) && (string[index] > ' ') && ((index - offset) < (sizeof(result) - 1)))
Usa este
Код:
while (index < length) && (string[index] > ' ') && ((index - offset) < (sizeof(result) - 1)));
While, assim como For, й um loop, logo nгo existe ponto e vнrgula no mesmo. (por isso os brackets)

Код:
while(numero)
{

}
Reply


Forum Jump:


Users browsing this thread: 2 Guest(s)