HelpMe #9 [+REP]
#5

pawn Код:
native File:fopen(const name[], filemode: mode = io_readwrite);
native bool:fclose(File: handle);
native File:ftemp();
native bool:fremove(const name[]);

native fwrite(File: handle, const string[]);
native fread(File: handle, string[], size = sizeof string, bool: pack = false);
native bool:fputchar(File: handle, value, bool: utf8 = true);
native fgetchar(File: handle, value, bool: utf8 = true);
native fblockwrite(File: handle, const buffer[], size = sizeof buffer);
native fblockread(File: handle, buffer[], size = sizeof buffer);

native fseek(File: handle, position = 0, seek_whence: whence = seek_start);
native flength(File: handle);
native fexist(const pattern[]);
native bool:fmatch(name[], const pattern[], index = 0, size = sizeof name);
//you can find what each function does in Samp-Wiki.


//writting
new Name[28];
GetPlayerName(playerid, Name, 24);
format(Name, sizeof(Name), "%s.ini", Name);
new File:newfile = fopen(Name, io_write);
if(Computer[playerid] == true)
    fwrite(newfile, "Computer=Yes");
if(Phone[playerid] == true)
    fwrite(newfile, "Phone=Yes");
fclose(newfile);

//reading
new Name[28];
GetPlayerName(playerid, Name, 24);
format(Name, sizeof(Name), "%s.ini", Name);
if(!fexist(Name)) return 1;
new File:newfile = fopen(Name, io_read);
new string[128];
fread(newfile, string);
if(strfind(string, "Computer=Yes") != -1)
    Computer[playerid] = true;
if(strfind(string, "Phone=Yes") != -1)
    Phone[playerid] = true;
fclose(newfile);
Reply


Messages In This Thread
HelpMe #9 [+REP] - by NessaHD - 24.11.2011, 16:18
Re: HelpMe #9 [+REP] - by -CaRRoT - 24.11.2011, 16:20
Re: HelpMe #9 [+REP] - by Pharrel - 24.11.2011, 16:23
Re: HelpMe #9 [+REP] - by NessaHD - 24.11.2011, 16:23
Re: HelpMe #9 [+REP] - by Pharrel - 24.11.2011, 16:44
Re: HelpMe #9 [+REP] - by NessaHD - 24.11.2011, 16:49
Re: HelpMe #9 [+REP] - by Sinc - 24.11.2011, 18:50

Forum Jump:


Users browsing this thread: 1 Guest(s)