Raised This Month: $ Target: $400
 0% 

Nvault top15


  
 
 
Thread Tools Display Modes
Prev Previous Post   Next Post Next
Author Message
ironskillz1
AlliedModders Donor
Join Date: Jul 2012
Location: Sweden
Old 12-11-2012 , 12:20   Nvault top15
Reply With Quote #1

in top15 its shows steamid insted of names
i want i to show name
how can i fix that?

Code:
stock save_client_points( index )
{
 gVault = nvault_open( "Jbcash" )
 
 if( gVault == INVALID_HANDLE )
 {
  set_fail_state( "[JbShop] nValut ERROR: =-> Invalid-Handle" )
 }
 
 get_user_authid( index, gSteamID, charsmax( gSteamID ) )
 
 formatex( vKey, charsmax( vKey ), "%sCASH", gSteamID )
 formatex( vData, charsmax( vData ), "%d", gKillerPoints[ index ] )
 nvault_set( gVault, vKey, vData )
 nvault_close( gVault )
}
stock load_client_points( index )
{
 gVault = nvault_open( "Jbcash" )
 
 if( gVault == INVALID_HANDLE )
 {
  set_fail_state( "[JbShop] nValut ERROR: =-> Invalid-Handle" )
 }
 
 get_user_authid( index, gSteamID, charsmax( gSteamID ) )
 
 formatex( vKey, charsmax( vKey ), "%sCASH", gSteamID )
 gKillerPoints[ index ] = nvault_get( gVault, vKey )
 nvault_close( gVault )
}
public show_top15(id){
 new pos,key[64],data[64],timestamp
 new vault = nvault_util_open("Jbcash")
 new count = nvault_util_count(vault)
 
 new Array:stats,Trie:names
 stats = ArrayCreate(20)
 names = TrieCreate()
 
 new temp[20],knum[5]
 for (new i=1;i<=count;i++ ){
  pos = nvault_util_read(vault,pos,key,64,data,64,timestamp)
  formatex(temp,19,"%d %d",i,str_to_num(data))
  ArrayPushString(stats,temp)
  replace_all(key,64,"CASH","")
  formatex(knum,4,"%d",i)
  TrieSetString(names,knum,key)
 }
 
 nvault_util_close(vault)
 ArraySort(stats,"sorter")
 
 new motd[1501],iLen;
 iLen = format(motd, sizeof motd - 1,"<body bgcolor=#000000><font color=#98f5ff><pre>");
 iLen += format(motd[iLen], (sizeof motd - 1) - iLen,"%s %-22.22s %3s^n", "#", "Name", "Cash")
 
 for(new x = 0; x < 15; x++){
  new rank,name[32],srank[5]
  new pt = getter(stats,x,rank)
  formatex(srank,4,"%d",rank)
  TrieGetString(names,srank,name,31)
  iLen += format(motd[iLen], (sizeof motd - 1) - iLen,"%d %-22.22s %d^n", x + 1, name, pt);
 }
 iLen += format(motd[iLen], (sizeof motd - 1) - iLen,"</body></font></pre>")
 
 ArrayDestroy(stats)
 TrieDestroy(names)
 show_motd(id,motd, "Cash top");
}
public sorter(Array:array,item1,item2){
 new res1=getter(array,item1)
 new res2=getter(array,item2)
 
 if(res1<res2)
  return 1
 
 else if(res1>res2)
  return -1
 return 0
}
getter(Array:array,item,&rank=0){
 new outa[32],temp[2][10],val
 ArrayGetString(array,item,outa,31)
 parse(outa,temp[0],9,temp[1],9)
 rank = str_to_num(temp[0])
 val = str_to_num(temp[1])
 return val
}
 
public ClientUserInfoChanged(id) 
{ 
 static const name[] = "name" 
 static szOldName[32], szNewName[32] 
 pev(id, pev_netname, szOldName, charsmax(szOldName)) 
 if( szOldName[0] ) 
 {
  get_user_info(id, name, szNewName, charsmax(szNewName)) 
  if( !equal(szOldName, szNewName) ) 
  {
   gKillerPoints[id] = 0
   set_task(0.5, "ChangeTime", id)
   return FMRES_HANDLED 
  }
 }
 return FMRES_IGNORED 
}
__________________
I have many private and unique plugins for Jailbreak and Hide'N'Seek. PM me for more info.

Pm me.

Check out my roulette site.
ironskillz1 is offline
Send a message via Skype™ to ironskillz1
 



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 18:11.


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