server crash
#1

My server crash because of /c command, the line show to a format.

From my perspective, everything looks good..

Код:
CMD:c(playerid, params[])
{
	if(playerVariables[playerid][pClan] < 1)
	{
		return SendClientMessage(playerid, COLOR_LGREEN, "You are not in a clan.");
	}

	if(isnull(params)) return SendClientMessage(playerid, -1, "Usage: /c [message]");


	if(playerVariables[playerid][pClanChat]) return SS(playerid, COLOR_LGREEN, "Ai dezactivat chat-ul clanului. Foloseste /togc pentru a-l activa.", "You disabled the clan chat. Use /togc to enabled.");


	new c_log[128];
	format(c_log, sizeof(c_log),"%s: %s", GetName(playerid), params);
	mysql_format(SQL, gString, sizeof(gString), "INSERT INTO chat_logs (`playerid`,`text`,`where`) VALUES ('%d','%e','c')", playerVariables[playerid][pID], c_log);
	mysql_tquery(SQL, gString, "", "");

	SendToClan(playerid, params);
	return 1;
}
Line:
Код:
format(c_log, sizeof(c_log),"%s: %s", GetName(playerid), params);
Server_log:

Код:
[21:22:45] [debug] Server crashed while executing redgun.amx
[21:22:45] [debug] AMX backtrace:
[21:22:45] [debug] #0 native format () from samp03svr
[21:22:45] [debug] #1 0013d738 in public cmd_c () at D:\gamemode\gamemodes\redgun.pwn:19429
[21:22:45] [debug] #2 native CallLocalFunction () from samp03svr
[21:22:45] [debug] #3 0003a5c4 in public OnPlayerCommandText (playerid=4, cmdtext[]=@01597a5c "/c sunt wars sau?") at D:\gamemode\pawno\include\zcmd.inc:111
[21:22:45] [debug] Native backtrace:
[21:22:45] [debug] #0 b61c1e8b in _ZN10StackTraceC1EPv () from plugins/crashdetect.so
[21:22:45] [debug] #1 b61babcf in _ZN11CrashDetect20PrintNativeBacktraceERSoPv () from plugins/crashdetect.so
[21:22:45] [debug] #2 b61bbdbc in _ZN11CrashDetect20PrintNativeBacktraceEPv () from plugins/crashdetect.so
[21:22:45] [debug] #3 b61bc226 in _ZN11CrashDetect11OnExceptionEPv () from plugins/crashdetect.so
[21:22:45] [debug] #4 b61c1adc in ?? () from plugins/crashdetect.so
[21:22:45] [debug] #5 b77bb600 in ?? ()
[21:22:45] [debug] #6 080965d7 in ?? () from ./samp03svr
[21:22:45] [debug] #7 080dce72 in ?? () from ./samp03svr
[21:22:45] [debug] #8 080950e4 in ?? () from ./samp03svr
[21:22:45] [debug] #9 b61bd94b in _ZN11CrashDetect13DoAmxCallbackEiPiS0_ () from plugins/crashdetect.so
[21:22:45] [debug] #10 b61c08f8 in ?? () from plugins/crashdetect.so
[21:22:45] [debug] #11 b61c4916 in amx_Exec () from plugins/crashdetect.so
[21:22:45] [debug] #12 b61bcbe6 in _ZN11CrashDetect9DoAmxExecEPii () from plugins/crashdetect.so
[21:22:45] [debug] #13 b61c0659 in ?? () from plugins/crashdetect.so
[21:22:45] [debug] #14 b612fbc6 in ?? () from plugins/streamer.so
[21:22:45] [debug] #15 080dfd62 in ?? () from ./samp03svr
[21:22:45] [debug] #16 080950e4 in ?? () from ./samp03svr
[21:22:45] [debug] #17 b61bd94b in _ZN11CrashDetect13DoAmxCallbackEiPiS0_ () from plugins/crashdetect.so
[21:22:45] [debug] #18 b61c08f8 in ?? () from plugins/crashdetect.so
[21:22:45] [debug] #19 b61c4916 in amx_Exec () from plugins/crashdetect.so
[21:22:45] [debug] #20 b61bcbe6 in _ZN11CrashDetect9DoAmxExecEPii () from plugins/crashdetect.so
[21:22:45] [debug] #21 b61c0659 in ?? () from plugins/crashdetect.so
[21:22:45] [debug] #22 b612fbc6 in ?? () from plugins/streamer.so
[21:22:45] [debug] #23 080a5632 in ?? () from ./samp03svr
[21:22:45] [debug] #24 080b1751 in ?? () from ./samp03svr
[21:22:45] [debug] #25 08071d38 in ?? () from ./samp03svr
[21:22:45] [debug] #26 08071e32 in ?? () from ./samp03svr
[21:22:45] [debug] #27 0807bc50 in ?? () from ./samp03svr
[21:22:45] [debug] #28 080aed3d in ?? () from ./samp03svr
[21:22:45] [debug] #29 080aef02 in ?? () from ./samp03svr
[21:22:45] [debug] #30 080aa13a in ?? () from ./samp03svr
[21:22:45] [debug] #31 b74dfd26 in __libc_start_main () from /lib/libc.so.6
[21:22:45] [debug] #32 0804b4e1 in ?? () from ./samp03svr
Reply
#2

Try that:
Код:
CMD:c(playerid, params[])
{
	if(playerVariables[playerid][pClan] < 1)
	{
		return SendClientMessage(playerid, COLOR_LGREEN, "You are not in a clan.");
	}

	if(isnull(params)) return SendClientMessage(playerid, -1, "Usage: /c [message]");


	if(playerVariables[playerid][pClanChat]) return SS(playerid, COLOR_LGREEN, "Ai dezactivat chat-ul clanului. Foloseste /togc pentru a-l activa.", "You disabled the clan chat. Use /togc to enabled.");


	new c_log[128];
	format(c_log, sizeof(c_log),"%s: %s", GetName(playerid), params);
	format(gString, sizeof(gString), "INSERT INTO chat_logs (`playerid`,`text`,`where`) VALUES ('%d','%s','c')", playerVariables[playerid][pID], c_log);
	mysql_tquery(SQL, gString, "", "");

	SendToClan(playerid, params);
	return 1;
}
Reply
#3

I tested , its ok, but I tried without the changing from you, and server didn't crash..and I'm really confused )
Reply
#4

Did you try the question mark in that test? If you didn't put in the ? then you will probably want to test it with it. Special characters could cause trouble, and it could need to have escape characters to stop it being picked up, or to define the MySQL query as something that is accepting of such a thing.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)