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

[REQ] Knife kill stats


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
Racoon
Senior Member
Join Date: Mar 2008
Location: Ukraine
Old 09-02-2009 , 05:42   [REQ] Knife kill stats
Reply With Quote #1

I need a simple plugin to show players' knife kill stats in motd during the game by printing /knife15 or something like that. Example of motd:



I'm poor at scripting. Can anyone make such plugin?))

Last edited by Racoon; 09-02-2009 at 05:46.
Racoon is offline
Send a message via ICQ to Racoon
Old 09-02-2009, 11:58
Racoon
This message has been deleted by Exolent[jNr]. Reason: Don't bump until 2 weeks have passed since last post.
Big Joe
Junior Member
Join Date: Sep 2009
Old 09-05-2009 , 11:19   Re: [REQ] Knife kill stats
Reply With Quote #2

Nice idea, but I think separate stats for each weapon (not only knife) would look much more useful. A cvar can be added to switch the weapon stats mode you want to run on your server. For example w_stats 1 - run stats for usp, w_stats 2 - for glock e.t.c. and w_stats 0 - for all weapon. As for client commands /usp15, /glock15 e.t.c. to see the top15 players, according to the selected stats mode. It's even more easy to put the features I mentioned into statsx.amxx
Big Joe is offline
Old 09-08-2009, 15:56
Racoon
This message has been deleted by Exolent[jNr]. Reason: Don't bump until 2 weeks have passed since last post.
Racoon
Senior Member
Join Date: Mar 2008
Location: Ukraine
Old 10-05-2009 , 02:19   Re: [REQ] Knife kill stats
Reply With Quote #3

Big Joe gave a really nice idea! I can't believe nobody's interested in this plugin...
Racoon is offline
Send a message via ICQ to Racoon
Old 10-05-2009, 12:46
tolsty
This message has been deleted by tolsty. Reason: dupe post :P
tolsty
Senior Member
Join Date: Feb 2008
Location: Latvia
Old 10-05-2009 , 16:58   Re: [REQ] Knife kill stats
Reply With Quote #4

Needs testing

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

#define MAXENTRIES 1000

new gKnifeKills[33], gKnifeDeaths[33], gKnifeHeadShots[33], gConnect[33], g_cvarRecDir[64];

public 
plugin_init() {
    
register_plugin"KnifeTop""1.0""Tolsty" );
    
register_event("DeathMsg""eventDeathMsg""a""1>0");
    
g_cvar register_cvar("knifetop_topsave""1");
    
register_clcmd("say /knifereset","top_reset",ADMIN_BAN);
    
register_clcmd("say /kniferank","kniferank");
    
register_clcmd("say /knifetop","topten_show");
    
register_clcmd("say /knife","info");
    new 
DataDir[64];
    
get_datadir(DataDir63);
    
format(RecDir63"%s/vault"DataDir);

}

public 
client_connect(plr) {
    if(!
get_pcvar_num(g_cvar) ) 
        return 
    
gConnect[plr] = true;
    
update(plr)
    
set_task(15.0,"info"plr);
}
public 
client_disconnect(plr) {
    
gConnect[plr] = false;
}
public 
update(plr) {
    if(!
get_pcvar_num(g_cvar) ) 
        return 
PLUGIN_HANDLED
    
static knifetop[128], szid[32];
    
format(knifetop128"%s/knifetop.vault",RecDir);
    if(
get_pcvar_num(g_cvar) == 1)
        
get_user_name(plr,szid,32);
    else if(
get_pcvar_num(g_cvar) == )
        
get_user_ip(plr,szid,32);
    else if(
get_pcvar_num(g_cvar) == )
        
get_user_authid(plr,szid,32);
    if( 
file_exists(knifetop)) {
        new 
szvault[64];
        
format(szvault,64,"knifetop");
        
        new 
vault nvault_open(szvault);
        if(
vault != -1) {
            new 
szkey[4];
            for(new 
i=1;i<=MAXENTRIES;i++) {
                new 
szreturn[128];
                
format(szkey,4,"%d",i);
                
nvault_get(vault,szkey,szreturn,128);
                new 
arg1[16], arg2[16], arg3[8],  arg4[8],  arg5[8];
                if(
parse(szreturnarg116arg216arg38arg48arg58) != && equal(szid,arg1) ) {
                    
gKnifeKills[plr] = str_to_num(arg3)
                    
gKnifeDeaths[plr] = str_to_num(arg4)
                    
gKnifeHeadShots[plr] = str_to_num(arg5)
                    if( !
gConnect[plr] )
                        
ColorChat(plr RED"[AMXX] You are %s in knifetop, with %d kills !"szkeygKnifeKills[plr]);
                }
            }
            
nvault_close(vault);
        }
    } 
    if(
gConnect[plr])
        
gConnect[plr] = false
    
return PLUGIN_HANDLED

}
public 
info(plr) {
    
ColorChat(plr RED"[AMXX] type /knifetop to see the knife top10, or /kniferank to see your rank");
    
}
public 
kniferank(plr) {
    
update(plr)
}
public 
eventDeathMsg() {
    if(!
get_pcvar_num(g_cvar) ) 
        return 
PLUGIN_HANDLED
    
static killerkiller read_data);
    static 
victimvictim read_data) ;      
    static 
szweapon[5];
    
read_dataszweapon );
      
    if ( ( 
szweapon] == 'k' ) && ( szweapon] == 'f' ) ) {   
        
gKnifeKills[killer]++ 
        
gKnifeDeaths[victim]++ 
        if ( 
read_data) ) {
            
gKnifeHeadShots[killer]++
        }   
        
topten_update(killer)
        
topten_update(victim)        
    } 
    return 
PLUGIN_HANDLED
}

public 
topten_updateplr ) {
    new 
TopTenVault[64];
    
format(TopTenVault64"knifetop");
    
    new 
vault nvault_open(TopTenVault);

    if(
vault != -1) {

        new 
szkey[8];
        new 
szid[32];
        new 
szname[32];
        new 
cur_place;
        new 
new_place;

        if(
get_pcvar_num(g_cvar) == 1)
            
get_user_name(plr,szid,32);
        else if(
get_pcvar_num(g_cvar) == )
            
get_user_ip(plr,szid,32);
        else if(
get_pcvar_num(g_cvar) == )
            
get_user_authid(plr,szid,32);

        
get_user_name(plr,szname,32);

        for(new 
i=1;i<=MAXENTRIES;i++) {
            new 
szreturn[128], arg1[32] ;
            
format(szkey,8,"%d",i);
            
nvault_get(vault,szkey,szreturn,128);
            if(
parse(szreturnarg132) != && equal(szid,arg1)) {
                
cur_place i;
                break;
            }
        }
        for(new 
i=1;i<=MAXENTRIES;i++) {
            new 
szreturn[256], arg1[32], arg3[32];
            
format(szkey,8,"%d",i);
            
nvault_get(vault,szkey,szreturn,256);
            if (
cur_place == 1) {
                
new_place 1;
                break;
            }
            else if (
cur_place != && cur_place i) {
                
new_place 0;
                break;
            }
            else if(
parse(szreturnarg132) == 0) {
                
new_place i;
                break;
            }
            else if(
gKnifeKills[plr]  > str_to_num(arg3) ) {
                
new_place i;
                break;
            }
        }
        if(
cur_place == && new_place <= 1000 && new_place 0) {
            if(
new_place 1000) {
                new 
sztemp[128], sztempkey[8];
                
                for(new 
i=10;i>new_place;i--) {
                    
format(sztempkey,8,"%d",i-1);
                    
nvault_get(vault,sztempkey,sztemp,128);
                    if(!
equal(sztemp,"")) {
                        
format(sztempkey,8,"%d",i);
                        
nvault_pset(vault,sztempkey,sztemp);
                    }
                }
            }
            
client_print(0print_chat"[AMXX] %s now is %d knifetop with %d gKnifeKills!"sznamenew_placegKnifeKills[plr]);
            
            new 
sznew[512];
            
format(szkey,8,"%d",new_place);
            
format(sznew,512,"^"%s^" ^"%s^" ^"%d^" ^"%d^" ^"%d^" "szidsznamegKnifeKills[plr], gKnifeDeaths[plr], gKnifeHeadShots[plr]);    
            
nvault_pset(vault,szkey,sznew);
        }
        else if(
cur_place == new_place && cur_place 0) {
                     
                new 
sznew[512], szkey[8];
                new 
szreturn[128], arg1[32], arg3[32], arg5[32];
                
format(szkey,8,"%d",cur_place);
                
nvault_get(vault,szkey,szreturn,128);
                    
            if(
parse(szreturnarg132arg332) != 0) {
                
format(sznew,512,"^"%s^" ^"%s^" ^"%d^" ^"%d^" ^"%d^" "szidszname,  gKnifeKills[plr] > str_to_num(arg3) ? gKnifeKills[plr] : str_to_num(arg3), gKnifeDeaths[plr], gKnifeHeadShots[plr] > str_to_num(arg5) ? gKnifeHeadShots[plr] : str_to_num(arg5));    
                
nvault_pset(vault,szkey,sznew);
            }
        }
        else if (
new_place cur_place && new_place 0) {
            new 
sznew[512];
            new 
szreturn[128], arg1[32], arg2[32];
            
format(szkey,8,"%d",cur_place);
            
nvault_get(vault,szkey,szreturn,128);
            if(
parse(szreturn,arg1,32,arg2,32) != 0) {
                
format(sznew,512,"^"%s^" ^"%s^" ^"%d^" ^"%d^" ^"%d^" "szidszname,  gKnifeKills[plr] , gKnifeDeaths[plr], gKnifeHeadShots[plr]);
                for(new 
i=cur_place;i>=new_place;i--) {
                    new 
szreturn[128], arg1[32], arg2[32];
                    
format(szkey,8,"%d",i);
                    
nvault_get(vault,szkey,szreturn,128);
                    
                    if(
parse(szreturn,arg1,32,arg2,32) != 0){
                        new 
sztemp [128], sztempkey[8];
                        
format(sztempkey,8,"%d",i-1);
                        
nvault_get(vault,sztempkey,sztemp,128);
                        
                        if(!
equal(sztemp,"")) {
                            
format(sztempkey,8,"%d",i);
                            
nvault_pset(vault,sztempkey,sztemp);
                        }
                    }
                    else break;
                }
                
                
client_print(0print_chat"............" );
                
nvault_pset(vault,szkey,sznew);
            }
        }
        
nvault_close(vault);
    }
}





public 
topten_showplr) {
    
    
    static 
knifetop[128];
    
    
format(knifetop128"%s/knifetop.vault",RecDir);
    
    if( 
file_exists(knifetop)) {
        
        new 
motd[2500];
        new 
szvault[64];

        
format(szvault,64,"knifetop");
        
        new 
vault nvault_open(szvault);
        if(
vault != -1) {
        
            
add(motd,2500,"<html><style>");
            
add(motd,2500,"body { background-color:#000000; }");
            
add(motd,2500,".tabel { color:#FFB000; }");
            
add(motd,2500,".header { background-color:#3d3c23; color:#FFB000;}");
            
add(motd,2500,"</style><body>");
            
add(motd,2500,"<br><br><table align=center border=1 width=90% class=tabel>");
                
add(motd,2500,"<tr><td class=header width=5% align=center>#</td><td class=header width=24%>Name</td><td class=header width=24%>KnifeKills</td><td class=header width=24%>KnifeDeaths</td><td class=header width=24%>KnifeHeadShots</td></tr>");
            new 
szkey[4];
            for(new 
i=1;i<=10;i++) {
                new 
szreturn[128];
                
format(szkey,4,"%d",i);
                
nvault_get(vault,szkey,szreturn,128);
                
                new 
arg1[16], arg2[16], arg3[8],  arg4[8],  arg5[8];
                                if(
parse(szreturnarg115arg215arg37arg47arg57) != 0) {
                    while (
containi(arg2"<") != -1replace(arg263"<""&lt")
                    while (
containi(arg2">") != -1replace(arg263">""&gt")
                    
add(motd,2048,"<tr><td>");
                    
add(motd,2048,szkey);
                    
add(motd,2048,"</td><td>");
                    
add(motd,2500,arg2);
                    
add(motd,2500,"</td><td>");
                    
add(motd,2500,arg3);
                    
add(motd,2500,"</td><td>");
                    
add(motd,2500,arg4);
                    
add(motd,2500,"</td><td>");
                    
add(motd,2500,arg5);
                    
add(motd,2500,"</td><td>");
                    
add(motd,2500,"</td></tr>");
                    
                    
                }
            }
            
            
nvault_close(vault);
            
            
add(motd,2500,"</table></body></html>");
            
show_motd(plr ,motd,"KnifeTop");
        }
    } else {
        
ColorChat(plr RED"No records in topfile");
    }
}

public 
top_reset(plr,level,cid) {
    if(!
cmd_access(plr,level,cid,0)) {
        return 
PLUGIN_HANDLED;
    }
    
    new 
name[32];
    
get_user_name(plrname32);
    
    
    static 
knifetop[128];
    
format(knifetop128"%s/knifetop.vault",RecDir);
    if( 
file_exists(knifetop)) {
    
delete_file(knifetop);
        
ColorChat(0GREEN"[AMXX] ADMIN %s reseted the KnifeTop top"name);
        }
    return 
PLUGIN_HANDLED;
    

Attached Files
File Type: sma Get Plugin or Get Source (knifetop.sma - 962 views - 8.6 KB)
File Type: inc colorchat.inc (2.5 KB, 365 views)
__________________
[IMG]http://img2.**************/img2/7173/signfp.jpg[/IMG]

Last edited by tolsty; 10-05-2009 at 17:10.
tolsty is offline
repingayok
Senior Member
Join Date: Sep 2008
Old 10-08-2009 , 06:30   Re: [REQ] Knife kill stats
Reply With Quote #5

tolsty, thank you for you plugin !!! It's very usefull and interesting for players see knifetop and their kniferank. Everything works fine. If you can add pls column of damage and knife_top_n00bs for players that most died by knife.
repingayok is offline
tolsty
Senior Member
Join Date: Feb 2008
Location: Latvia
Old 10-08-2009 , 07:41   Re: [REQ] Knife kill stats
Reply With Quote #6

OK ill do some 3rd party stuff l8ter,first of all this plugin needs optimizng and im interested, does this loop take very much resources ?

#define MAXENTRIES 1000
for(new i=1;i<=MAXENTRIES;i++)
__________________
[IMG]http://img2.**************/img2/7173/signfp.jpg[/IMG]

Last edited by tolsty; 10-08-2009 at 07:49.
tolsty is offline
Racoon
Senior Member
Join Date: Mar 2008
Location: Ukraine
Old 11-04-2009 , 02:56   Re: [REQ] Knife kill stats
Reply With Quote #7

Thanx
Racoon is offline
Send a message via ICQ to Racoon
Racoon
Senior Member
Join Date: Mar 2008
Location: Ukraine
Old 11-10-2009 , 16:40   Re: [REQ] Knife kill stats
Reply With Quote #8

Ok, I've tested your plugin. It compiles with 5 warnings:
Quote:
//AMXXPC compile.exe
// by the AMX Mod X Dev Team


//// knife_top.sma
// D:\1HLServer\cstrike\addons\amxmodx\scripting \knife_top.sma(180) : warning 21
7: loose indentation
// D:\1HLServer\cstrike\addons\amxmodx\scripting \knife_top.sma(245) : warning 21
7: loose indentation
// D:\1HLServer\cstrike\addons\amxmodx\scripting \knife_top.sma(246) : warning 21
7: loose indentation
// D:\1HLServer\cstrike\addons\amxmodx\scripting \knife_top.sma(253) : warning 21
7: loose indentation
// D:\1HLServer\cstrike\addons\amxmodx\scripting \knife_top.sma(296) : warning 21
7: loose indentation
// Header size: 1136 bytes
// Code size: 15100 bytes
// Data size: 7536 bytes
// Stack/heap size: 16384 bytes; max. usage is unknown, due to recursion
// Total requirements: 40156 bytes
//
// 5 Warnings.
// Done.
//
// Compilation Time: 0,39 sec
// ----------------------------------------

Press enter to exit ...
Can you fix that?
Racoon is offline
Send a message via ICQ to Racoon
lazarev
Veteran Member
Join Date: Sep 2008
Old 11-10-2009 , 17:03   Re: [REQ] Knife kill stats
Reply With Quote #9

loose identation doesnt affect plugin lol :\
okay, fixed -.-

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

#define MAXENTRIES 1000

new gKnifeKills[33], gKnifeDeaths[33], gKnifeHeadShots[33], gConnect[33], g_cvarRecDir[64];

public 
plugin_init() {
    
register_plugin"KnifeTop""1.0""Tolsty" );
    
register_event("DeathMsg""eventDeathMsg""a""1>0");
    
g_cvar register_cvar("knifetop_topsave""1");
    
register_clcmd("say /knifereset","top_reset",ADMIN_BAN);
    
register_clcmd("say /kniferank","kniferank");
    
register_clcmd("say /knifetop","topten_show");
    
register_clcmd("say /knife","info");
    new 
DataDir[64];
    
get_datadir(DataDir63);
    
format(RecDir63"%s/vault"DataDir);

}

public 
client_connect(plr) {
    if(!
get_pcvar_num(g_cvar) ) 
        return 
    
gConnect[plr] = true;
    
update(plr)
    
set_task(15.0,"info"plr);
}
public 
client_disconnect(plr) {
    
gConnect[plr] = false;
}
public 
update(plr) {
    if(!
get_pcvar_num(g_cvar) ) 
        return 
PLUGIN_HANDLED
    
static knifetop[128], szid[32];
    
format(knifetop128"%s/knifetop.vault",RecDir);
    if(
get_pcvar_num(g_cvar) == 1)
        
get_user_name(plr,szid,32);
    else if(
get_pcvar_num(g_cvar) == )
        
get_user_ip(plr,szid,32);
    else if(
get_pcvar_num(g_cvar) == )
        
get_user_authid(plr,szid,32);
    if( 
file_exists(knifetop)) {
        new 
szvault[64];
        
format(szvault,64,"knifetop");
        
        new 
vault nvault_open(szvault);
        if(
vault != -1) {
            new 
szkey[4];
            for(new 
i=1;i<=MAXENTRIES;i++) {
                new 
szreturn[128];
                
format(szkey,4,"%d",i);
                
nvault_get(vault,szkey,szreturn,128);
                new 
arg1[16], arg2[16], arg3[8],  arg4[8],  arg5[8];
                if(
parse(szreturnarg116arg216arg38arg48arg58) != && equal(szid,arg1) ) {
                    
gKnifeKills[plr] = str_to_num(arg3)
                    
gKnifeDeaths[plr] = str_to_num(arg4)
                    
gKnifeHeadShots[plr] = str_to_num(arg5)
                    if( !
gConnect[plr] )
                        
ColorChat(plr RED"[AMXX] You are %s in knifetop, with %d kills !"szkeygKnifeKills[plr]);
                }
            }
            
nvault_close(vault);
        }
    } 
    if(
gConnect[plr])
        
gConnect[plr] = false
    
return PLUGIN_HANDLED

}
public 
info(plr) {
    
ColorChat(plr RED"[AMXX] type /knifetop to see the knife top10, or /kniferank to see your rank");
    
}
public 
kniferank(plr) {
    
update(plr)
}
public 
eventDeathMsg() {
    if(!
get_pcvar_num(g_cvar) ) 
        return 
PLUGIN_HANDLED
    
static killerkiller read_data);
    static 
victimvictim read_data) ;      
    static 
szweapon[5];
    
read_dataszweapon );
      
    if ( ( 
szweapon] == 'k' ) && ( szweapon] == 'f' ) ) {   
        
gKnifeKills[killer]++ 
        
gKnifeDeaths[victim]++ 
        if ( 
read_data) ) {
            
gKnifeHeadShots[killer]++
        }   
        
topten_update(killer)
        
topten_update(victim)        
    } 
    return 
PLUGIN_HANDLED
}

public 
topten_updateplr ) {
    new 
TopTenVault[64];
    
format(TopTenVault64"knifetop");
    
    new 
vault nvault_open(TopTenVault);

    if(
vault != -1) {

        new 
szkey[8];
        new 
szid[32];
        new 
szname[32];
        new 
cur_place;
        new 
new_place;

        if(
get_pcvar_num(g_cvar) == 1)
            
get_user_name(plr,szid,32);
        else if(
get_pcvar_num(g_cvar) == )
            
get_user_ip(plr,szid,32);
        else if(
get_pcvar_num(g_cvar) == )
            
get_user_authid(plr,szid,32);

        
get_user_name(plr,szname,32);

        for(new 
i=1;i<=MAXENTRIES;i++) {
            new 
szreturn[128], arg1[32] ;
            
format(szkey,8,"%d",i);
            
nvault_get(vault,szkey,szreturn,128);
            if(
parse(szreturnarg132) != && equal(szid,arg1)) {
                
cur_place i;
                break;
            }
        }
        for(new 
i=1;i<=MAXENTRIES;i++) {
            new 
szreturn[256], arg1[32], arg3[32];
            
format(szkey,8,"%d",i);
            
nvault_get(vault,szkey,szreturn,256);
            if (
cur_place == 1) {
                
new_place 1;
                break;
            }
            else if (
cur_place != && cur_place i) {
                
new_place 0;
                break;
            }
            else if(
parse(szreturnarg132) == 0) {
                
new_place i;
                break;
            }
            else if(
gKnifeKills[plr]  > str_to_num(arg3) ) {
                
new_place i;
                break;
            }
        }
        if(
cur_place == && new_place <= 1000 && new_place 0) {
            if(
new_place 1000) {
                new 
sztemp[128], sztempkey[8];
                
                for(new 
i=10;i>new_place;i--) {
                    
format(sztempkey,8,"%d",i-1);
                    
nvault_get(vault,sztempkey,sztemp,128);
                    if(!
equal(sztemp,"")) {
                        
format(sztempkey,8,"%d",i);
                        
nvault_pset(vault,sztempkey,sztemp);
                    }
                }
            }
            
client_print(0print_chat"[AMXX] %s now is %d knifetop with %d gKnifeKills!"sznamenew_placegKnifeKills[plr]);
            
            new 
sznew[512];
            
format(szkey,8,"%d",new_place);
            
format(sznew,512,"^"%s^" ^"%s^" ^"%d^" ^"%d^" ^"%d^" "szidsznamegKnifeKills[plr], gKnifeDeaths[plr], gKnifeHeadShots[plr]);    
            
nvault_pset(vault,szkey,sznew);
        }
        else if(
cur_place == new_place && cur_place 0) {
                     
                new 
sznew[512], szkey[8];
                new 
szreturn[128], arg1[32], arg3[32], arg5[32];
                
format(szkey,8,"%d",cur_place);
                
nvault_get(vault,szkey,szreturn,128);
                    
                if(
parse(szreturnarg132arg332) != 0) {
                    
format(sznew,512,"^"%s^" ^"%s^" ^"%d^" ^"%d^" ^"%d^" "szidszname,  gKnifeKills[plr] > str_to_num(arg3) ? gKnifeKills[plr] : str_to_num(arg3), gKnifeDeaths[plr], gKnifeHeadShots[plr] > str_to_num(arg5) ? gKnifeHeadShots[plr] : str_to_num(arg5));    
                    
nvault_pset(vault,szkey,sznew);
                }
        }
        else if (
new_place cur_place && new_place 0) {
            new 
sznew[512];
            new 
szreturn[128], arg1[32], arg2[32];
            
format(szkey,8,"%d",cur_place);
            
nvault_get(vault,szkey,szreturn,128);
            if(
parse(szreturn,arg1,32,arg2,32) != 0) {
                
format(sznew,512,"^"%s^" ^"%s^" ^"%d^" ^"%d^" ^"%d^" "szidszname,  gKnifeKills[plr] , gKnifeDeaths[plr], gKnifeHeadShots[plr]);
                for(new 
i=cur_place;i>=new_place;i--) {
                    new 
szreturn[128], arg1[32], arg2[32];
                    
format(szkey,8,"%d",i);
                    
nvault_get(vault,szkey,szreturn,128);
                    
                    if(
parse(szreturn,arg1,32,arg2,32) != 0){
                        new 
sztemp [128], sztempkey[8];
                        
format(sztempkey,8,"%d",i-1);
                        
nvault_get(vault,sztempkey,sztemp,128);
                        
                        if(!
equal(sztemp,"")) {
                            
format(sztempkey,8,"%d",i);
                            
nvault_pset(vault,sztempkey,sztemp);
                        }
                    }
                    else break;
                }
                
                
client_print(0print_chat"............" );
                
nvault_pset(vault,szkey,sznew);
            }
        }
        
nvault_close(vault);
    }
}





public 
topten_showplr) {
    
    
    static 
knifetop[128];
    
    
format(knifetop128"%s/knifetop.vault",RecDir);
    
    if( 
file_exists(knifetop)) {
        
        new 
motd[2500];
        new 
szvault[64];

        
format(szvault,64,"knifetop");
        
        new 
vault nvault_open(szvault);
        if(
vault != -1) {
        
            
add(motd,2500,"<html><style>");
            
add(motd,2500,"body { background-color:#000000; }");
            
add(motd,2500,".tabel { color:#FFB000; }");
            
add(motd,2500,".header { background-color:#3d3c23; color:#FFB000;}");
            
add(motd,2500,"</style><body>");
            
add(motd,2500,"<br><br><table align=center border=1 width=90% class=tabel>");
            
add(motd,2500,"<tr><td class=header width=5% align=center>#</td><td class=header width=24%>Name</td><td class=header width=24%>KnifeKills</td><td class=header width=24%>KnifeDeaths</td><td class=header width=24%>KnifeHeadShots</td></tr>");
            new 
szkey[4];
            for(new 
i=1;i<=10;i++) {
                new 
szreturn[128];
                
format(szkey,4,"%d",i);
                
nvault_get(vault,szkey,szreturn,128);
                
                new 
arg1[16], arg2[16], arg3[8],  arg4[8],  arg5[8];
                if(
parse(szreturnarg115arg215arg37arg47arg57) != 0) {
                    while (
containi(arg2"<") != -1replace(arg263"<""&lt")
                    while (
containi(arg2">") != -1replace(arg263">""&gt")
                    
add(motd,2048,"<tr><td>");
                    
add(motd,2048,szkey);
                    
add(motd,2048,"</td><td>");
                    
add(motd,2500,arg2);
                    
add(motd,2500,"</td><td>");
                    
add(motd,2500,arg3);
                    
add(motd,2500,"</td><td>");
                    
add(motd,2500,arg4);
                    
add(motd,2500,"</td><td>");
                    
add(motd,2500,arg5);
                    
add(motd,2500,"</td><td>");
                    
add(motd,2500,"</td></tr>");
                    
                    
                }
            }
            
            
nvault_close(vault);
            
            
add(motd,2500,"</table></body></html>");
            
show_motd(plr ,motd,"KnifeTop");
        }
    } else {
        
ColorChat(plr RED"No records in topfile");
    }
}

public 
top_reset(plr,level,cid) {
    if(!
cmd_access(plr,level,cid,0)) {
        return 
PLUGIN_HANDLED;
    }
    
    new 
name[32];
    
get_user_name(plrname32);
    
    
    static 
knifetop[128];
    
format(knifetop128"%s/knifetop.vault",RecDir);
    if( 
file_exists(knifetop)) {
        
delete_file(knifetop);
        
ColorChat(0GREEN"[AMXX] ADMIN %s reseted the KnifeTop top"name);
        }
    return 
PLUGIN_HANDLED;
    

lazarev is offline
Racoon
Senior Member
Join Date: Mar 2008
Location: Ukraine
Old 11-12-2009 , 03:55   Re: [REQ] Knife kill stats
Reply With Quote #10

Thankx again, but now I have this:
Quote:
L 11/12/2009 - 01:09:46: [AMXX] Run time error 4 (plugin "knife_top.amxx") - debug not enabled!
Also /kniferank command does not work, only /knifetop has effect.
Racoon is offline
Send a message via ICQ to Racoon
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 01:22.


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