Handy Utils (useful scripts)
#3
Sure, no problem

Autoexec (miscelaneous)
// MISC
mapstartalways [fog 1024]
bind "F" "toggleconsole"
editbind "F"
specbind "F"

//DEMO VIEWING BINDS
bind "UP" "gamespeed 150"
bind "RIGHT" "gamespeed 175"
bind "DOWN" "gamespeed 100"
bind "LEFT" "gamespeed 50"

//SERVER MENU
bind "M" [showmenu "Inter Server"]

//Inter Server menu
//Main
newmenu "Inter Server"

menuitem "MyS" [showmenu "MyS"]
menuitem "Outshiners" [showmenu "Outshiners"]
menuitem "XRD" [showmenu "XRD"]

//MyS
newmenu "MyS"
menuitem "MyS 1.3 1111" [connect mysick.org 1111]
menuitem "MyS 1.3 2222" [connect mysick.org 2222]

//Outsh.me
newmenu "Outshiners"
menuitem "O* 11" [connect outsh.tk 11 1337]
menuitem "O* 22" [connect outsh.tk 22 1337]

//XRD
newmenu "XRD"
menuitem "XRD 4" [connect xrd.me 4000 match]
menuitem "XRD 5" [connect xrd.me 5000 match]


Teamkillers menu
// scripts/teamkillers_display2.cfg
// written by Thrawn updated by Infinity


bind C [show_teamkillers]

//dont save any of this to saved.cfg
persistidents 0

alias show_teamkillers [
  delmenu Teamkillers
 
  newmenu Teamkillers
  alias templist1 []
  alias templist2 []
  alias tmp []
  alias tmp2 []
 
  menuitem (concatword "| \fRCN\f5 | " "\fBTeamkills\f5" " | " "\fJName\f5" " |") -1
  alias tklist []

  // Old Method//
  //loop _cn 20 [
  //  if (isclient $_cn) [
  //    if (> (player $_cn tks) 0) [
  //      add2list _tklist $_cn
  //      menuitem (concatword "| \f1" $_cn "\f5 | \f3" (player $_cn tks) "\f5 | \f0" (player $_cn name)) -1
  //    ]
  //  ]
  //]
  //if (= (listlen $_tklist) 0) [ menuitem (concatword "\fPNo Teamkills detected! :D") -1] []
 
  if (! (watchingdemo)) [alias tmp (+ 1 (highestcn))] [alias tmp 20] //highestcn doesnt work in demos
  loop _cn $tmp [
    if (isclient $_cn) [
      if (> (player $_cn tks) 0) [
     
        //create a list where each entry is the number of teamkills combined with client number in a single entry
        //l0 adds leading zeros to normalize number lengths
        add2list templist1 (concatword (l0 3 (player $_cn tks)) (l0 2 $_cn))
          //--Note, this will badly break the script if any one client has more than 999 teamkills in a match,
          //--  or if their cn is higher than 99. But, those are both so unlikely that its safe to assume neither will occur
      ]
    ]
  ]
 
  if (= (listlen $templist1) 0) [ menuitem (concatword "\fPNo Teamkills detected! :D") -1 ] [
   
    //since teamkills are the first 3 digits of each item, effectively sort by number of teamkills, then by cn
    alias templist1 (sortlist $templist1) //Note: sortlist sorts in ascending order (lowest-to-highest)
   
    //strip the first 3 digits containg teamkills, as they were only for sorting; leave behind the 2 digit client numbers
    looplist $templist1 tmp [ add2list templist2 (substr $tmp 3) ]
   
    //reverse list (we want descending (highest-to-lowest) sorting of teamkills)
    looplist $templist2 tmp [ push tmp2 $tmp ]   
    loop i (listlen $templist2) [
      add2list tklist $tmp2
      pop tmp2
    ]
   
    //Weve got the sorted list of client numbers of teamkillers, were good to go! :D
    looplist $tklist _cn [
      if (< $_cn 10) [
     
        //strip leading zero from single-digit client numbers (having a leading zero causes odd behavior and breaks the script)
        alias _cnf (substr $_cn 1)
      ] [
        alias _cnf $_cn //If double-digit, just copy the value
      ]
      menuitem (concatword "|  \f1" $_cnf "\f5 | \f3" (player $_cnf tks) "\f5 | \f0" (player $_cnf name)) -1
    ]
  ]
 
  showmenu Teamkillers
 
  onrelease [closemenu Teamkillers; delmenu Teamkillers;]
]

persistidents 1 //Turn saving to saved.cfg back on
Thanks given by: Bukz This user is a dev/forum admin , D3M0NW0LF


Messages In This Thread
Handy Utils (useful scripts) - by Infinity - 15 Aug 23, 08:06PM
RE: Handy Utils (useful scripts) - by Bukz - 16 Aug 23, 05:45PM
RE: Handy Utils (useful scripts) - by Infinity - 16 Aug 23, 08:58PM