SA-MP Forums

Go Back   SA-MP Forums > SA-MP Scripting and Plugins > Scripting Help

Reply
 
Thread Tools Display Modes
Old 27/09/2016, 02:29 AM   #1
PrinceKumar
Huge Clucker
 
Join Date: Apr 2013
Posts: 432
Reputation: 6
Default symbol already defined: "StripNewLine"

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
PrinceKumar is offline   Reply With Quote
Old 27/09/2016, 02:39 AM   #2
Tass007
Gangsta
 
Tass007's Avatar
 
Join Date: May 2011
Location: Somewhere not near you
Posts: 733
Reputation: 31
Default Re: symbol already defined: "StripNewLine"

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"??
__________________
Copyright 2016 vR Studios
Currently working with vR Studios
Copying and pasting doesn't allow you to learn the things that reading and understanding will.
Tass007 is offline   Reply With Quote
Old 27/09/2016, 02:43 AM   #3
PrinceKumar
Huge Clucker
 
Join Date: Apr 2013
Posts: 432
Reputation: 6
Default Re: symbol already defined: "StripNewLine"

if i delete

Code:
stock StripNewLine(string[])
{
then i cant compile it
PrinceKumar is offline   Reply With Quote
Old 27/09/2016, 03:02 AM   #4
Tass007
Gangsta
 
Tass007's Avatar
 
Join Date: May 2011
Location: Somewhere not near you
Posts: 733
Reputation: 31
Default Re: symbol already defined: "StripNewLine"

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.
__________________
Copyright 2016 vR Studios
Currently working with vR Studios
Copying and pasting doesn't allow you to learn the things that reading and understanding will.
Tass007 is offline   Reply With Quote
Old 27/09/2016, 03:21 AM   #5
PrinceKumar
Huge Clucker
 
Join Date: Apr 2013
Posts: 432
Reputation: 6
Default Re: symbol already defined: "StripNewLine"

how sir?
PrinceKumar is offline   Reply With Quote
Old 27/09/2016, 04:42 AM   #6
Tass007
Gangsta
 
Tass007's Avatar
 
Join Date: May 2011
Location: Somewhere not near you
Posts: 733
Reputation: 31
Default Re: symbol already defined: "StripNewLine"

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.
__________________
Copyright 2016 vR Studios
Currently working with vR Studios
Copying and pasting doesn't allow you to learn the things that reading and understanding will.
Tass007 is offline   Reply With Quote
Old 27/09/2016, 05:38 AM   #7
PrinceKumar
Huge Clucker
 
Join Date: Apr 2013
Posts: 432
Reputation: 6
Default Re: symbol already defined: "StripNewLine"

we dont have sir? just one StripNewLine.i cant find more StripnewLine
PrinceKumar is offline   Reply With Quote
Old 27/09/2016, 05:47 AM   #8
iLearner
Guest
 
Posts: n/a
Default Re: symbol already defined: "StripNewLine"

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.
  Reply With Quote
Old 27/09/2016, 05:52 AM   #9
SickAttack
High-roller
 
Join Date: Dec 2013
Posts: 4,761
Reputation: 754
Default Re: symbol already defined: "StripNewLine"

Try undefining it after the includes:

#undef StripNewLine
SickAttack is offline   Reply With Quote
Old 27/09/2016, 08:58 AM   #10
PrinceKumar
Huge Clucker
 
Join Date: Apr 2013
Posts: 432
Reputation: 6
Default Re: symbol already defined: "StripNewLine"

Quote:
Try undefining it after the includes:
Quote:
#undef StripNewLine

where do i put this
Code:
 
#undef StripNewline
PrinceKumar is offline   Reply With Quote
Reply

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
error 021: symbol already defined: "Audio_OnGameModeInit" :"( krasjahn1023 Scripting Help 2 17/10/2014 10:47 AM
E:\WFG-RP\gamemodes\WFG-RP.pwn(112840) : error 021: symbol already defined: "S@@_OnObjectMoved" vothanhdat Scripting Help 1 07/01/2014 12:13 PM
symbol already defined: "AddPlayerClass" (Easy Fix - Just need a bit of help.) Jarred Miller Scripting Help 0 11/09/2012 01:45 AM
"error 021: symbol already defined:" Problem. [Bm]rap45 Help Archive 1 29/12/2009 06:36 AM
error 021: symbol already defined: "SendRconCommand" Think Help Archive 4 24/04/2009 06:38 AM


All times are GMT. The time now is 07:29 AM.


Powered by vBulletin® Version 3.8.6
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.