SA-MP Forums Archive
FOpen - 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: FOpen (/showthread.php?tid=125932)



FOpen - Mechscape - 06.02.2010

https://sampwiki.blast.hk/wiki/Fopen

But, i created this:
Код:
new File:string1 = fopen("varuserverlogi.log", io_write);
fwrite(string1, "Server started!\n");
fclose(string1);
And i restart 2x server, now i open that file, but theres 1x line, must be it 2x line?


Re: FOpen - ¤Adas¤ - 06.02.2010

Try:
pawn Код:
if(fexist("blahblah.log(or what)")) string1 = fopen("blahblah.log(or what)", io_append);



Re: FOpen - Mechscape - 06.02.2010

new Filetring1 = fopen("varuserverlogi.log", io_append);

tryed, but same it line.


Re: FOpen - Mechscape - 06.02.2010

Can anyone help to fix that:
Код:
public VaruServerilogi1()
{
	if(StringerServer == 1)
	{
	  if(fexist("varuserverlogi.log"))
	  {
			new File:string1 = fopen("varuserverlogi.log", io_write);
  			if(fexist("varuserverlogi.log")) string1 = fopen("varuserverlogi.log", io_append);
			fwrite(string1, "Server started!\n");
			fclose(string1);
			print("[VARUSERVERILOGI] - FILE WRITTED!");
			StringerServer = 0;
		}
		else
		{
		  print("------------------ERROR-------------------");
		  print("-FILE DOENST EXIST'S! STOPPING TO WORKING!-");
		  print("------------------ERROR-------------------");
		  SendRconCommand("exit");
		}
		return 1;
	}
	return 1;
}
It must be write like add "Server started!" in file. Not overwrite it 1x line.


Re: FOpen - ¤Adas¤ - 06.02.2010

You mean this?
pawn Код:
public VaruServerilogi1()
{
    if(StringerServer == 1)
    {
            new File:string1;
            if(fexist("varuserverlogi.log")) string1 = fopen("varuserverlogi.log", io_append);
            else string1 = fopen("varuserverlogi.log", io_write);
            fwrite(string1, "Server started!\n");
            fclose(string1);
            print("[VARUSERVERILOGI] - FILE WRITTED!");
            StringerServer = 0;

    }
    return 1;
}



Re: FOpen - Mechscape - 06.02.2010

tryed this, didnt writted to file...

and this print didnt printed..


Re: FOpen - ¤Adas¤ - 06.02.2010

Then the mistake is in your script... On a different place maybe.


Re: FOpen - Mechscape - 06.02.2010

Код:
public OnGameModeInit()
{
   VaruServerilogi1();
}



Re: FOpen - ¤Adas¤ - 06.02.2010

pawn Код:
public VaruServerilogi1()
{
new File:string1;
if(fexist("varuserverlogi.log")) string1 = fopen("varuserverlogi.log", io_append);
else string1 = fopen("varuserverlogi.log", io_write);
fwrite(string1, "Server started!\n");
fclose(string1);
print("[VARUSERVERILOGI] - FILE WRITTED!");
}
return 1;
}
This is the last chance.


Re: FOpen - Mechscape - 06.02.2010

Thanks, now working.