What crashing here ? && Function that crash
#1

1. I did this in start of OnPlayerCommandText -

PHP код:
if(!dini_Exists("CommandsPlayers.ini"))
    
dini_Create("CommandsPlayers.ini");
    new 
HourMinuteSecond;
    
gettime(HourMinuteSecond);
       
format(string,128,"[%d:%d:%d] %s - %s \r\n",HourMinuteSecondGetName(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 !!!
Reply
#2

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 );
Reply
#3

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);
Reply
#4

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 !
Reply
#5

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.
Reply
#6

OK thanks !
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)