%s in SendClientMessage
#1

Sending "%s" to a client via SendClientMessage crashes the server.

E.g.:
pawn Код:
SendClientMessage(playerid, 0, "%s");
Log on Windows:
Код:
[12:26:37] [debug] Server crashed due to an unknown error
[12:26:37] [debug] System backtrace:
[12:26:38] [debug] #0 00493271 in ?? () from D:\Files\Game servers\SAMP\godfather\samp-server.exe
[12:26:38] [debug] #1 0044e119 in ?? () from D:\Files\Game servers\SAMP\godfather\samp-server.exe
[12:26:38] [debug] #2 0045953c in ?? () from D:\Files\Game servers\SAMP\godfather\samp-server.exe
[12:26:38] [debug] #3 0045bd3a in ?? () from D:\Files\Game servers\SAMP\godfather\samp-server.exe
[12:26:38] [debug] #4 774342e6 in ?? () from C:\Windows\SYSTEM32\ntdll.dll
Log on Linux:
Код:
[12:22:30] [debug] AMX backtrace:
[12:22:30] [debug] #0 native SendClientMessage () [080d75c0] from samp03svr
[12:22:30] [debug] #1 00023574 in public cmd_resp (playerid=8, params[]=@0x000ebc00 "seb") at core/Header.pwn:20
[12:22:30] [debug] #2 0007a428 in public FIXES_OnPlayerCommandText (playerid=8, cmdtext[]=@0x000ebbd8 "/resp seb") at core/Header.pwn:25
[12:22:30] [debug] #3 000010e4 in public OnPlayerCommandText (playerid=8, cmdtext[]=@0x000ebbb0 "/resp seb") at D:\Files\Game servers\SAMP\godfather\pawno\include\fixes.inc:1966
[12:22:30] [debug] System backtrace:
[12:22:30] [debug] #0 f7e66f41 in _ZN10StackTraceC1EPv () from plugins/crashdetect.so
[12:22:30] [debug] #1 f7e5d41f in _ZN11crashdetect20PrintSystemBacktraceEPv () from plugins/crashdetect.so
[12:22:30] [debug] #2 f7e5b963 in _ZN11crashdetect15SystemExceptionEPv () from plugins/crashdetect.so
[12:22:30] [debug] #3 f7e663c1 in ?? () from plugins/crashdetect.so
[12:22:30] [debug] #4 ffffe600 in ?? ()
[12:22:30] [debug] #5 0028020b in strlen () from /lib/libc.so.6
[12:22:30] [debug] #6 00251064 in _IO_vfprintf () from /lib/libc.so.6
[12:22:30] [debug] #7 0026a79c in vsprintf () from /lib/libc.so.6
[12:22:30] [debug] #8 080abe41 in ?? () from ./samp03svr
[12:22:30] [debug] #9 080d7669 in ?? () from ./samp03svr
[12:22:30] [debug] #10 080954a4 in ?? () from ./samp03svr
[12:22:30] [debug] #11 f7e5c5a2 in _ZN11crashdetect13DoAmxCallbackEiPiS0_ () from plugins/crashdetect.so
[12:22:30] [debug] #12 f7e6465e in ?? () from plugins/crashdetect.so
[12:22:30] [debug] #13 f7e6b926 in amx_Exec () from plugins/crashdetect.so
[12:22:30] [debug] #14 f7e5c622 in _ZN11crashdetect9DoAmxExecEPii () from plugins/crashdetect.so
[12:22:30] [debug] #15 f7e64699 in ?? () from plugins/crashdetect.so
[12:22:30] [debug] #16 080dcc22 in ?? () from ./samp03svr
[12:22:30] [debug] #17 f7e6ba33 in amx_Exec () from plugins/crashdetect.so
[12:22:30] [debug] #18 f7e5c622 in _ZN11crashdetect9DoAmxExecEPii () from plugins/crashdetect.so
[12:22:30] [debug] #19 f7e64699 in ?? () from plugins/crashdetect.so
[12:22:30] [debug] #20 080dcc22 in ?? () from ./samp03svr
[12:22:30] [debug] #21 f7e6ba33 in amx_Exec () from plugins/crashdetect.so
[12:22:30] [debug] #22 f7e5c622 in _ZN11crashdetect9DoAmxExecEPii () from plugins/crashdetect.so
[12:22:30] [debug] #23 f7e64699 in ?? () from plugins/crashdetect.so
[12:22:30] [debug] #24 080a4da2 in ?? () from ./samp03svr
[12:22:30] [debug] #25 080afcca in ?? () from ./samp03svr
[12:22:30] [debug] #26 080733b1 in ?? () from ./samp03svr
[12:22:30] [debug] #27 080734a2 in ?? () from ./samp03svr
[12:22:30] [debug] #28 0807d2b0 in ?? () from ./samp03svr
[12:22:30] [debug] #29 080ad426 in ?? () from ./samp03svr
[12:22:30] [debug] #30 080ad652 in ?? () from ./samp03svr
[12:22:30] [debug] #31 080a8fb3 in ?? () from ./samp03svr
[12:22:30] [debug] #32 00225e9c in __libc_start_main () from /lib/libc.so.6
[12:22:30] [debug] #33 0804b491 in ?? () from ./samp03svr
^ The logs above are from my gamemode, but I've tested in with a bare gamemode too.

Код:
#include <a_samp>
#include <core>
#include <float>

#pragma tabsize 0

main()
{
	print("\n----------------------------------");
	print("  Bare Script\n");
	print("----------------------------------\n");
}

public OnPlayerConnect(playerid)
{
	GameTextForPlayer(playerid,"~w~SA-MP: ~r~Bare Script",5000,5);
	return 1;
}

public OnPlayerCommandText(playerid, cmdtext[])
{
	new idx;
	new cmd[256];
	
	cmd = strtok(cmdtext, idx);

	if(strcmp(cmd, "/crash", true) == 0) {
	    SendClientMessage(playerid, 0, "%s");
    	return 1;
	}

	return 0;
}

public OnPlayerSpawn(playerid)
{
	SetPlayerInterior(playerid,0);
	TogglePlayerClock(playerid,0);
	return 1;
}

public OnPlayerDeath(playerid, killerid, reason)
{
   	return 1;
}

SetupPlayerForClassSelection(playerid)
{
 	SetPlayerInterior(playerid,14);
	SetPlayerPos(playerid,258.4893,-41.4008,1002.0234);
	SetPlayerFacingAngle(playerid, 270.0);
	SetPlayerCameraPos(playerid,256.0815,-43.0475,1004.0234);
	SetPlayerCameraLookAt(playerid,258.4893,-41.4008,1002.0234);
}

public OnPlayerRequestClass(playerid, classid)
{
	SetupPlayerForClassSelection(playerid);
	return 1;
}

public OnGameModeInit()
{
	SetGameModeText("Bare Script");
	ShowPlayerMarkers(1);
	ShowNameTags(1);
	AllowAdminTeleport(1);

	AddPlayerClass(265,1958.3783,1343.1572,15.3746,270.1425,0,0,0,0,-1,-1);

	return 1;
}

strtok(const string[], &index)
{
	new length = strlen(string);
	while ((index < length) && (string[index] <= ' '))
	{
		index++;
	}

	new offset = index;
	new result[20];
	while ((index < length) && (string[index] > ' ') && ((index - offset) < (sizeof(result) - 1)))
	{
		result[index - offset] = string[index];
		index++;
	}
	result[index - offset] = EOS;
	return result;
}
The "/crash" command crashes the server.
Код:
echo Executing Server Config...
lanmode 0
rcon_password changemex
maxplayers 500
port 7777
hostname SA-MP 0.3 Server
gamemode0 bare 1
filterscripts
announce 0
query 1
weburl www.sa-mp.com
onfoot_rate 40
incar_rate 40
weapon_rate 40
stream_distance 300.0
stream_rate 1000
maxnpc 10
logtimeformat [%H:%M:%S]
Reply


Messages In This Thread
%s in SendClientMessage - by Dan.. - 13.01.2013, 09:18
Re: %s in SendClientMessage - by Kwarde - 13.01.2013, 09:49
Re: %s in SendClientMessage - by CaHbKo - 13.01.2013, 10:24
Re: %s in SendClientMessage - by TheArcher - 13.01.2013, 13:06
Re: %s in SendClientMessage - by Dan.. - 13.01.2013, 13:41
Re: %s in SendClientMessage - by TheArcher - 13.01.2013, 14:11
Re: %s in SendClientMessage - by Skyrise - 16.01.2013, 02:34
Re: %s in SendClientMessage - by mastermax7777 - 16.01.2013, 05:03
Re: %s in SendClientMessage - by Neil. - 16.01.2013, 07:05
Re: %s in SendClientMessage - by RajatPawar - 16.01.2013, 07:11
Re: %s in SendClientMessage - by leong124 - 16.01.2013, 08:13
Re: %s in SendClientMessage - by Kwarde - 16.01.2013, 12:20
Re: %s in SendClientMessage - by kaisersouse - 16.01.2013, 12:43
Re: %s in SendClientMessage - by leong124 - 16.01.2013, 13:59
Re: %s in SendClientMessage - by liquor - 22.01.2013, 20:12
Re: %s in SendClientMessage - by RootKiller - 22.01.2013, 21:02
Re: %s in SendClientMessage - by Basssiiie - 22.01.2013, 22:03
Re: %s in SendClientMessage - by TheArcher - 22.01.2013, 22:29
Re: %s in SendClientMessage - by leong124 - 23.01.2013, 06:54
Re: %s in SendClientMessage - by Basssiiie - 23.01.2013, 21:40
Re: %s in SendClientMessage - by Dan.. - 24.01.2013, 14:25
Re: %s in SendClientMessage - by leong124 - 24.01.2013, 15:10

Forum Jump:


Users browsing this thread: 3 Guest(s)