SA-MP Forums Archive
2 ERRORS AGAIN { Sorry for spam but i need help } - 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: 2 ERRORS AGAIN { Sorry for spam but i need help } (/showthread.php?tid=621922)



2 ERRORS AGAIN { Sorry for spam but i need help } - RedRex - 16.11.2016

I Have now 2 Errors From THis can you help me??

PHP код:
test.pwn(14202) : error 021symbol already defined"strreplace"
test.pwn(14219) : error 021symbol already defined"ret_memcpy" 
Codes>>

Код:
stock strreplace(trg[],newstr[],src[])
{
    new f = 0, s1[MAX_STRING], tmp[MAX_STRING];
    format(s1,sizeof(s1),"%s",src);
    f = strfind(s1,trg);
    tmp[0] = 0;
    while (f>=0)
	{
        strcat(tmp,ret_memcpy(s1, 0, f));
        strcat(tmp,newstr);
        format(s1,sizeof(s1),"%s",ret_memcpy(s1, f+strlen(trg), strlen(s1)-f));
        f = strfind(s1,trg);
    }
    strcat(tmp,s1);
    return tmp;
}
Код:
stock ret_memcpy(source[],index = 0,numbytes)
{
	new tmp[MAX_STRING], i = 0;
	tmp[0] = 0;
	if(index >= strlen(source)) return tmp;
	if(numbytes+index>=strlen(source)) numbytes=strlen(source)-index;
	if(numbytes<=0) return tmp;
	for(i = index; i < numbytes + index; i++)
	{
		tmp[i-index] = source[i];
		if(source[i] == 0) return tmp;
	}
	tmp[numbytes] = 0;
	return tmp;
}
help help help


Re: 2 ERRORS AGAIN { Sorry for spam but i need help } - grymtn - 16.11.2016

try deleting tthose stocks because they are already defined in code before those stocks are extra it will work if it wont you can do undo write here if it works


Re: 2 ERRORS AGAIN { Sorry for spam but i need help } - TwinkiDaBoss - 16.11.2016

Well its simple, read what the error says "symbol already defined". It means you already defined them (you have them 2x or some include makes them for you). Remove those 2 functions (stock).


Re: 2 ERRORS AGAIN { Sorry for spam but i need help } - RedRex - 16.11.2016

Yes i already have

Код:
new ret_memcpy; 
new strreplace;
and yes


Re: 2 ERRORS AGAIN { Sorry for spam but i need help } - grymtn - 16.11.2016

Quote:
Originally Posted by RedRex
Посмотреть сообщение
Yes i already have

Код:
new ret_memcpy; 
new strreplace;
and yes
delete those stocks it will work


Re: 2 ERRORS AGAIN { Sorry for spam but i need help } - RedRex - 16.11.2016

omg where.... im not find it i check all includes + Filterscripts im not find it...


Re: 2 ERRORS AGAIN { Sorry for spam but i need help } - grymtn - 16.11.2016

Quote:
Originally Posted by RedRex
Посмотреть сообщение
I Have now 2 Errors From THis can you help me??

PHP код:
test.pwn(14202) : error 021symbol already defined"strreplace"
test.pwn(14219) : error 021symbol already defined"ret_memcpy" 
Codes>>

Код:
stock strreplace(trg[],newstr[],src[])
{
    new f = 0, s1[MAX_STRING], tmp[MAX_STRING];
    format(s1,sizeof(s1),"%s",src);
    f = strfind(s1,trg);
    tmp[0] = 0;
    while (f>=0)
	{
        strcat(tmp,ret_memcpy(s1, 0, f));
        strcat(tmp,newstr);
        format(s1,sizeof(s1),"%s",ret_memcpy(s1, f+strlen(trg), strlen(s1)-f));
        f = strfind(s1,trg);
    }
    strcat(tmp,s1);
    return tmp;
}
Код:
stock ret_memcpy(source[],index = 0,numbytes)
{
	new tmp[MAX_STRING], i = 0;
	tmp[0] = 0;
	if(index >= strlen(source)) return tmp;
	if(numbytes+index>=strlen(source)) numbytes=strlen(source)-index;
	if(numbytes<=0) return tmp;
	for(i = index; i < numbytes + index; i++)
	{
		tmp[i-index] = source[i];
		if(source[i] == 0) return tmp;
	}
	tmp[numbytes] = 0;
	return tmp;
}
help help help
these stocks you just gave us

try deleting them then compiling


Re: 2 ERRORS AGAIN { Sorry for spam but i need help } - GoldenLion - 16.11.2016

Hey guys, have a look here: https://sampforum.blast.hk/showthread.php?tid=570635
People keep calling functions stocks so I'm trying to help.