[HELP] String problem in includes.
#1

Hello, how to change this include so I don't get this error?

Код:
IsNumeric(const string[])
{
	for (new i = 0, j = strlen(string); i < j; i++)
	{
		if (string[i] > '9' || string[i] < '0') return 0;
	}
	return 1;
}
Код:
stock DINI_StripNewLine(string[]) {
	new len = strlen(string);
	if (string[0]==0) return ;
	if ((string[len - 1] == '\n') || (string[len - 1] == '\r')) {
		string[len - 1] = 0;
		if (string[0]==0) return ;
		if ((string[len - 2] == '\n') || (string[len - 2] == '\r')) string[len - 2] = 0;
	}
}
Код:
C:\Server\pawno\include\utils.inc(1) : warning 219: local variable "string" shadows a variable at a preceding level
C:\Server\pawno\include\dini.inc(239) : warning 219: local variable "string" shadows a variable at a preceding level
Reply
#2

try redownloading utils && dini
Reply
#3

Doesn't work also. Same errors.
Reply
#4

maybe this will work
pawn Код:
stock IsNumeric(const string[]) //By Jan "DracoBlue" Schьtze (edited by Gabriel "Larcius" Cordes
{
    new length=strlen(string);
    if(length==0)
    {
        return 0;
    }
    for (new i=0; i<length; i++)
    {
        if (!((string[i] <= '9' && string[i] >= '0') || (i==0 && (string[i]=='-' || string[i]=='+'))))
        {
            return false;
        }
    }
    return 0;
}
edit: unless its prob with dini which i know nothing about.
Reply
#5

Nop, same warnings..
Reply
#6

The problem is that your script, or another one of your includes uses a variable called string on a global level.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)