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

Nvault top15


Post New Thread Reply   
 
Thread Tools Display Modes
Napoleon_be
Veteran Member
Join Date: Jul 2011
Location: Belgium
Old 07-03-2016 , 08:40   Re: Nvault top15
Reply With Quote #11

Can you provide the nvault_util include please.
__________________
Napoleon_be is offline
Send a message via Skype™ to Napoleon_be
HamletEagle
AMX Mod X Plugin Approver
Join Date: Sep 2013
Location: Romania
Old 07-03-2016 , 08:56   Re: Nvault top15
Reply With Quote #12

https://forums.alliedmods.net/showthread.php?t=139584
__________________
HamletEagle is offline
Napoleon_be
Veteran Member
Join Date: Jul 2011
Location: Belgium
Old 07-03-2016 , 16:27   Re: Nvault top15
Reply With Quote #13

Quote:
Originally Posted by BaD CopY View Post
What is wrong with my code ?

PHP Code:
#include <amxmodx>
#include <amxmisc>
#include <nvault_util>
#include <fun>
#include <cstrike>
#include <ColorChat>

#define PLUGIN ""
#define VERSION "1.0"
#define AUTHOR ""

#define TopNumber 15
#define MAX_PLAYERS 32

new gPointsMAX_PLAYERS ]
new const 
SPECIAL_CHAR[2] = "-"
new g_iVault
new g_szTopMotd[1024]


public 
plugin_init() {
    
register_plugin(PLUGINVERSIONAUTHOR)
    
    
g_iVault nvault_open("POINTS")
    
FormatTop(TopNumber)
    
register_clcmd("say /btop15""show_top15");
}

public 
client_connect(id)
{
    
Load_Points(id);
}

public 
client_disconnect(id)
{
    
Save_Points(id);
}

stock Save_Pointsid )
{
    if(
g_iVault == INVALID_HANDLE)
        
set_fail_state("nVault returned invalid handle")
    
    new 
szAuthId[35]; 
    
get_user_authid(idszAuthIdcharsmax(szAuthId))
    
    new 
szName[32]; 
    
get_user_name(idszName31)
    
    new 
szData[256];
    
formatex(szDatacharsmax(szData), "%i"gPoints[id]);
    
    
nvault_remove(g_iVaultszAuthId)
    
nvault_set(g_iVaultszAuthIdszData)
        
    
format(szAuthIdcharsmax(szAuthId), "%s%s"szAuthIdSPECIAL_CHAR)
    
nvault_remove(g_iVaultszAuthId)
    
nvault_set(g_iVaultszAuthIdszName)

}

stock Load_Pointsid )
{
    if(
g_iVault == INVALID_HANDLE)
        
set_fail_state("nVault returned invalid handle")
        
    new 
szSavedName[32]
    new 
szName[32]; get_user_name(idszNamecharsmax(szName))
    new 
szAuthId[33]; get_user_authid(idszAuthIdcharsmax(szAuthId))
    
    new 
szData[256], iTimeStamp
    
if( !nvault_lookup(g_iVaultszAuthIdszDatacharsmax(szData), iTimeStamp) )
    {
        
nvault_set(g_iVaultszAuthId"0")
        
        
format(szAuthIdcharsmax(szAuthId), "%s%s"szAuthIdSPECIAL_CHAR)
        
nvault_set(g_iVaultszAuthIdszName)
        
        return 
0
    
}
    
    
ParseLoadData(idszData);
    
    
format(szAuthIdcharsmax(szAuthId), "%s%s"szAuthIdSPECIAL_CHAR)
    
nvault_get(g_iVaultszAuthIdszSavedName)
    
    if(!
equal(szNameszSavedName))
    {
        
nvault_remove(g_iVaultszAuthId)
        
nvault_set(g_iVaultszAuthIdszName)
    }
    return 
0
}

ParseLoadData(idszData[256])
{
    static 
szNum[11];
    
strbreak(szDataszNumcharsmax(szNum), szDatacharsmax(szData));
    
gPoints[id] = str_to_num(szNum);
}

public 
show_top15(id)
    
show_motdidg_szTopMotd"Top Points" )

stock FormatTop(iNum)
{    
    if(
g_iVault == INVALID_HANDLE)
        
set_fail_state("nVault returned invalid handle")
        
    
enum _:VaultData
    
{
        
VD_Key[33],
        
VD_Value,
        
VD_szName[33]
    };
    
    new 
Vault2 nvault_util_open("POINTS")
    new 
iSize nvault_util_count(Vault2)
    
    new Array:
entries ArrayCreate(VaultData);
    new 
sizeEntries
    
    
new data[VaultData], value[256], data2[VaultData]

    for(new 
0postimestampiSizei++)
    {
        
pos nvault_util_read(Vault2posdata[VD_Key], charsmax(data[VD_Key]), valuecharsmax(value), timestamp);
    
        if(
contain(data[VD_Key], SPECIAL_CHAR) != -1)
            continue;
        
        else
        {
            
formatex(data[VD_szName], charsmax(data[VD_szName]), "%s%s"data[VD_Key], SPECIAL_CHAR)
            
nvault_get(g_iVaultdata[VD_szName], data[VD_szName], charsmax(data[VD_szName]))
        }

        
data[VD_Value] = str_to_num(value);
        
        if(
sizeEntries == 0)
        {
            
ArrayPushArray(entriesdata);
            
sizeEntries++;
            continue;
        }
        
        else
        {
            for(
timestamp 0timestamp <= sizeEntriestimestamp++)
            {
                if(
timestamp == sizeEntries)
                {
                    if(
sizeEntries iNum)
                    {
                        
ArrayPushArray(entriesdata);
                        
sizeEntries++;
                    }
                    
                    break;
                }
          
                
ArrayGetArray(entriestimestampdata2);
                
                if(
data[VD_Value] >= data2[VD_Value])
                {
                    
ArrayInsertArrayBefore(entriestimestampdata);
                    
                    if(
sizeEntries iNum)
                    {
                        
sizeEntries++;
                    } 
                    else 
                    {
                        
ArrayDeleteItem(entriessizeEntries);
                    }
                    
                    break;
                }
            }
        }
    }
    
    new 
iLen
    
    
new len charsmax(g_szTopMotd)
    
    
iLen formatex(g_szTopMotdlen"<STYLE>body{background:#212121;color:#d1d1d1;font-family:Arial}table{width:100%%;font-size:28px}</STYLE><table cellpadding=1 cellspacing=1 border=0>")
    
iLen += formatex(g_szTopMotd[iLen], len iLen"<tr bgcolor=#333333><th width=1%%><align=left font color=white> %s <th width=5%%> %-22.22s <th width=5%%> %s""#""Name""Points")

    new 
i
    
for(0sizeEntriesi++)
    {
        
ArrayGetArray(entriesidata);
        
        
data[VD_Key][32] = 0;
        
data[VD_szName][32] = 0
        
        replace_all
(data[VD_szName], charsmax(data[VD_szName]), "<""&lt;")
        
replace_all(data[VD_szName], charsmax(data[VD_szName]), ">""&gt;")
        
        
iLen += formatex(g_szTopMotd[iLen], len iLen"<tr align=left%s><td align=left><font color=white> %d. <td> %-22.22s <td> %d"" bgcolor=#2b5b95", (i+1), data[VD_szName], data[VD_Value])
    }
    
    
ArrayDestroy(entries);
    
    
iLen += formatex(g_szTopMotd[iLen], len iLen"</table></body>")

Error: Doesn't show player name in motd. Shows only first 7 players (points). Shows '<tr align=left bgcolor=#2b5b' instead players points...
Can you also please provide the original code? I can sense that this plugin is not the original one..
__________________
Napoleon_be is offline
Send a message via Skype™ to Napoleon_be
BaD CopY
Senior Member
Join Date: Oct 2014
Location: Home
Old 07-04-2016 , 11:53   Re: Nvault top15
Reply With Quote #14

Quote:
Originally Posted by Napoleon_be View Post
Can you also please provide the original code? I can sense that this plugin is not the original one..
For what you need deathmsg ?

PHP Code:
public onDeathMsg()
{
    new 
Killer read_data(1);
    new 
Victim read_data(2);
    
    if (
Killer >= && Killer != Victim)
    {
                
gPoints[Killer] += 1;
        }

BaD CopY is offline
Send a message via Yahoo to BaD CopY Send a message via Skype™ to BaD CopY
BaD CopY
Senior Member
Join Date: Oct 2014
Location: Home
Old 07-09-2016 , 18:25   Re: Nvault top15
Reply With Quote #15

Anyone, please ?
BaD CopY is offline
Send a message via Yahoo to BaD CopY Send a message via Skype™ to BaD CopY
xxxperts
Senior Member
Join Date: Oct 2013
Location: India
Old 07-11-2016 , 02:19   Re: Nvault top15
Reply With Quote #16

Quote:
Originally Posted by BaD CopY View Post
Anyone, please ?
what do you want ?

I suggest you to make new thread !
__________________
All my work is here

Last edited by xxxperts; 07-11-2016 at 02:19.
xxxperts 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 17:10.


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