|
BANNED
Join Date: May 2012
Location: in your heart
|

02-16-2013
, 21:27
Doesn't want to count.
|
#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 Headshot, SaveHeadshot;
new PlayerDeath[33]; new Death;
public plugin_init() { register_plugin(PLUGIN, VERSION, AUTHOR) 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(4, weapon, 31) 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(victim, attacker, shouldgib) { 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(path, charsmax(path)) format(path, charsmax(path), "%s/%s", path, "status.ini") if (!file_exists(path)) { write_file(path, "", -1) } new linedata[100] format(linedata,charsmax(linedata),"[status]") write_file(path, linedata, 0) format(linedata,charsmax(linedata),"kill=%d",PlayerKill[id]) write_file(path, linedata, 1) format(linedata,charsmax(linedata),"headshot=%d",PlayerHeadshot[id]) write_file(path, linedata, 2) format(linedata,charsmax(linedata),"death=%d",PlayerDeath[id]) write_file(path, linedata, 3) }
public ShowHud(id){ set_hudmessage(255, 255, 255, 0.0, 0.90, 0, 6.0, 3.0, 0.0, 1.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.
|
|