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

top10 nvault


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
Sanjay Singh
Veteran Member
Join Date: Sep 2016
Old 01-25-2020 , 14:45   top10 nvault
Reply With Quote #1

This code shows only current online player and sorts data according, how can i fix it to show top15 from vault not online players xp.



PHP Code:
public show_top(id){
    static 
Sort[33][2];
    new 
players[32],num,count,index;
    
get_players(players,num);
    
    for(new 
0numi++){
        
index players[i];
        
Sort[count][0] = index;
        
Sort[count][1] = g_XP[index];
        
count++;
    }
    
    
SortCustom2D(Sort,count,"compare_xp");
    new 
motd[1501],iLen;
    
iLen format(motdsizeof motd 1,"<body bgcolor=#000000><font color=#98f5ff><pre>");
    
iLen += format(motd[iLen], (sizeof motd 1) - iLen,"%s %-22.22s %3s^n""#""Name""XP Top10");
    
    new 
clamp(count,0,10);
    new 
name[32],kindex;
    
    for(new 
0yx++){
        
kindex Sort[x][0];
        
get_user_name(kindex,name,sizeof name 1);
        
iLen += format(motd[iLen], (sizeof motd 1) - iLen,"%d %-22.22s %d^n"1nameSort[x][1]);
    }
    
iLen += format(motd[iLen], (sizeof motd 1) - iLen,"</body></font></pre>");
    
show_motd(id,motd"XP Top 10");
}
public 
compare_xp(elem1[], elem2[])
{
    if(
elem1[1] > elem2[1])
        return -
1;
    else if(
elem1[1] < elem2[1])
        return 
1;
    
    return 
0;

__________________
Sanjay Singh is offline
Send a message via AIM to Sanjay Singh
Bugsy
AMX Mod X Moderator
Join Date: Feb 2005
Location: NJ, USA
Old 01-25-2020 , 14:53   Re: top10 nvault
Reply With Quote #2

https://forums.alliedmods.net/showthread.php?t=307518
__________________
Bugsy is offline
Sanjay Singh
Veteran Member
Join Date: Sep 2016
Old 01-26-2020 , 03:53   Re: top10 nvault
Reply With Quote #3

Quote:
Originally Posted by Bugsy View Post
Bugsy am not using nvault array for loading bdw can you modify the existing code to get the data from g_XP[id]
__________________
Sanjay Singh is offline
Send a message via AIM to Sanjay Singh
OciXCrom
Veteran Member
Join Date: Oct 2013
Location: Macedonia
Old 01-26-2020 , 06:48   Re: top10 nvault
Reply With Quote #4

You MUST use nVault Utility in order to do that.
__________________

Last edited by OciXCrom; 01-26-2020 at 06:48.
OciXCrom is offline
Send a message via Skype™ to OciXCrom
Old 01-26-2020, 07:46
Sanjay Singh
This message has been deleted by Sanjay Singh.
OciXCrom
Veteran Member
Join Date: Oct 2013
Location: Macedonia
Old 01-26-2020 , 07:57   Re: top10 nvault
Reply With Quote #5

How is that relevant? If you're saving something, you MUST have a key which is probably a name or AuthID. How are you saving stuff without a key?!
__________________

Last edited by OciXCrom; 01-26-2020 at 07:57.
OciXCrom is offline
Send a message via Skype™ to OciXCrom
Natsheh
Veteran Member
Join Date: Sep 2012
Old 01-26-2020 , 10:59   Re: top10 nvault
Reply With Quote #6

Keys are the id numbers from 1 to 10 because you know it's top10..
__________________
@Jailbreak Main Mod v2.7.0 100%
@User Tag Prefix 100% done !
@Mystery Box 100% done !
@VIP System 100% done !


Last edited by Natsheh; 01-26-2020 at 11:00.
Natsheh is offline
Send a message via MSN to Natsheh Send a message via Skype™ to Natsheh
Bugsy
AMX Mod X Moderator
Join Date: Feb 2005
Location: NJ, USA
Old 01-26-2020 , 11:45   Re: top10 nvault
Reply With Quote #7

Sanjay I think you need to spend some time learning the basics before trying to code plugins.
__________________
Bugsy is offline
Sanjay Singh
Veteran Member
Join Date: Sep 2016
Old 01-26-2020 , 14:11   Re: top10 nvault
Reply With Quote #8

my bad
I am using authid as key @Oxicrom
__________________
Sanjay Singh is offline
Send a message via AIM to Sanjay Singh
Sanjay Singh
Veteran Member
Join Date: Sep 2016
Old 01-26-2020 , 14:12   Re: top10 nvault
Reply With Quote #9

Thnx for help
__________________
Sanjay Singh is offline
Send a message via AIM to Sanjay Singh
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 04:56.


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