Ok I decided to switch over to killing instead of reviving, and I still have a small problem.
Now the thing works almost completely. It says the person was killing in the top right, creates the X on the minimap, even makes my server go "Headshot!" however it doesn't actually kill the person. What am I doing wrong now?
Code:
#include <sourcemod>
#include <sdktools>
//void CCSPlayer::RoundRespawn();
public Plugin:myinfo = {
name = "Craftkiller's Team Balancer",
author = "Craftkiller",
description = "Balances teams based on Mani Admin Rank",
version = "1.0",
url = "http://craftkiller.com"
};
public OnPluginStart()
{
RegConsoleCmd("sm_kill", smKill)
}
public Action:smKill(client, args)
{
if (client)
{
ReplyToCommand(client, "Killing...");
new String:name[32]
GetClientName(client, name, sizeof(name))
ReplyToCommand(client, "Name:%s", name);
//RespawnPlayer(client);
decl String:arg[65];
GetCmdArg(1, arg, sizeof(arg));
ReplyToCommand(client, "Target:%s", arg);
new clients[64];
new numClients = SearchForClients(arg, clients, 2);
ReplyToCommand(client, "Num:%d", numClients);
if (numClients == 0)
{
ReplyToCommand(client, "No matching client");
return Plugin_Handled;
} else if (numClients > 1) {
ReplyToCommand(client, "More than one client matches");
return Plugin_Handled;
}
ReplyToCommand(client, "1 target");
decl String:name2[65];
GetClientName(clients[0], name2, sizeof(name));
ReplyToCommand(client, "Target:%s", name2);
ReplyToCommand(client, "Sending Command.... pray");
SendDeathMessage(client, clients[0], "p90", true);
} else {
PrintToServer("Command from server.")
}
return Plugin_Continue
}
SendDeathMessage(attacker, victim, const String:weapon[], bool:headshot)
{
new Handle:event = CreateEvent("player_death");
if (event == INVALID_HANDLE)
{
return
}
SetEventInt(event, "userid", GetClientUserId(victim));
SetEventInt(event, "attacker", GetClientUserId(attacker));
SetEventString(event, "weapon", weapon);
SetEventBool(event, "headshot", headshot);
FireEvent(event);
}