Raised This Month: $ Target: $400
 0% 

Solved Total Kills of a team


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
<VeCo>
Veteran Member
Join Date: Jul 2009
Location: Bulgaria
Old 06-12-2019 , 11:24   Re: Total Kills of a team
Reply With Quote #1

Detect kill, check team of killer, add +1 to a global variable depending on the team, show that in the hud.
__________________
<VeCo> is offline
shadow728988
Member
Join Date: Sep 2017
Old 06-12-2019 , 23:13   Re: Total Kills of a team
Reply With Quote #2

Quote:
Originally Posted by <VeCo> View Post
Detect kill, check team of killer, add +1 to a global variable depending on the team, show that in the hud.
I am new at this so i cant you know.
But we register a death event then what?
I mean how do you detect a kill
Like new attacker = get_user_id
New team = get_user_team(attacker) something like this?
shadow728988 is offline
HamletEagle
AMX Mod X Plugin Approver
Join Date: Sep 2013
Location: Romania
Old 06-13-2019 , 04:20   Re: Total Kills of a team
Reply With Quote #3

Quote:
Originally Posted by shadow728988 View Post
But we register a death event then what?
I mean how do you detect a kill
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]++.
__________________

Last edited by HamletEagle; 06-13-2019 at 04:22.
HamletEagle is offline
shadow728988
Member
Join Date: Sep 2017
Old 06-13-2019 , 08:24   Re: Total Kills of a team
Reply With Quote #4

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]++.
What if i want to show both the total kills of ts as well as cts?
Still just the one global variable?
shadow728988 is offline
shadow728988
Member
Join Date: Sep 2017
Old 06-13-2019 , 09:19   Re: Total Kills of a team
Reply With Quote #5

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
Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT -4. The time now is 17:23.


Powered by vBulletin®
Copyright ©2000 - 2024, vBulletin Solutions, Inc.
Theme made by Freecode