Raised This Month: $32 Target: $400
 8% 

[REQ] Fix nVault errors


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
5aloOod
Senior Member
Join Date: Jun 2013
Location: hell
Old 07-25-2014 , 16:38   [REQ] Fix nVault errors
Reply With Quote #1

Hello everyone
this Knife Stat plugin use Nvault saving and its have problems with it
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;
    

PHP Code:
L 07/25/2014 17:30:27: [AMXXDisplaying debug trace (plugin "knifetop.amxx"version "1.0"
L 07/25/2014 17:30:27: [AMXXRun time error 10native error (native "nvault_get"
L 07/25/2014 17:30:27: [AMXX]    [0knifetop.sma::update (line 57
L 07/25/2014 17:30:27: [AMXX]    [1knifetop.sma::kniferank (line 80
L 07/25/2014 17:32:37: [nVaultInvalid vault id
and also its make problems for any other plugin that use nVault saving :/
so i need some one who could fix the plugin

Help please
thanks for your attention
__________________
اَشْهَدُ اَنْ لَّآ اِلٰهَ اِلَّا اللہُ وَحْدَه لَا شَرِيْكَ لَه وَ اَشْهَدُ اَنَّ مُحَمَّدًا عَبْدُه وَرَسُوْلُه

Last edited by 5aloOod; 08-10-2014 at 06:03.
5aloOod is offline
Old 07-25-2014, 16:40
5aloOod
This message has been deleted by YamiKaitou. Reason: don't post, just report
ReD MaN
Member
Join Date: Jun 2014
Location: i dont Know --'
Old 07-25-2014 , 18:46   Re: [REQ] Fix nVault errors
Reply With Quote #2

You have a bug with this plugin : knifetop.amxx
__________________
Forum logo : No Steam = No Support
ReD MaN is offline
5aloOod
Senior Member
Join Date: Jun 2013
Location: hell
Old 07-26-2014 , 05:27   Re: [REQ] Fix nVault errors
Reply With Quote #3

Quote:
Originally Posted by ReD MaN View Post
You have a bug with this plugin : knifetop.amxx
i know ...
and i am requesting to fix it
__________________
اَشْهَدُ اَنْ لَّآ اِلٰهَ اِلَّا اللہُ وَحْدَه لَا شَرِيْكَ لَه وَ اَشْهَدُ اَنَّ مُحَمَّدًا عَبْدُه وَرَسُوْلُه
5aloOod is offline
Old 08-06-2014, 09:06
5aloOod
This message has been deleted by YamiKaitou. Reason: wait 14 days before you bump
5aloOod
Senior Member
Join Date: Jun 2013
Location: hell
Old 08-10-2014 , 06:02   Re: [REQ] Fix nVault errors
Reply With Quote #4

BUMP
__________________
اَشْهَدُ اَنْ لَّآ اِلٰهَ اِلَّا اللہُ وَحْدَه لَا شَرِيْكَ لَه وَ اَشْهَدُ اَنَّ مُحَمَّدًا عَبْدُه وَرَسُوْلُه
5aloOod is offline
5aloOod
Senior Member
Join Date: Jun 2013
Location: hell
Old 08-26-2014 , 06:23   Re: [REQ] Fix nVault errors
Reply With Quote #5

Quote:
Originally Posted by 5aloOod View Post
BUMP
__________________
اَشْهَدُ اَنْ لَّآ اِلٰهَ اِلَّا اللہُ وَحْدَه لَا شَرِيْكَ لَه وَ اَشْهَدُ اَنَّ مُحَمَّدًا عَبْدُه وَرَسُوْلُه
5aloOod is offline
xxxperts
Senior Member
Join Date: Oct 2013
Location: India
Old 08-26-2014 , 09:30   Re: [REQ] Fix nVault errors
Reply With Quote #6

I have the my version of plugin if u need that you can use that

Attached Files
File Type: sma Get Plugin or Get Source (knifestat.sma - 560 views - 8.0 KB)
File Type: sma Get Plugin or Get Source (knifestat_steamid.sma - 545 views - 8.0 KB)
__________________
All my work is here
xxxperts is offline
5aloOod
Senior Member
Join Date: Jun 2013
Location: hell
Old 08-27-2014 , 08:19   Re: [REQ] Fix nVault errors
Reply With Quote #7

Quote:
Originally Posted by xxxperts View Post
I have the my version of plugin if u need that you can use that

thanks for your reply but i have one question
the first one saves by nickname and the second saves by steamID? or i should use both of them ?
__________________
اَشْهَدُ اَنْ لَّآ اِلٰهَ اِلَّا اللہُ وَحْدَه لَا شَرِيْكَ لَه وَ اَشْهَدُ اَنَّ مُحَمَّدًا عَبْدُه وَرَسُوْلُه
5aloOod is offline
xxxperts
Senior Member
Join Date: Oct 2013
Location: India
Old 08-27-2014 , 08:37   Re: [REQ] Fix nVault errors
Reply With Quote #8

Quote:
Originally Posted by 5aloOod View Post
thanks for your reply but i have one question
the first one saves by nickname and the second saves by steamID? or i should use both of them ?
Yes, First one save data with name & Second one with SteamID. and dont use both of them at once,
__________________
All my work is here
xxxperts is offline
chaves
Senior Member
Join Date: Oct 2011
Old 05-07-2016 , 18:15   Re: [REQ] Fix nVault errors
Reply With Quote #9

Quote:
Originally Posted by xxxperts View Post
I have the my version of plugin if u need that you can use that

It does not work for me
chaves is offline
EFFx
Veteran Member
Join Date: Feb 2016
Location: São Paulo, Brasil
Old 05-07-2016 , 18:18   Re: [REQ] Fix nVault errors
Reply With Quote #10

Quote:
Originally Posted by chaves View Post
It does not work for me
Non steam - no help
__________________
• Ranking System • AutoMix 5vs5 System
• Web Ban System • Plugins for free

____________________________________________
For private works:
• Discord: EFFEXo#8850 • Steam: EFFEXo
EFFx is offline
Reply


Thread Tools
Display Modes

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 12:42.


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