SA-MP Forums Archive
symbol already defined: "StripNewLine" - 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)
+--- Thread: symbol already defined: "StripNewLine" (/showthread.php?tid=617830)



symbol already defined: "StripNewLine" - PrinceKumar - 27.09.2016

Code:
stock 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;
    }
}

stock StripColorEmbedding(string[])
{
 	new i, tmp[7];
  	while (i < strlen(string) - 7)
	{
	    if (string[i] == '{' && string[i + 7] == '}')
		{
		    strmid(tmp, string, i + 1, i + 7);
			if (ishex(tmp))
			{
				strdel(string, i, i + 8);
				i = 0;
				continue;
			}
		}
		i++;
  	}
}

stock strtoupper(string[])
{
        new retStr[128], i, j;
        while ((j = string[i])) retStr[i++] = chrtoupper(j);
        retStr[i] = '\0';
        return retStr;
}

stock wordwrap(string[], width, seperator[] = "\n", dest[], size = sizeof(dest))
{
    if (dest[0])
    {
        dest[0] = '\0';
    }
    new
        length,
        multiple,
        processed,
        tmp[192];

    strmid(tmp, string, 0, width);
    length = strlen(string);

    if (width > length || !width)
    {
        memcpy(dest, string, _, size * 4, size);
        return 0;
    }
    for (new i = 1; i < length; i ++)
    {
        if (tmp[0] == ' ')
        {
            strdel(tmp, 0, 1);
        }
        multiple = !(i % width);
        if (multiple)
        {
            strcat(dest, tmp, size);
            strcat(dest, seperator, size);
            strmid(tmp, string, i, width + i);
            if (strlen(tmp) < width)
            {
                strmid(tmp, string, (width * processed) + width, length);
                if (tmp[0] == ' ')
                {
                    strdel(tmp, 0, 1);
                }
                strcat(dest, tmp, size);
                break;
            }
            processed++;
            continue;
        }
        else if (i == length - 1)
        {
            strmid(tmp, string, (width * processed), length);
            strcat(dest, tmp, size);
            break;
        }
    }
    return 1;
}
if i delete that StripNewLine i cant compile


Re: symbol already defined: "StripNewLine" - Tass007 - 27.09.2016

If you delete

PHP Code:
stock 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;
    }

You get symbol already defined: "StripNewLine"??


Re: symbol already defined: "StripNewLine" - PrinceKumar - 27.09.2016

if i delete

Code:
stock StripNewLine(string[])
{
then i cant compile it


Re: symbol already defined: "StripNewLine" - Tass007 - 27.09.2016

Of course that's going to happen because you'll have the extra code of

PHP Code:
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;
    }

That is basically sitting in your script.

There is something else in your script that is assigned the name of StripNewLine.

If you need more help do a search in your script and post all the aspects of your script that have StripNewLine in them. Include the whole function please.


Re: symbol already defined: "StripNewLine" - PrinceKumar - 27.09.2016

how sir?


Re: symbol already defined: "StripNewLine" - Tass007 - 27.09.2016

Do CTRL + F in pawno. And type in StripNewLine. Then copy that line. Then press F3 if there are more copy them and then paste them here.


Re: symbol already defined: "StripNewLine" - PrinceKumar - 27.09.2016

we dont have sir? just one StripNewLine.i cant find more StripnewLine


Re: symbol already defined: "StripNewLine" - iLearner - 27.09.2016

Simply name your function with another name, another one named like that might be somewhere maybe include files, so best option simply rename that strip thing.


Re: symbol already defined: "StripNewLine" - SickAttack - 27.09.2016

Try undefining it after the includes:

#undef StripNewLine


Re: symbol already defined: "StripNewLine" - PrinceKumar - 27.09.2016

Quote:

Try undefining it after the includes:

Quote:

#undef StripNewLine

where do i put this
Code:
 
#undef StripNewline