SA-MP Forums Archive
Basic File Problem - 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)
+---- Forum: Help Archive (https://sampforum.blast.hk/forumdisplay.php?fid=89)
+---- Thread: Basic File Problem (/showthread.php?tid=124174)



Basic File Problem - bluray - 29.01.2010

Hey fellow scripters :P,
i got a basic wiki script for saving names one a .txt file
the code is:
Код:
	new string[30];
	new pname[24], File:ftw=fopen("names.txt", io_append);
  	GetPlayerName(playerid, pname, 24);
    format(string, 30, "%s\r\n", pname);
    fwrite(ftw, string);
  	fclose(ftw);
anywaiz im new to all this file stuff (hence me copyin the wiki) is there a way to have all the players name come on the .txt file without repeating its self cause now like when my npcs join each time i restart server they come up again in the file. I hope you guys understand.

Thanks
Ray




Re: Basic File Problem - pagie1111 - 29.01.2010

No I don't understand what you want. Explain deeper?


Re: Basic File Problem - Vetle - 29.01.2010

use io_write


Re: Basic File Problem - bluray - 29.01.2010

ok i was told according to wiki io_write overwrite things already in file. and io_append writes fine.
The problem is. in my text file i get this:
Код:
Ray
npc1
npc1
npc1
ray
craig
i get the name NPC1 and Ray so many time is because each time i host the server the npc connects and his name goes on the list. I want a code to fix my one so that if npc1 is already in the list pawno wont write npc1 again. Ill explain it better again if u want.
Thanks for all the help
Ray


Re: Basic File Problem - bluray - 02.02.2010

anyone please, sorry for the bumb but its been a couple of days .