MAX_STRING Error ?
#1

Hello, I'm getting an error code when you use max_string stock. What is the problem ?

Sorry, For My Bad English.

Please help.

Код:
CMD:test(playerid,params[])
{
kickle(playerid,"ı ğ ь ş ц з");
return 1;
}

stock code(nickname[]) {
new tmp[MAX_STRING];
set(tmp,nickname);
tmp=strreplace("ğ","g",tmp);
tmp=strreplace("Ğ","G",tmp);
tmp=strreplace("ş","s",tmp);
tmp=strreplace("Ş","S",tmp);
tmp=strreplace("ı","i",tmp);
tmp=strreplace("I","I",tmp);
tmp=strreplace("İ","I",tmp);
tmp=strreplace("ц","o",tmp);
tmp=strreplace("Ц","O",tmp);
tmp=strreplace("з","c",tmp);
tmp=strreplace("З","C",tmp);
tmp=strreplace("ь","u",tmp);
tmp=strreplace("Ь","U",tmp);
return tmp;
}

stock kickle(playerid, string[])
{
new Years, Months, Days,estring[250];
getdate(Years, Months, Days);
format(estring,sizeof(estring),"{993366}Kickleyen Admin:\t\t{FFFFFF}Anti Hile\n{993366}Sebep:\t\t\t\t{FFFFFF}%s\n{993366}Tarih:\t\t\t\t{FFFFFF}%02d/%02d/%d", string, Days, Months, Years);
ShowPlayerDialog(playerid,123,DIALOG_STYLE_MSGBOX,"{47C9F5}« xPro Gaming » {ffffff}Anti Hile - Kick",estring,"Tamam","");
format(textmesaj,250,"~g~~h~~h~[Anti Hile] ~r~~h~~h~%s(%d) ~w~~h~adli oyuncu sunucudan atildi. Sebep: ~y~~h~%s",getName(playerid),playerid,code(string));
Textdrawyazi(-1, textmesaj);
printf("\n%s(%d) >> kicklendi. Sebep: %s\n",getName(playerid),playerid,code(string));
Kick(playerid);
return 1;
}
Код:
D:\Server\Server\gamemodes\xPro.pwn(30605) : error 017: undefined symbol "MAX_STRING"
D:\Server\Server\gamemodes\xPro.pwn(30605) : error 009: invalid array size (negative, zero or out of bounds)
D:\Server\Server\gamemodes\xPro.pwn(30605) : error 036: empty statement
D:\Server\Server\gamemodes\xPro.pwn(30605) : fatal error 107: too many error messages on one line

Compilation aborted.Pawn compiler 3.2.3664	 	 	Copyright © 1997-2006, ITB CompuPhase


4 Errors.

FIX:

Код:
#define MAX_STRING              256

stock strreplace(trg[],newstr[],src[]) {
    new f=0;
    new s1[MAX_STRING];
    new 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;
}
ret_memcpy(source[],index=0,numbytes) {
	new tmp[MAX_STRING];
	new 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;
}
stock set(dest[],source[]) {
	new count = strlen(source);
	new i=0;
	for (i=0;i<count;i++) {
		dest[i]=source[i];
	}
	dest[count]=0;
}
Reply


Messages In This Thread
MAX_STRING Error ? - by sampkinq - 10.01.2016, 13:47
Re: MAX_STRING Error ? - by GTLS - 10.01.2016, 13:53
Re: MAX_STRING Error ? - by sampkinq - 10.01.2016, 13:58
Re: MAX_STRING Error ? - by GTLS - 10.01.2016, 16:00
Re: MAX_STRING Error ? - by Vince - 10.01.2016, 16:16

Forum Jump:


Users browsing this thread: 1 Guest(s)