Server Crashed After use any Admin CMD
#1

i see someone cheating so use /ban

After that server is crashing

Код:
[05:48:37] [debug] Server crashed while executing uxfbackup.amx
[05:48:37] [debug] AMX backtrace:
[05:48:37] [debug] #0 native fwrite () [0809ace0] from samp03srvr
[05:48:37] [debug] #1 000ac82c in public SaveToFile (0x00262314, 0x00171938) from uxfbackup.amx
[05:48:37] [debug] #2 00114a2c in public cmd_ban (0x00000002, 0x002b1374) from uxfbackup.amx
[05:48:37] [debug] #3 native LIFECMD () [00b8e060] from LIFE-CMD.so
[05:48:37] [debug] #4 00009ad4 in public OnPlayerCommandText (0x00000002, 0x002b1334) from uxfbackup.amx
[05:48:37] [debug] Native backtrace:
[05:48:37] [debug] #0 0094209b in _ZN10StackTraceC1EPv () from plugins/crashdetect.so
[05:48:37] [debug] #1 0093d2d2 in _ZN11CrashDetect20PrintNativeBacktraceERSoPv () from plugins/crashdetect.so
[05:48:37] [debug] #2 0093debc in _ZN11CrashDetect20PrintNativeBacktraceEPv () from plugins/crashdetect.so
[05:48:37] [debug] #3 0093e366 in _ZN11CrashDetect11OnExceptionEPv () from plugins/crashdetect.so
[05:48:37] [debug] #4 00941cec in ?? () from plugins/crashdetect.so
[05:48:37] [debug] #5 004f340c in ?? ()
[05:48:37] [debug] #6 004f3424 in ?? ()
[05:48:37] [debug] #7 0051eb11 in gsignal () from /lib/libc.so.6
[05:48:37] [debug] #8 005203ea in abort () from /lib/libc.so.6
[05:48:37] [debug] #9 00517e2b in ?? () from /lib/libc.so.6
[05:48:37] [debug] #10 00517ee6 in ?? () from /lib/libc.so.6
[05:48:37] [debug] #11 0809a90c in ?? () from ./samp03srvr
[05:48:37] [debug] #12 0809ad6f in ?? () from ./samp03srvr
[05:48:37] [debug] #13 08094054 in ?? () from ./samp03srvr
[05:48:37] [debug] #14 0093ab9c in _ZN11CrashDetect13DoAmxCallbackEiPiS0_ () from plugins/crashdetect.so
[05:48:37] [debug] #15 00940d38 in ?? () from plugins/crashdetect.so
[05:48:37] [debug] #16 009471f8 in amx_Exec () from plugins/crashdetect.so
[05:48:37] [debug] #17 0093d218 in _ZN11CrashDetect9DoAmxExecEPii () from plugins/crashdetect.so
[05:48:37] [debug] #18 00940aa9 in ?? () from plugins/crashdetect.so
[05:48:37] [debug] #19 00b8d551 in amx_Exec () from plugins/LIFE-CMD.so
[05:48:37] [debug] #20 00b8e26b in _Z3CMDP6tagAMXPi () from plugins/LIFE-CMD.so
[05:48:37] [debug] #21 08094054 in ?? () from ./samp03srvr
[05:48:37] [debug] #22 0093ab9c in _ZN11CrashDetect13DoAmxCallbackEiPiS0_ () from plugins/crashdetect.so
[05:48:37] [debug] #23 00940d38 in ?? () from plugins/crashdetect.so
[05:48:37] [debug] #24 009471f8 in amx_Exec () from plugins/crashdetect.so
[05:48:37] [debug] #25 0093d218 in _ZN11CrashDetect9DoAmxExecEPii () from plugins/crashdetect.so
[05:48:37] [debug] #26 00940aa9 in ?? () from plugins/crashdetect.so
[05:48:37] [debug] #27 080a4152 in ?? () from ./samp03srvr
[05:48:37] [debug] #28 080afce1 in ?? () from ./samp03srvr
[05:48:37] [debug] #29 08071b38 in ?? () from ./samp03srvr
[05:48:37] [debug] #30 08071c32 in ?? () from ./samp03srvr
[05:48:37] [debug] #31 0807bb80 in ?? () from ./samp03srvr
[05:48:37] [debug] #32 080ad3bd in ?? () from ./samp03srvr
[05:48:37] [debug] #33 080ad562 in ?? () from ./samp03srvr
[05:48:37] [debug] #34 080a88ce in ?? () from ./samp03srvr
[05:48:37] [debug] #35 0050ad26 in __libc_start_main () from /lib/libc.so.6
[05:48:37] [debug] #36 0804b4d1 in ?? () from ./samp03srvr
any solution?
Reply
#2

Not if you don't show us your ban command...
Reply
#3

There We GO!
Код:
CMD:ban( playerid, params[ ] )
{

	LevelCheck( playerid, 5 );

	new
	    liPlayer,
	    liDays,
	    lsReason[ 56 ]
	;
	if ( sscanf( params, "uis[56]", liPlayer, liDays, lsReason ) )
	    return SendClientMessage( playerid, COLOR_ULTRARED, "USAGE: {33CCFF}/ban [PlayerID] [Day(s)] [Reason]" );

	if ( !IsPlayerConnected( liPlayer ) )
	    return SendError( playerid, "Player not connected !" );

	if ( IsPlayerAdmin( liPlayer ) )
	    FormatMSG( liPlayer, COLOR_ULTRARED, "%s has tried to ban you!", PlayerName( playerid ) );

	if ( strlen( lsReason ) < 3 || strlen( lsReason ) > 30 )
	    return SendError( playerid, "Invalid reason size. Between 3 and 30 characters !" );

	if ( liPlayer == playerid )
	    return SendError( playerid, "You can't ban yourself!" );

	if ( PlayerInfo[ playerid ][ BanTimer ] == 1 && !IsPlayerAdmin( playerid ) )
	    return SendError( playerid, "You can't ban another player in only 30 seconds!" );
    if(IsPlayerNPC(liPlayer)) return 0;
	if ( liDays < 1 || liDays > 30 )
	    return SendError( playerid, "Invalid day ! Write values between 1 and 30." );
	if(IsPlayerNPC(liPlayer)) return 0;
    gsString[ 0 ] = EOS;
    TextDrawShowForPlayer( liPlayer, Ban_Backround );
    TextDrawShowForPlayer( liPlayer, Ban_Info );
    TextDrawShowForPlayer( liPlayer, Ban_Message );
    TextDrawShowForPlayer( liPlayer, Ban_Details_TD );
    TextDrawShowForPlayer( liPlayer, Ban_Mistake );

    PlayerInfo[ playerid ][ PBans ]++;

	SendClientMessageToAll( 0x00FF00FF, "// -------------------------- {33CCFF}Ban Info {00FF00}-------------------------- //" );

	format( gsString, sizeof( gsString ), ">> {33CCFF}%s {FF9900}<< has been banned by Administrator >> {33CCFF}%s {FF9900}<<.", PlayerName( liPlayer ), PlayerName( playerid ) );
    SendClientMessageToAll( COLOR_ORANGE, gsString );

	format( gsString, sizeof( gsString ), "For >>{33CCFF} %d {FF9900}<< days. Reason: >> {33CCFF}%s{FF9900} << Date: >> {33CCFF}%s{FF9900} <<.", liDays, lsReason, zDate( ) );
    SendClientMessageToAll( COLOR_ORANGE, gsString );

	SendClientMessageToAll( 0x00FF00FF, "// ------------------------------------------------------------------- //" );
    TogglePlayerControllable( liPlayer, false );

    new
	    szDay,
	    szMonth,
	    szYear,
	    szHour,
	    szMinute,
	    szSecond
	;

	getdate( szYear, szMonth, szDay );
	gettime( szHour, szMinute, szSecond );

    new
		year,
		month,
		day
	;
    getdate( year, month, day );
    day += liDays;
    if ( IsMonth31( month ) )
    {
        if ( day > 31 )
        {
            month += 1;
            if ( month > 12 )
            {
                year += 1;
                while( day > 31 ) day -= 31;
            }
            else while( day > 31 ) day -= 31;
        }
    }
    else if ( !IsMonth31( month ) )
    {
        if ( day > 30 )
        {
            month += 1;
            if ( month > 12 )
            {
                year += 1;
                while( day > 30 ) day -= 30;
            }
            else while( day > 30 ) day -= 30;
        }
    }
    else if ( !IsMonth31( month ) && IsMonth29( year ) && month == 2 )
    {
        if ( day > 29 )
        {
            month += 1;
            if ( month > 12 )
            {
                year += 1;
                while( day > 29 ) day -= 29;
            }
            else while( day > 29 ) day -= 29;
        }
    }
    else if ( !IsMonth31( month ) && !IsMonth29( year ) && month == 2 )
    {
        if ( day > 28 )
        {
            month += 1;
            if ( month > 12 )
            {
                year += 1;
                while( day > 28 ) day -= 28;
            }
            else while( day > 28 ) day -= 28;
        }
    }

    format( gsQuery, 1024, "INSERT INTO `banlist` (`Key`,`IP`,`Name`,`Reason`,`Admin`,`BanDate`,`BanTime`,`BanDays`,`Request`,`Aproove`) VALUES(0,'%s','%s','%s','%s','%d-%d-%d','%d:%d:%d',%d,0,0)", GetPlayerIPEx( liPlayer ), PlayerName( liPlayer ), lsReason, PlayerName( playerid ), szYear, szMonth, szDay, szHour, szMinute, szSecond, liDays );
    mysql_query( gsQuery, THREAD_NONE );

    format( gsString, sizeof( gsString ), "Banned by Administrator: %s~n~Ban Date: %d/%d/%d~n~Ban Time: %d/%d/%d~n~Ban Reason: %s~n~Un-Ban After: %d/%d/%d", PlayerName( playerid ), szDay, szMonth, szYear, szHour, szMinute, szSecond, lsReason, day, month, year );
	TextDrawSetString( Ban_Details[ liPlayer ], gsString );
	TextDrawShowForPlayer( liPlayer, Ban_Details[ liPlayer ] );

	Kick( liPlayer );
	PlayerInfo[ playerid ][ BanTimer ] = ( 1 );
	SetTimerEx( "ResetBanTimer", 3*10000, 0, "i", playerid );

	FormatLog( "BanCMD_Log", "Administrator %s has banned %s for reason: '%s'", PlayerName( playerid ), PlayerName( liPlayer ), lsReason );
	return ( 1 );
}
but,its happen when i use any admin cmd
Reply
#4

Код:
native fwrite () [0809ace0] from samp03srvr
Problem solved just by actually reading what it says. The obvious cause of action right here is to look at the wiki page for that function. Then one would notice a big red warning box: Using an invalid handle will crash your server! Get a valid handle by using fopen or ftemp.

Edit: also don't use Hungarian Notation (i.e. "sz" and others) if you have no idea what you're doing. "sz" means: String, Zero-terminated. Clearly day, month, year, hour, minute and second are not strings.
Reply
#5

Quote:
Originally Posted by Vince
Посмотреть сообщение
Код:
native fwrite () [0809ace0] from samp03srvr
Problem solved just by actually reading what it says. The obvious cause of action right here is to look at the wiki page for that function. Then one would notice a big red warning box: Using an invalid handle will crash your server! Get a valid handle by using fopen or ftemp.

Edit: also don't use Hungarian Notation (i.e. "sz" and others) if you have no idea what you're doing. "sz" means: String, Zero-terminated. Clearly day, month, year, hour, minute and second are not strings.
ummm,i cant get it.
EDIT:Maybe,its a Small Bug?
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)