16.11.2016, 16:52
I Have now 2 Errors From THis can you help me??
Codes>>
help help help
PHP код:
test.pwn(14202) : error 021: symbol already defined: "strreplace"
test.pwn(14219) : error 021: symbol already defined: "ret_memcpy"
Код:
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; }