Hello,
I have a problem with my script which is almost working...
The question is: is this plugin correctly counting kills? why is not printing to chat the player who got 5kills or 6kills.
My server is WAR - mixes/cw - this server is for people and I want to give them some surprise.
This server is for 6on6 or 5on5 and I want to have some announcement about ACE.
Code:
#pragma semicolon 1
#include <cstrike>
#include <morecolors>
#include <sourcemod>
#include <sdktools>
new Handle:sm_war_live;
new kills[MAXPLAYERS+1];
public Plugin myinfo =
{
name = "MD TEST",
author = "Leon Le Professionnel",
description = "Testing scripts .",
version = "1.0",
url = "http://www.martwy-dystrykt.pl"
};
public OnPluginStart()
{
HookEvent("player_disconnect", Event_PlayerDisconnect);
HookEvent("player_death", Event_PlayerDeath);
HookEvent("round_end",Event_RoundEndEvent);
}
public Event_PlayerDeath(Handle:event, const String:name[], bool:dontBroadcast)
{
if (GetConVarInt(sm_war_live) == 1)
{
new attacker = GetClientOfUserId(GetEventInt(event, "attacker"));
if(attacker == 0)
{
return;
}
new victim = GetClientOfUserId(GetEventInt(event, "userid"));
if(GetClientTeam(attacker) != GetClientTeam(victim)
{
kills[attacker]++;
}
}
}
public Event_PlayerDisconnect(Handle:event, const String:name[], bool:dontBroadcast)
{
if (GetConVarInt(sm_war_live) == 1)
{
new attacker = GetClientOfUserId(GetEventInt(event, "userid"));
kills[attacker] = 0;
}
}
public RoundStartEvent(Handle:event,const String:name[],bool:dontBroadcast)
{
if (GetConVarInt(sm_war_live) == 1)
{
for(new i = 1; i < MAXPLAYERS; i++)
{
kills[i] = 0;
}
}
}
public Event_RoundEndEvent(Handle:event,const String:name[],bool:dontBroadcast)
{
if (GetConVarInt(sm_war_live) == 1)
{
new acer6 = 0;
new acer5 = 0;
for(new i = 1; i < MaxClients; i++)
if(kills[i] == 6)
{
acer6 = i;
}
for(new i = 1; i < MaxClients; i++)
if(kills[i] == 5)
{
acer5 = i;
}
decl String:iname6[MAX_NAME_LENGTH];
GetClientName(acer6, iname6, sizeof(iname6));
for(new i = 1; i < MaxClients; i++)
if (IsClientInGame(i) && kills[i] == 6)
{
CPrintToChatAll("{green}[MD INFO] {default}Player {frozen}%N {default} Did an 6 ACE!", iname6);
}
decl String:iname5[MAX_NAME_LENGTH];
GetClientName(acer5, iname5, sizeof(iname5));
for(new i = 1; i < MaxClients; i++)
if (IsClientInGame(i) && kills[i] == 5)
{
CPrintToChatAll("{green}[MD INFO] {default}Player {frozen}%N {default} Did an 5 ACE!", iname5);
}
}
}
__________________