Thread: [Solved] Total Kills of a team
View Single Post
shadow728988
Member
Join Date: Sep 2017
Old 06-13-2019 , 09:19   Re: Total Kills of a team
Reply With Quote #6

Quote:
Originally Posted by HamletEagle View Post
If you registered DeathMsg(the death event) then you already detected a kill. The event will be called when a player is killed.

Then get the attacker,(read_data(1) IIRC), team = get_user_team(attacker), globalVariable[team]++.
Code:
#include <amxmodx>
#include <amxmisc>
#include <cstrike>

new TKills
new CTKills
public plugin_init()
{
    register_plugin("hud", "", "rinf")
	
	register_event("DeathMsg", "Event_DeathMsg", "a", "1")
	hudmessage()
}


public Event_DeathMsg()
{
  new attacker = read_data(1)
  new Team = get_user_team(attacker)
  if(Team == 1)
   {
     TKills++;
   }
  else if(Team == 2)
   {
     CTKills++
   }
} 
public hudmessage()
{
set_dhudmessage(0, 255, 0, -1.0, 0.0, 0, 6.0, 12.0)
show_dhudmessage(0, "〕Point〔^n〔%i〕       〔%i〕", TKills, CTKills);
}
correct me please thank you.

Last edited by shadow728988; 06-13-2019 at 10:03. Reason: full code
shadow728988 is offline