Raised This Month: $51 Target: $400
 12% 

CS 1.6 Knife Kill Count Plugin


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
hasanalizxc
Senior Member
Join Date: May 2018
Old 05-06-2020 , 11:33   CS 1.6 Knife Kill Count Plugin
Reply With Quote #1

Hı all,

In the game, I ask for a plugin that shows how many people killed by a knife with a knife. In addition, the person who wishes should be able to see his/her knife killing data by typing / knifecount (example).

Thanks in advance.

Kind Regards.
hasanalizxc is offline
Napoleon_be
Veteran Member
Join Date: Jul 2011
Location: Belgium
Old 05-06-2020 , 13:49   Re: CS 1.6 Knife Kill Count Plugin
Reply With Quote #2

Untested

PHP Code:
#include <amxmodx>
#include <nvault>

#pragma semicolon 1

#if !defined MAX_PLAYERS
    
const MAX_PLAYERS 32;
#endif

#if AMXX_VERSION_NUM < 190
    #define client_disconnected(%1) client_disconnect(%1)
#endif

new const szVersion[] = "1.0.0";

new 
iKnifeCount[MAX_PLAYERS 1];

new 
iVault;

public 
plugin_init() {
      
register_plugin("KnifeKillCount"szVersion"NapoleoN#");

      
register_clcmd("say /kc""KnifeCount");

      
register_event("DeathMsg""eDeath""a""1>0""1!2");

      
iVault nvault_open("KnifeKillCount");
}

public 
plugin_end() {
    
nvault_close(iVault);
}

public 
client_disconnected(id) {
    
SaveData(id);
}

public 
client_authorized(id) {
    
LoadData(id);
}

public 
eDeath() {
    new 
iAttacker read_data(1);
    new 
iClipiAmmoiWeapon;
    
iWeapon get_user_weapon(iAttackeriClipiAmmo);

    if(
iWeapon == CSW_KNIFE && is_user_connected(iAttacker)) {
        
iKnifeCount[iAttacker]++;
    }
}

public 
KnifeCount(id) {
    
client_print(idprint_chat"Knife KillCount: %i"iKnifeCount[id]);
}

SaveData(id) {
    new 
szAuth[35], szTemp[10];
    
get_user_authid(idszAuthcharsmax(szAuth));

    
formatex(szTempcharsmax(szTemp), "%i"iKnifeCount[id]);

    
nvault_set(iVaultszAuthszTemp);
}

LoadData(id) {
    new 
szAuth[35], szKillCount[10], szTemp[10];
    
get_user_authid(idszAuthcharsmax(szAuth));

    
nvault_get(iVaultszAuthszTempcharsmax(szTemp));

    
parse(szTempszKillCountcharsmax(szKillCount));

    
iKnifeCount[id] = str_to_num(szKillCount);

__________________
Napoleon_be is offline
Send a message via Skype™ to Napoleon_be
B1zAr
New Member
Join Date: Apr 2021
Old 04-04-2021 , 12:09   Re: CS 1.6 Knife Kill Count Plugin
Reply With Quote #3

Can you put it like a permanent message under the radar like - something to go on a CSDM server

Knife kills :
Knife received :

Kind regards,
B1zAr is offline
Napoleon_be
Veteran Member
Join Date: Jul 2011
Location: Belgium
Old 04-04-2021 , 20:02   Re: CS 1.6 Knife Kill Count Plugin
Reply With Quote #4

untested. Also, i didn't add "Knife deaths", i'm inactive so you're lucky i considered editing this one... let me know if it works. FYI: You still gotta setup the x & y position of the hud message so that it appears under the radar and not in the middle of your screen.

PHP Code:
#include <amxmodx>
#include <nvault>

#pragma semicolon 1

#if !defined MAX_PLAYERS
    
const MAX_PLAYERS 32;
#endif

#if AMXX_VERSION_NUM < 183
    #define client_disconnected(%1) client_disconnect(%1)
#endif

new const szVersion[] = "1.0.0";

new 
iKnifeCount[MAX_PLAYERS 1];

new 
iVault;

public 
plugin_init() {
      
register_plugin("KnifeKillCount"szVersion"NapoleoN#");

      
register_clcmd("say /kc""KnifeCount");

      
register_event("DeathMsg""eDeath""a""1>0""1!2");

      
iVault nvault_open("KnifeKillCount");
}

public 
plugin_end() {
    
nvault_close(iVault);
}

public 
client_authorized(id) {
    
LoadData(id);
}

public 
client_putinserver(id)
{
    
set_task(20.0"DisplayHud"id__"b");
}

public 
client_disconnected(id)
{
    
SaveData(id);
    
// Remove task on disconnect? Sounds pointless lol.
}

public 
eDeath() {
    new 
iAttacker read_data(1);
    new 
iClipiAmmoiWeapon;
    
iWeapon get_user_weapon(iAttackeriClipiAmmo);

    if(
iWeapon == CSW_KNIFE && is_user_connected(iAttacker)) {
        
iKnifeCount[iAttacker]++;
    }
}

public 
KnifeCount(id) {
    
client_print(idprint_chat"Knife KillCount: %i"iKnifeCount[id]);
}

public 
DisplayHud(id)
{
    if(
is_user_connected(id)) 
    {
        
set_hudmessage(2001000, -1.00.3500.020.00.00.0, -1);
        
show_hudmessage(id"Knife KillCount: %i"iKnifeCount[id]);
    }
}

SaveData(id) {
    new 
szAuth[35], szTemp[10];
    
get_user_authid(idszAuthcharsmax(szAuth));

    
formatex(szTempcharsmax(szTemp), "%i"iKnifeCount[id]);

    
nvault_set(iVaultszAuthszTemp);
}

LoadData(id) {
    new 
szAuth[35], szKillCount[10], szTemp[10];
    
get_user_authid(idszAuthcharsmax(szAuth));

    
nvault_get(iVaultszAuthszTempcharsmax(szTemp));

    
parse(szTempszKillCountcharsmax(szKillCount));

    
iKnifeCount[id] = str_to_num(szKillCount);

__________________

Last edited by Napoleon_be; 04-04-2021 at 20:03.
Napoleon_be is offline
Send a message via Skype™ to Napoleon_be
B1zAr
New Member
Join Date: Apr 2021
Old 04-05-2021 , 17:34   Re: CS 1.6 Knife Kill Count Plugin
Reply With Quote #5

Hello

Firstly allow me thank you for your time and effort in creating this - I've tested it - works like a charm - if somebody/you could enhance this plugin further - this could be a nice addition to any server honestly.


I would appreciate it if somebody/you could remove the yellow text with the knife kills count - the only thing that I need is a knife kill + knife taken hud display shown under the radar - and a top15 view for knife enthusiasts - like the normal top15 were accustomed to but for knifes .

I apologize for hijacking the initial request - I believe this has been already met by Napoleon - BIG UP!

Kind regards,
B1zAr 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 19:21.


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