Basically, someone asked me for a script that they can go !fslay <name> and it auto slays them the next round.
heres what I've got, and I'm a bit confuesed. Any help would be appreciated
Code:
#include <sourcemod>
#include <sdktools>
new fslay_players;
public Plugin:myinfo =
{
name = "Future Slay",
author = "{Capt. Underpants} Paul",
description = "Future Slay someone",
version = "1.0.0.0",
url = "http://www.mr-community.com/"
}
public OnPluginStart()
{
RegAdminCmd("sm_fslay", Command_FSlay, ADMFLAG_SLAY);
HookEvent("check_fslay",Event_RoundStart);
fslay_players = CreateArray(32);
}
public Action:Command_FSlay(client,args)
{
if (!args)
{
ReplyToCommand(client,"[SM] Usage: sm_fslay <target>");
return Plugin_Handled;
}
decl String:pattern[32];
GetCmdArg(1,pattern,sizeof(pattern));
new cl = FindTarget(client,pattern);
if (cl != -1)
PushArrayString(fslay_players, cl);
else
ReplyToCommand(client,"%t","No target");
return Plugin_Handled;
}
public Action:Event_RoundStart(Handle:event, const String:name[], bool:dontBroadcast)
{
if (GetArraySize(fslay_players)>1)
{
for(new i=0; i<GetArraySize(fslay_players); i++; )
{
if (IsClientInGame(fslay_players[i]))
{
FSlayPlayer(fslay_players[i]);
}
}
return Plugin_Continue;
}
}
FSlayPlayer(target)
{
// strip their weapons so they cannot gunplant after death
new wepIdx;
for (new i; i < 4; i++)
{
if ((wepIdx = GetPlayerWeaponSlot(target, i)) != -1)
{
RemovePlayerItem(target, wepIdx);
AcceptEntityInput(wepIdx, "Kill");
}
}
ForcePlayerSuicide(target);
}
}