Fdelete code
From SA-MP Wiki
Contents |
Description
Fdelete was made by Sacky.
Use
See File_Functions for how to use this code when saving stats.
Code
Add this near the top of the script to be able to use fcreate:
fdeleteline(filename[], line[]){ if(fexist(filename)){ new temp[256]; new File:fhandle = fopen(filename,io_read); fread(fhandle,temp,sizeof(temp),false); if(strfind(temp,line,true)==-1){return 0;} else{ fclose(fhandle); fremove(filename); for(new i=0;i<strlen(temp);i++){ new templine[256]; strmid(templine,temp,i,i+strlen(line)); if(equal(templine,line,true)){ strdel(temp,i,i+strlen(line)); fcreate(filename); fhandle = fopen(filename,io_write); fwrite(fhandle,temp); fclose(fhandle); return 1; } } } } return 0; }
fcreate
fcreate came with fcreate. Here is the fcreate code