/* AMX Mod script. (Nov 10th, 2002)
*
* Stats Logging
*  by JustinHoMi
*
*/

#include <amxmod>
#include <csstats>

public client_disconnect(id) {
   if (!is_user_bot(id)) {
      new pteam[11],pname[33],authid[16]
      new userid = get_user_userid(id)
      get_user_team(id, pteam, 11)
      get_user_name(id,pname,33)
      get_user_authid(id, authid,16)

      new pstats[8], bhits[8], weapon[16]
      for(new i=1; i<=30; i++) {
         if(get_user_wstats(id,i,pstats,bhits)) {
            get_weaponname(i,weapon,16)
            log_message("^"%s<%i><%s><%s>^" triggered ^"weaponstats^" (weapon ^"%s^") (shots ^"%i^") (hits ^"%i^") (kills ^"%i^") (headshots ^"%i^") (tks ^"%i^") (damage ^"%i^") (deaths ^"%i^")",pname,userid,authid,pteam,weapon[7],pstats[4],pstats[5],pstats[0],pstats[2],pstats[3],pstats[6],pstats[1])
            switch(i){
               case 1: i++
               case 13: i=i+2
            }
         }
      }
   }

   return PLUGIN_CONTINUE
}

public plugin_init() {
   register_plugin("Stats Logging","0.1","JustinHoMi")
   return PLUGIN_CONTINUE
}

