
   /* AMX Mod script.
   *
   * (c) Copyright 2002-2003, OLO
   * This file is provided as is (no warranties).
   *
   */
   #include <amxmod>
   new teamsscore[8]
   new bool:validteam[8]
   new teamnames[8][16]
   new teamsnum
   public showscore(id){
       new players[32], inum
       console_print(id,"Players  Score:^n    # %-32s %-6s %-6s %-6s %-6s
   %s",
           "nick","score","deaths","ping","loss","team")
       new  name[32],  team[32],  loss,  ping,  deaths, frags, i, userid,
   total = 0
       for(new b = 0; b < teamsnum; ++b)
       {
           get_players(players,inum,"e",teamnames[b])

           total += inum

           for(new a = 0; a < inum; ++a)
           {
               i = players[a]
               get_user_ping(i,ping,loss)
               userid = get_user_userid(i)
               deaths = get_user_deaths(i)
               frags = get_user_frags(i)
               get_user_name(i,name,31)
               get_user_team(i,team,31)
               console_print(id,"%5d %-32s %-6d %-6d %-6d %-6d %s",
                   userid,name,frags,deaths,ping,loss,team)
           }

           if (inum && b+1 != teamsnum) console_print(id,"")
       }

       console_print(id,"Total %d^n",total)
       console_print(id,"Teams Score:^n %-16s %-6s","name","score")
       total = 0
       for(new b = 0; b < teamsnum; ++b)
           if (validteam[b]){
               console_print(id," %-16s %-6d",teamnames[b],teamsscore[b])
               total++
           }
       console_print(id,"Total %d^n",total)
       return PLUGIN_CONTINUE
   }
   public setscore(){
       new team[16], a
       read_data(1,team,15)
       for(a = 0; a < teamsnum; ++a)
           if (equal(teamnames[a],team))
               break
       teamsscore[a] = read_data(2)
       validteam[a] = true
   }
   public teaminfo(){
       if  (is_user_alive(read_data(1)))  return  /*  saves  from useless
   checks at respawn */
       new team[16], a
       read_data(2,team,15)
       for(a = 0; a < teamsnum && a < 7; ++a)
           if (equal(teamnames[a],team))
               return
       copy(teamnames[teamsnum++],15,team)
   }
   public plugin_init() {
      register_plugin("Show Score","0.3","default")
      register_concmd("showscore","showscore",0,"-  prints  players score
   to the console")
      register_event("TeamScore","setscore","a")
      register_event("TeamInfo","teaminfo","a")
      return PLUGIN_CONTINUE
   }
