SA-MP Forums Archive
[HELP] String problem in includes. - 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: [HELP] String problem in includes. (/showthread.php?tid=164403)



[HELP] String problem in includes. - MartinDee - 31.07.2010

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



Re: [HELP] String problem in includes. - willsuckformoney - 31.07.2010

try redownloading utils && dini


Re: [HELP] String problem in includes. - MartinDee - 31.07.2010

Doesn't work also. Same errors.


Re: [HELP] String problem in includes. - iggy1 - 31.07.2010

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.


Re: [HELP] String problem in includes. - MartinDee - 31.07.2010

Nop, same warnings..


Re: [HELP] String problem in includes. - kc - 31.07.2010

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