Raised This Month: $ Target: $400
 0% 

Doesn't want to count.


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
Randomize
BANNED
Join Date: May 2012
Location: in your heart
Old 02-16-2013 , 21:27   Doesn't want to count.
Reply With Quote #1

PHP Code:
/* Plugin generated by AMXX-Studio */

#include <amxmodx>
#include <amxmisc>
#include <nvault>
#include <hamsandwich>

#define PLUGIN "Kill Counter"
#define VERSION "1.0"
#define AUTHOR "DavidJr"

new PlayerKill[33];
new 
Kill;

new 
PlayerHeadshot[33];
new 
HeadshotSaveHeadshot;

new 
PlayerDeath[33];
new 
Death;

public 
plugin_init() {
    
register_plugin(PLUGINVERSIONAUTHOR)
    
    
Kill register_cvar("kill""1");
    
    
SaveHeadshot register_cvar("save_headshot""1");
    
Headshot register_cvar("headshot""1");
    
    
Death register_cvar("death""1");
    
    
RegisterHam(Ham_Killed"player""death"1// 0 = before death 1 = after  
    
register_event("DeathMsg""kill""a");
    
    
register_clcmd("say /rank""ShowHud");
    
register_clcmd("say_team /rank""ShowHud");
}
public 
kill()
{
    new 
Killer read_data(1)
    new 
hs read_data(3)
    new 
weapon[32]
    
read_data(4weapon31)
    
    
PlayerKill[Killer] += get_pcvar_num(Kill);
    
    if (
hs) {
        if (
get_pcvar_num(SaveHeadshot))
            
PlayerKill[Killer] += get_pcvar_num(Headshot);
    }
    
write_ini_from_plugin(Killer)]
}
public 
death(victimattackershouldgib)
{
    new 
victim read_data(2)
    
    
PlayerDeath[victim] += get_pcvar_num(Death);
    
    
write_ini_from_plugin(victim)
}
public 
write_ini_from_plugin(id){
    new 
path[128]
    
get_configsdir(pathcharsmax(path))
    
format(pathcharsmax(path), "%s/%s"path"status.ini")
    
    if (!
file_exists(path))
    {
        
write_file(path"", -1)
    }
    
    new 
linedata[100]
    
format(linedata,charsmax(linedata),"[status]")
    
write_file(pathlinedata0)
    
format(linedata,charsmax(linedata),"kill=%d",PlayerKill[id])
    
write_file(pathlinedata1)
    
format(linedata,charsmax(linedata),"headshot=%d",PlayerHeadshot[id])
    
write_file(pathlinedata2)
    
format(linedata,charsmax(linedata),"death=%d",PlayerDeath[id])
    
write_file(pathlinedata3)
}

public 
ShowHud(id){
    
set_hudmessage(2552552550.00.9006.03.00.01.0, -1)
    
show_hudmessage(id"Kill: %i, HS: %i, Death: %i",PlayerKill[id],PlayerHeadshot[id],PlayerDeath[id])

The code only work for Death, not Kill or Headshot, did I miss something?

Last edited by Randomize; 02-16-2013 at 21:27.
Randomize is offline
Napoleon_be
Veteran Member
Join Date: Jul 2011
Location: Belgium
Old 02-17-2013 , 10:32   Re: Doesn't want to count.
Reply With Quote #2

If you're using hamsandwich, don't use the DeathMsg event and the Ham_Killed function. Just use the Ham_Killed function and that will do.

Also check if the killer is a player.
__________________
Napoleon_be is offline
Send a message via Skype™ to Napoleon_be
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 21:42.


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