Couple of Errors
#1

Hey guys, I got a Script today and it won't compile because of some errors.

This is the script:
Код:
public LoadIRC()
{
	new arrCoords[5][64];
	new strFromFile2[256];
	new File: file = fopen("channels.cfg", io_read);
	if (file)
	{
		new idx;
		while (idx < )sizeof(IRCInfo)); // This is 7896
		{
			fread(file, strFromFile2);
			split(strFromFile2, arrCoords, '|');
			strmid(IRCInfo[idx][iAdmin], arrCoords[0], 0, strlen(arrCoords[0]), 255);
			strmid(IRCInfo[idx][iMOTD], arrCoords[1], 0, strlen(arrCoords[1]), 255);
			strmid(IRCInfo[idx][iPassword], arrCoords[2], 0, strlen(arrCoords[2]), 255);
			IRCInfo[idx][iNeedPass] = strval(arrCoords[3]);
			IRCInfo[idx][iLock] = strval(arrCoords[4]);
			printf("IRC:%d Admin:%s MOTD: %s Passwort: %s NeedPass: %d Lock: %d",idx,IRCInfo[idx][iAdmin],IRCInfo[idx][iMOTD],IRCInfo[idx][iPassword],IRCInfo[idx][iNeedPass],IRCInfo[idx][iLock]);
			idx++;
		}
		fclose(file);
	}
	return 1;
}
And these are the errors/warnings:
selfmade.pwn(7896) : error 029: invalid expression, assumed zero
selfmade.pwn(7896) : warning 215: expression has no effect
selfmade.pwn(7896) : error 001: expected token: ";", but found ")"
selfmade.pwn(7896) : error 029: invalid expression, assumed zero
selfmade.pwn(7896) : fatal error 107: too many error messages on one line

I'm pretty confused now.
Thanks in advance!
Reply
#2

I did it

pawn Код:
public LoadIRC()
{
    new arrCoords[5][64];
    new strFromFile2[256];
    new File: file = fopen("channels.cfg", io_read);
    if (file)
    {
        new idx;
        while (idx < sizeof(IRCInfo)) // This is 7896
        {
            fread(file, strFromFile2);
            split(strFromFile2, arrCoords, '|');
            strmid(IRCInfo[idx][iAdmin], arrCoords[0], 0, strlen(arrCoords[0]), 255);
            strmid(IRCInfo[idx][iMOTD], arrCoords[1], 0, strlen(arrCoords[1]), 255);
            strmid(IRCInfo[idx][iPassword], arrCoords[2], 0, strlen(arrCoords[2]), 255);
            IRCInfo[idx][iNeedPass] = strval(arrCoords[3]);
            IRCInfo[idx][iLock] = strval(arrCoords[4]);
            printf("IRC:%d Admin:%s MOTD: %s Passwort: %s NeedPass: %d Lock: %d",idx,IRCInfo[idx][iAdmin],IRCInfo[idx][iMOTD],IRCInfo[idx][iPassword],IRCInfo[idx][iNeedPass],IRCInfo[idx][iLock]);
            idx++;
        }
        fclose(file);
    }
    return 1;
}
I hope that i have helped
Reply
#3

Thanks but it's somehow not working:

Errors:
selfmade.pwn(7895) : error 001: expected token: "-identifier-", but found ";"
selfmade.pwn(7896) : error 029: invalid expression, assumed zero
selfmade.pwn(7896) : error 001: expected token: ")", but found "sizeof"
selfmade.pwn(7896) : warning 215: expression has no effect
selfmade.pwn(7896) : error 001: expected token: ";", but found ")"
selfmade.pwn(7896) : fatal error 107: too many error messages on one line

Code:
Код:
public LoadIRC()
{
    new arrCoords[5][64];
    new strFromFile2[256];
    new File: file = fopen("channels.cfg", io_read);
    if (file)
    {
        new idx; // This ist 7895
        while (idx < sizeof(IRCInfo)) // This is 7896
        {
            fread(file, strFromFile2);
            split(strFromFile2, arrCoords, '|');
            strmid(IRCInfo[idx][iAdmin], arrCoords[0], 0, strlen(arrCoords[0]), 255);
            strmid(IRCInfo[idx][iMOTD], arrCoords[1], 0, strlen(arrCoords[1]), 255);
            strmid(IRCInfo[idx][iPassword], arrCoords[2], 0, strlen(arrCoords[2]), 255);
            IRCInfo[idx][iNeedPass] = strval(arrCoords[3]);
            IRCInfo[idx][iLock] = strval(arrCoords[4]);
            printf("IRC:%d Admin:%s MOTD: %s Passwort: %s NeedPass: %d Lock: %d",idx,IRCInfo[idx][iAdmin],IRCInfo[idx][iMOTD],IRCInfo[idx][iPassword],IRCInfo[idx][iNeedPass],IRCInfo[idx][iLock]);
            idx++;
        }
        fclose(file);
    }
    return 1;
}
Reply
#4

It is strange, i compiled it here and it worked

The IRCInfo multidimensional variable is from GodFather Gamemode, and it is normally 10, so, i think that it will solve your problem :

If it did not work yet, sorry, i did what i could.


pawn Код:
public LoadIRC()
{
    new arrCoords[5][64];
    new strFromFile2[256];
    new File: file = fopen("channels.cfg", io_read);
    if (file)
    {
        for(new idx = 0; idx < 10; idx++)
        {
            fread(file, strFromFile2);
            split(strFromFile2, arrCoords, '|');
            strmid(IRCInfo[idx][iAdmin], arrCoords[0], 0, strlen(arrCoords[0]), 255);
            strmid(IRCInfo[idx][iMOTD], arrCoords[1], 0, strlen(arrCoords[1]), 255);
            strmid(IRCInfo[idx][iPassword], arrCoords[2], 0, strlen(arrCoords[2]), 255);
            IRCInfo[idx][iNeedPass] = strval(arrCoords[3]);
            IRCInfo[idx][iLock] = strval(arrCoords[4]);
            printf("IRC:%d Admin:%s MOTD: %s Passwort: %s NeedPass: %d Lock: %d",idx,IRCInfo[idx][iAdmin],IRCInfo[idx][iMOTD],IRCInfo[idx][iPassword],IRCInfo[idx][iNeedPass],IRCInfo[idx][iLock]);
        }
        fclose(file);
    }
    return 1;
}
I hope that i have helped
Reply
#5

Anyway thanks, I just commented the IRC Function. I never need it anyway
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)