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

Plugin HITS RANKING for admin.


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
iveto69
Member
Join Date: Aug 2018
Old 04-18-2019 , 10:01   Plugin HITS RANKING for admin.
Reply With Quote #1

Hello again guys,

I have an other Plugin: for command /hsall. Can it be reworked or rewritten, so that the pop up window - to provide information about the following things:

HITS RANKING

nick HEAD CHEST STOMACH L.ARM R.ARM L.LEG R.LEG

1. player 28 43 47 31 26 12 16
2. unnamed 12 26 31 18 14 8 13
3. CHEATER 1 79 2 1 0 0 0
... .. .. .. .. .. .. .. ..
31. qwerty 23 40 52 36 25 18 23

and this is the processing code, or the basis for a new plug-in"

Code:
#include <amxmodx> 

#define MAX_TXT_LEN   300 
#define MAX_TXT_LEN_1 299 

new killr = 0      /* describes current killer ( his id ) */
new nbHS[33]       /* to store HS of players connected    */
new nbFrags[33]    /* to store frags of players connected */
new ranking[33]    /* Rankingtab : 32 players from 1 to 32 ( 0 not used ) */ 

new titleMotd[30] = "    HEADSHOT : Rankings"
new textFrags[25] = "Frags"
new noHeadshot[50]= "No Headshot, try later"

public init_stats() { 
   for ( new z = 0 ; z < 33 ; ++z ) {
      nbHS[z]    = 0
      nbFrags[z] = 0
      ranking[z] = 0 
   }

   new hsflgs[10] 
   get_cvar_string("amx_hs_event",hsflgs,9) 

   return PLUGIN_CONTINUE     
} 

public get_rank(id) { 
   for ( new z = 1 ; z < 33 ; ++z ) 
      if ( ranking[z] == id ) 
         return z 
   return 0    
} 

public get_maxP() { 
   new value = 0 
   for ( new z = 1 ; z < 33 ; ++z ) 
      if ( ranking[z] != 0 ) 
         ++value 
   return value    
} 

public remove_player(id) { 
   for ( new z = 0 ; z < 33 ; ++z ) { 
      if ( ranking[z] == id ) { 
         for ( new t = z ; t < 32 ; ++t ) 
            ranking[t] = ranking[t+1] 
         ranking[32] = 0 
         return PLUGIN_CONTINUE 
      } 
   }    
   nbHS[id]=0   
   nbFrags[id]=0
   return PLUGIN_CONTINUE 
} 

public update_rankings() { 
   for ( new z = 1 ; z < 33 ; ++z ) { 
       
      if ( ranking[z] == 0 ) { 
         ranking[z] = killr 
         return PLUGIN_CONTINUE 
      } 
      else if ( ranking[z] != killr ) { 

         if ( nbHS[killr] > nbHS[ranking[z]]  ) { 
            for ( new w = 32 ; w > z ; --w ) { 
               ranking[w] = ranking[w-1] 
            } 
            ranking[z] = killr 
            new dec = 0 
            for ( new x = z+1 ; x < 33 ; ++x ) { 
               if ( ranking[x] == killr ) { 
                  ++dec    
                  ranking [33-dec] = 0 
               } 
               if ( x+dec < 33 ) 
                  ranking[x]=ranking[x+dec]                
            } 
            return PLUGIN_CONTINUE 
         } 
         else if ( nbHS[killr] == nbHS[ranking[z]] ) { 

            new Float:prct1  = ( float(nbHS[killr])     / float( nbFrags[killr] ) ) * 100 
            new Float:prct2  = ( float(nbHS[ranking[z]]) / float( nbFrags[ranking[z]] ) ) * 100 
            if ( prct1 > prct2 ) { 
               for ( new w = 32 ; w > z ; --w ) { 
                  ranking[w] = ranking[w-1] 
               } 
               ranking[z]   = killr 
               new dec = 0 
               for ( new x = z+1 ; x < 33 ; ++x ) { 
                  if ( ranking[x] == killr ) { 
                     ++dec    
                     ranking [33-dec] = 0 
                  } 
                  if ( x+dec < 33 ) 
                     ranking[x]=ranking[x+dec]                
               } 
               return PLUGIN_CONTINUE 
            } 
         } 
      } 
      else if ( ranking[z] == killr ) { 
         return PLUGIN_CONTINUE 
      } 
   } 
   return PLUGIN_CONTINUE 
} 




public display_HS_TOP ( id ) { 

   new title[80] 
   new topText[2000] 
   new NameP[40] 
   format ( title , 79 ,titleMotd ) 
   new NB = 0 
   new hsflags[10]
   get_cvar_string("amx_hs_event",hsflags,9) 

   if ( read_flags(hsflags)&32) {

      new textC1[200];  /* Rank column         */ 
      new textC2[700];  /* Name column         */ 
      new textC3[200];  /* HS column           */ 
      new textC4[200];  /* % of frags column 1 */ 
      new textC5[200];  /* % of frags column 2 */ 
    
      for ( new d = 1 ; d < 16 ; ++d ) { 
         new userId = ranking[d] 

         if ( userId == 0 ) { 
            /* No more rankings */ 
            d = 50       
         } 
         else if ( is_user_connected(userId) ) { 

            if ( nbHS[userId] > 0 ) { 
               get_user_name ( userId , NameP , 39 ) 
               new Float:percent  = ( float(nbHS[userId]) / float(nbFrags[userId]) ) * 100 
               new temp1[10] 
               format ( temp1 , 9 , "%d<br>" , d ) 
               add( textC1,199,temp1) 

new temp6[256]

               
               format ( temp6 , 255 , "%s<br />" , NameP ) 
               add( textC2,699,temp6) 
               new temp3[30] 
               format ( temp3 , 29 , "%d<br>" , nbHS[userId] ) 
               add( textC3,199,temp3)                
               new temp4[10] 
               format ( temp4 , 9 , "%.1f<br>" , percent ) 
               add( textC4, 199, temp4 ) 
               add( textC5, 199, "%<br>" ) 

               ++NB 
            }    
         } 
      } 

      if ( NB == 0 ) { 
         add (topText,1999,"<html><head></head><body bgcolor=^"#000^" text=^"#228B22^">") 
         add (topText,1999,"<div align=^"center^">") 
         add (topText,1999,"<font size=^"2^" face=^"Arial, Helvetica, sans-serif^" color=228B22>") 
         add (topText,1999,"<br><br><br><b>") 
         new temp6[100] 
         format ( temp6 ,99, "%s ...",noHeadshot ) 
         add (topText,1999,temp6) 
         add (topText,1999,"</b></font></div></body></html>") 
      } 
      else { 
         add (topText,1999,"<html><head></head><body bgcolor=^"#000^" text=^"#228B22^">") 
         add (topText,1999,"<table align=^"center^" width=^"80%^">") 
         add (topText,1999,"<td bgcolor=^"#000^" width=^"12%^">") 
         add (topText,1999,"<div align=^"center^">") 
         add (topText,1999,"<font size=^"2^" face=^"Arial, Helvetica, sans-serif^" color=orange><br><br><b>") 
         add (topText,1999,textC1) 
         add (topText,1999,"</b></td><td bgcolor=^"#000^"><div align=^"left^" width=^"48%^">") 
         add (topText,1999,"<font size=^"2^" face=^"Arial, Helvetica, sans-serif^" color=228B22><br><br><b>") 
         add (topText,1999,textC2) 
         add (topText,1999,"</b></font></div></td><td bgcolor=^"#000^" width=^"20%^"><div align=^"center^">") 
         add (topText,1999,"<font size=^"2^" face=^"Arial, Helvetica, sans-serif^" color=228B22><b>HS</b><br><br><b>") 
         add (topText,1999,textC3) 
         add (topText,1999,"</b></font></div></td><td bgcolor=^"#000^" width=^"15%^"><div align=^"right^">") 
         add (topText,1999,"<font size=^"2^" face=^"Arial, Helvetica, sans-serif^" color=228B22><b>Frags</b><br><br><b>") 
         add (topText,1999,textC4) 
         add (topText,1999,"</b></font></div></td><td bgcolor=^"#000^" width=^"5%^"><div align=^"left^">") 
         add (topText,1999,"<font size=^"2^" face=^"Arial, Helvetica, sans-serif^" color=228B22><br><br><b>") 
         add (topText,1999,textC5) 
         add (topText,1999,"</b></font></div></td></table></body></html>") 
      } 
   } 
   else { 

      for ( new d = 1 ; d < 33 ; ++d ) { 
         new userId = ranking[d] 

         if ( userId == 0 ) { 
            /* No more rankings */ 
            d = 50       
         } 
         else if ( is_user_connected(userId) ) { 

            if ( nbHS[userId] > 0 ) { 
               get_user_name ( userId , NameP , 39 ) 
               new Float:percent  = ( float(nbHS[userId]) / float(nbFrags[userId]) ) * 100 
               new temp[MAX_TXT_LEN] 
               format ( temp , MAX_TXT_LEN_1 ,  "^n%d - %s^n       %4d Headshot(s) - %s %.1f %% " ,d,NameP,nbHS[userId],textFrags,percent) 
               add( topText,2999,temp) 
               ++NB 
            }    
         } 
      } 

      if ( NB == 0 ) 
         format ( topText ,2047, "^n^n^n %s ...",noHeadshot )    
   } 


   show_motd(id,topText,title) 

   return PLUGIN_CONTINUE 
    
} 

public made_hs(){ 

   killr = read_data(1) 

   if ( killr > 0 )
   {
      nbHS[killr]=nbHS[killr]+1
      update_rankings()    

   }

   return PLUGIN_CONTINUE 

} 

public made_frag(id){

   killr = read_data(1) 

   if ( killr > 0 )
   {
      nbFrags[killr]=nbFrags[killr]+1


      if ( ( read_data(3) == 1 ) && ( read_data(5) == 0 ) )
      {
         made_hs()
      }
   }

   return PLUGIN_CONTINUE 

}

public client_disconnect(id) { 
   remove_player(id) 
   return PLUGIN_CONTINUE 
} 

public plugin_init(){    
   register_plugin("Headshot DeluXe","X.16.1.0","DanRaZor/dedi") 

   init_stats() 

   register_cvar("hsd_version","X.16.1.0",FCVAR_SERVER)

   register_event   ("DeathMsg","made_frag","a" ) 

   register_cvar    ("amx_hs_event"      ,"abf")

   register_clcmd   ("say /hsall"        , "display_HS_TOP") 
   register_clcmd   ("say_team /hsall"   , "display_HS_TOP") 

   return PLUGIN_CONTINUE 
}


That is, submitted this information, which is obtained when entering the command / me , (with the difference that there will be information about all the live games on the server).
Only for example:
3head: 2 chest: 5 stomach: 1 L. arm: 9 R. arm: 2 L. leg: 5 R. leg: 4

The popup window with this information is called by command / hits , only by players with flag d-ADMIN BANS.

Thanks and sorry for my bad English !

Last edited by iveto69; 04-18-2019 at 10:05.
iveto69 is offline
OciXCrom
Veteran Member
Join Date: Oct 2013
Location: Macedonia
Old 04-18-2019 , 13:55   Re: Plugin HITS RANKING for admin.
Reply With Quote #2

For plugin requests, use the plugin requests section...
__________________
OciXCrom is offline
Send a message via Skype™ to OciXCrom
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 09:37.


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