What crashing here ? && Function that crash -
tal_peretz - 18.02.2012
1. I did this in start of OnPlayerCommandText -
PHP код:
if(!dini_Exists("CommandsPlayers.ini"))
dini_Create("CommandsPlayers.ini");
new Hour, Minute, Second;
gettime(Hour, Minute, Second);
format(string,128,"[%d:%d:%d] %s - %s \r\n",Hour, Minute, Second, GetName(playerid),cmdtext);
new File:pick5 = fopen("CommandsPlayers.ini",io_append);
fwrite(pick5,string);
fclose(pick5);
most of the times it's work, but sometimes it makes the server falls .. why ?
2. give me function that make the server to fall [I want to check something] [I mean wrong way that will serve to fall]
Thanks Alot !!!
Re: What crashing here ? && Function that crash -
aRoach - 18.02.2012
Try this:
pawn Код:
if( !fexist( "CommandsPlayers.ini" ) ) dini_Create("CommandsPlayers.ini");
new Hour, Minute, Second;
gettime( Hour, Minute, Second );
format( string, 128, "[%d:%d:%d] %s - %s \r\n", Hour, Minute, Second, GetName( playerid ),cmdtext );
new File:pick5 = fopen( "CommandsPlayers.ini", io_write );
fwrite( pick5, string );
fclose( pick5 );
Re: What crashing here ? && Function that crash -
iPLEOMAX - 18.02.2012
pawn Код:
new Hour, Minute, Second;
gettime(Hour, Minute, Second); new string[128];
format(string,128,"[%d:%d:%d] %s - %s \r\n",Hour, Minute, Second, GetName(playerid),cmdtext);
new File:pick5;
if(!fexist("CommandsPlayers.ini"))
{
pick5 = fopen("CommandsPlayers.ini", io_write);
} else pick5 = fopen("CommandsPlayers.ini",io_append);
fwrite(pick5,string);
fclose(pick5);
Re: What crashing here ? && Function that crash -
tal_peretz - 18.02.2012
What was the problam? I don't know fini so I want you to be sure it works ...
and what about function that crash the server?
Thanks !
Re: What crashing here ? && Function that crash -
iPLEOMAX - 18.02.2012
It was this crashing the server:
pawn Код:
fopen("CommandsPlayers.ini",io_append); //<-- the io_append part
If the file doesn't exist, using io_append or io_read will crash the server.
Re: What crashing here ? && Function that crash -
tal_peretz - 18.02.2012
OK thanks !