SA-MP Forums Archive
Error compile,undefined symbol/argument mismatch - 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: Error compile,undefined symbol/argument mismatch (/showthread.php?tid=422753)



Error compile,undefined symbol/argument mismatch - Creax - 15.03.2013

Код:
forward VipCount();
public VipCount()
{
    static tmp[128];
    new File:ss=fopen(FILE_VIP,io_read);

    while(fread(ss,tmp))
    {
        if(strfind(tmp, "=") != -1)
        {
            DOF2_SetInt(FILE_VIP, strtok(strr,0,'='), strval(tmp)-1);
        }
    }
    fclose(ss);
    return 1;
}
Error:
Код:
error 017: undefined symbol "strr"
When I give new str[128]; shows up:
Код:
error 035: argument type mismatch (argument 2)



Re: Error compile,undefined symbol/argument mismatch - RicaNiel - 15.03.2013

Quote:
Originally Posted by Creax
Посмотреть сообщение
Код:
forward VipCount();
public VipCount()
{
    static tmp[128];
    new File:ss=fopen(FILE_VIP,io_read);

    while(fread(ss,tmp))
    {
        if(strfind(tmp, "=") != -1)
        {
            DOF2_SetInt(FILE_VIP, strtok(strr,0,'='), strval(tmp)-1);
        }
    }
    fclose(ss);
    return 1;
}
Error:
Код:
error 017: undefined symbol "strr"
When I give new str[128]; shows up:
Код:
error 035: argument type mismatch (argument 2)
where did you use this?
Код:
 VipCount()



Re: Error compile,undefined symbol/argument mismatch - Creax - 15.03.2013

Код:
forward MinutaFunc();
public MinutaFunc()
{

	gettime(Hours, Minutes);

	if(Hours == 23 && Minutes == 59){
		VipCount();
	}
	return 1;
}



Re: Error compile,undefined symbol/argument mismatch - Creax - 15.03.2013

Help?


Re: Error compile,undefined symbol/argument mismatch - Misiur - 15.03.2013

I suggest using some already existing ini system

pawn Код:
forward VipCount();
public VipCount()
{
    static tmp[128], str[127], pos;
    //Using io_read on nonexisting file will crash the server
    if(fexist(FILE_VIP)) {
        new File:ss = fopen(FILE_VIP,io_read);
        while(fread(ss,tmp))
        {
            pos = strfind(tmp, "=");
            if(pos != -1) {
                strmid(str, tmp, pos+1, strlen(tmp));  
                strmid(tmp, tmp, 0, pos-1);            
                DOF2_SetInt(FILE_VIP, tmp, strval(str)-1);
            }
        }
        fclose(ss);
    }
    return 1;
}
Not best solution, but whatever