Hello:
Let me first say that I've been playing around with SourceMod and I truly appreciate all the time and hard work that has been put into this project! I'll also say that I am a hobbyist programmer but I am typically a DIY type of person so asking for help means I'm at the end of my rope...
Trying to "slay" players through FakeClientCommand(entity, "kill") has been a wild ride with crashing on two of my test systems. I've trolled around these forums for the past week, checked the flyspray bug tracker, and racked my brain on teh Google trying to find a reason for this.
My test systems (one x64 doze, the other a fairly stock Debian GNU/Linux Etch box) are devoid of all VSP/MMS plugins when trying this and I'm baffled why this code seems to compile and run on both systems:
Code:
#include <sourcemod>
#pragma semicolon 1
public OnPluginStart()
{
RegAdminCmd("sm_slay", Command_Slay, ADMFLAG_SLAY, "sm_slay <#userid|name>");
}
public Action:Command_Slay(client, args)
{
if (args < 1)
{
ReplyToCommand(client, "[SM] Usage: sm_slay <#userid|name>");
return Plugin_Handled;
}
new String:arg[65];
GetCmdArg(1, arg, sizeof(arg));
new targets[2];
SearchForClients(arg, targets[0], 2);
CommitSuicide(targets[0]);
//FakeClientCommand(targets[0], "kill");
return Plugin_Handled;
}
stock CommitSuicide(entity)
{
FakeClientCommand(entity, "kill");
}
...and yet this compiles but causes a crash:
Code:
#include <sourcemod>
#pragma semicolon 1
public OnPluginStart()
{
RegAdminCmd("sm_slay", Command_Slay, ADMFLAG_SLAY, "sm_slay <#userid|name>");
}
public Action:Command_Slay(client, args)
{
if (args < 1)
{
ReplyToCommand(client, "[SM] Usage: sm_slay <#userid|name>");
return Plugin_Handled;
}
new String:arg[65];
GetCmdArg(1, arg, sizeof(arg));
new targets[2];
SearchForClients(arg, targets[0], 2);
FakeClientCommand(targets[0], "kill");
return Plugin_Handled;
}
My debugging knowledge on Windows isn't quite up to par but this is the backtrace on my Debian system:
Code:
#0 0xb6815d5b in GetDeathPoseActivity ()
from /usr/local/games/srcds1/cstrike/bin/server_i486.so
#1 0xb6815ed0 in SelectDeathPoseActivityAndFrame ()
from /usr/local/games/srcds1/cstrike/bin/server_i486.so
#2 0xb6947059 in CCSPlayer::SelectDeathPose ()
from /usr/local/games/srcds1/cstrike/bin/server_i486.so
#3 0xb69569da in CCSPlayer::Event_Killed ()
from /usr/local/games/srcds1/cstrike/bin/server_i486.so
#4 0xb66cbb62 in CBasePlayer::CommitSuicide ()
from /usr/local/games/srcds1/cstrike/bin/server_i486.so
#5 0xb6584d0b in CC_Player_Kill ()
from /usr/local/games/srcds1/cstrike/bin/server_i486.so
#6 0xb16bd6ad in __SourceHook_FHCls_ConCommandDispatchfalse::Func ()
from /usr/local/games/srcds1/cstrike/addons/sourcemod/bin/sourcemod_mm_i486.so
#7 0xb724255a in CGameClient::ExecuteStringCommand () from bin/engine_i686.so
#8 0xb16f83c9 in FakeClientCommand ()
from /usr/local/games/srcds1/cstrike/addons/sourcemod/bin/sourcemod_mm_i486.so
#9 0xb1500a5f in operator new ()
from /usr/local/games/srcds1/cstrike/addons/sourcemod/bin/sourcepawn.jit.x86.so
Has anyone else experienced this, and if so, do you know a workaround or fix for it?
Here is some relevant information about both of my testing platforms:
- No other VSP/MMS plugins
- Both SRCDS's are on 3140 build
- SourceMod plugins show as 1.0.0.982
Thanks for any help, and feel free to ask me for more system information, debugging info, or anything else to try to fix this. Of course, there is always the possibility that I've missed a glaringly obvious problem with this -- if that's that case please let me know!