Raised This Month: $ Target: $400
 0% 

How to count the killings of a player?


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
alan_el_more
Veteran Member
Join Date: Jul 2008
Location: amxmodx-es.com
Old 03-30-2009 , 20:46   How to count the killings of a player?
Reply With Quote #1

How to count the killings of a player?
thanks in advance
__________________
alan_el_more is offline
Spunky
Senior Member
Join Date: May 2008
Location: Orlando, Fl.
Old 03-30-2009 , 20:47   Re: How to count the killings of a player?
Reply With Quote #2

http://www.amxmodx.org/funcwiki.php?go=func&id=1
Spunky is offline
Send a message via AIM to Spunky
alan_el_more
Veteran Member
Join Date: Jul 2008
Location: amxmodx-es.com
Old 03-30-2009 , 20:48   Re: How to count the killings of a player?
Reply With Quote #3

Quote:
Originally Posted by Spunky View Post
but that resume at the end of a round.
__________________
alan_el_more is offline
Arkshine
AMX Mod X Plugin Approver
Join Date: Oct 2005
Old 03-30-2009 , 20:50   Re: How to count the killings of a player?
Reply With Quote #4

No. This native gives the current player's frag. That's all.
Arkshine is offline
Dr.G
Senior Member
Join Date: Nov 2008
Old 03-31-2009 , 04:50   Re: How to count the killings of a player?
Reply With Quote #5

make a simple global to count it, something like this:

PHP Code:
/* Plugin generated by AMXX-Studio */
#include <amxmodx>
#include <hamsandwich>
 
 
#define PLUGIN "New Plug-In"
#define VERSION "1.0"
#define AUTHOR "author"
 
new g_kill_counter[33]
 
 
public 
plugin_init() 
{
 
register_plugin(PLUGINVERSIONAUTHOR)
 
 
RegisterHam(Ham_Killed"player""func_Ham_Killed",1)
 
/*                *1          *2         *3
 
 *1 - Register an entity is killed = Ham_Killed
 *2 - Entity named: player
 *3 - Function to forward to: Player_Killed  */
}
 
 
public 
func_Ham_Killed(idiAttackershouldgib
{
 
 
g_kill_counter[iAttacker]++
 
 
client_print(iAttacker3" Kill # %d"g_kill_counter[iAttacker])
 

__________________

Last edited by Dr.G; 03-31-2009 at 08:09.
Dr.G is offline
anakin_cstrike
Veteran Member
Join Date: Nov 2007
Location: Romania
Old 03-31-2009 , 07:56   Re: How to count the killings of a player?
Reply With Quote #6

Quote:
Originally Posted by Dr.G View Post
make a simple global to count it, something like this:

PHP Code:
/* Plugin generated by AMXX-Studio */
#include <amxmodx>
#include <hamsandwich>
 
 
#define PLUGIN "New Plug-In"
#define VERSION "1.0"
#define AUTHOR "author"
 
new g_kill_counter[33]
 
 
public 
plugin_init() 
{
 
register_plugin(PLUGINVERSIONAUTHOR)
 
 
RegisterHam(Ham_Killed"player""Player_Killed",1)
 
/*                *1          *2         *3
 
 *1 - Register an entity is killed = Ham_Killed
 *2 - Entity named: player
 *3 - Function to forward to: Player_Killed  */
}
 
 
public 
func_Ham_Killed(idiAttackershouldgib
{
 
 
g_kill_counter[iAttacker]++
 
 
client_print(iAttacker3" Kill # %d"g_kill_counter[iAttacker])
 

That won't do anything, because you named the function "Player_Killed" and you used "func_Ham_Killed".

And it will be more easy to use deathmsg ( first param - killer )
__________________

anakin_cstrike is offline
Dr.G
Senior Member
Join Date: Nov 2008
Old 03-31-2009 , 08:10   Re: How to count the killings of a player?
Reply With Quote #7

lol correct, fixed. and thanks
__________________
Dr.G is offline
alan_el_more
Veteran Member
Join Date: Jul 2008
Location: amxmodx-es.com
Old 03-31-2009 , 08:46   Re: How to count the killings of a player?
Reply With Quote #8

thank you but I have already settled
Like you and +k
__________________
alan_el_more is offline
ConnorMcLeod
Veteran Member
Join Date: Jul 2006
Location: France (95)
Old 03-31-2009 , 12:25   Re: How to count the killings of a player?
Reply With Quote #9

Make sure killer is between 1 and maxplayers before you use the array.
__________________
- tired and retired -

- my plugins -
ConnorMcLeod is offline
alan_el_more
Veteran Member
Join Date: Jul 2008
Location: amxmodx-es.com
Old 03-31-2009 , 12:32   Re: How to count the killings of a player?
Reply With Quote #10

i use this:

PHP Code:
new kill_count[33]

public 
plugin_init()
{
    
register_event("DeathMsg""player_die""a")
}

public 
player_die()
{
    static 
attackerattacker read_data(1)
    
kill_count[attacker]++

__________________
alan_el_more 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 02:17.


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