Raised This Month: $ Target: $400
 0% 

How to count the killings of a player?


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
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 #1

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 #2

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
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