SA-MP Forums Archive
error 035: argument type mismatch (argument 2) - 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 035: argument type mismatch (argument 2) (/showthread.php?tid=577145)



error 035: argument type mismatch (argument 2) - hhaaoo123 - 09.06.2015

Quote:

stock FacRemoveMemberFromFile(playerid) {
new tmp[MAX_PLAYER_NAME + 2];
if(GetPlayerName(playerid, tmp, MAX_PLAYER_NAME)) {
strcat(tmp, "\r\n");
return RemoveTextFromFile("factions/SAPD/SAPDmembers.ini", tmp);}
return false;
}

Quote:

stock RemoveTextFromFile(filename[], line){
new count, string[256], File:file, File:temp;

file= fopen(filename, io_read);
temp = fopen("tmpfile.tmp", io_write);
while (fread(file, string))
if (++count != line)
fwrite(temp, string);
fclose(file);
fclose(temp);
file= fopen(filename, io_write);
temp = fopen("tmpfile.tmp", io_read);
while (fread(temp, string))
fwrite(file, string);
fclose(file);
fclose(temp);
fremove("tmpfile.tmp");
return true;
}

Quote:

(2855) : error 035: argument type mismatch (argument 2)

Line 2855
Quote:

return RemoveTextFromFile("factions/SAPD/SAPDmembers.ini", tmp);}

What did I do wrong?


Re: error 035: argument type mismatch (argument 2) - X337 - 09.06.2015

Second parameter must be integer, i think you've some mistake on your function.


Re: error 035: argument type mismatch (argument 2) - hhaaoo123 - 09.06.2015

Now I get this error?
Quote:

stock RemoveTextFromFile(filename[], line[]){
new count, string[256], File:file, File:temp;

file= fopen(filename, io_read);
temp = fopen("tmpfile.tmp", io_write);
while (fread(file, string))
if (++count != line)
fwrite(temp, string);
fclose(file);
fclose(temp);
file= fopen(filename, io_write);
temp = fopen("tmpfile.tmp", io_read);
while (fread(temp, string))
fwrite(file, string);
fclose(file);
fclose(temp);
fremove("tmpfile.tmp");
return true;
}

I get error on this line
Quote:

if (++count != line)

It says the array must be indexed ?