
   //A version of LGBR's NoTK pluging
   //heavily modified by Arete
   /*
   CHANGELOG
   1.03
   -added the garand butt to announce list.
   -some code optimizations and changes
   1.02
   -Removed slowing it was an old remnant from LGBR's plugin,
   and it wasn't used that much. This plugin can now run without
   fun-mode.
   TO-DO list
   -tk menu options optionable for server admin
   -Cvars for tk point amount/weapon
   -ability to forgive by saying !forgivetk if you lose the menu somehow
   -if possible, remove the need for logd
   */
   #include <amxmod>
   #include <logd>
   new choosing[33]
   new tkcount[33]
   new latestkiller[33]
   new gMenu
   new lastcredit[33]
   new maxtkcreds
   //1. forgive TK
   public menu_option1(id,keys)
   {
       if (choosing[id] == 1)
       {
           choosing[id] = 0
           tkcount[latestkiller[id]] -= lastcredit[latestkiller[id]]
           new killername[33]
           get_user_name(latestkiller[id],killername,32)
           new victimname[33]
           get_user_name(id,victimname,32)
           client_print(0,  print_chat,  "%s  forgave  %s.",  victimname,
   killername)
           return PLUGIN_HANDLED
           }
       return PLUGIN_CONTINUE
       }
   //2. Slap (5)
   public menu_option2(id,key)
   {
       if (choosing[id] == 1)
       {
           choosing[id] = 0
           tkcount[latestkiller[id]] -= 5
           user_slap(latestkiller[id],30)
           new victimname[33]
           get_user_name(id,victimname,32)
           client_print(latestkiller[id],  print_chat, "Slapped by %s for
   TKing.  You  now  have  %i/%i  tk  credits  against  you", victimname,
   tkcount[latestkiller[id]], maxtkcreds)
           new killername[33]
           get_user_name(latestkiller[id],killername,32)
           client_print(0,   print_chat,  "%s  slapped  %s  for  TKing.",
   victimname, killername)
           return PLUGIN_HANDLED
           }
       return PLUGIN_CONTINUE
       }
   //3. Major slap (15)
   public menu_option3(id,key)
   {
       if (choosing[id] == 1)
       {
           choosing[id] = 0
           tkcount[latestkiller[id]] -= 15
           user_slap(latestkiller[id], 65)
           new victimname[33]
           get_user_name(id,victimname,32)
           client_print(latestkiller[id],  print_chat,  "Major slapped by
   %s  for TKing. You now have %i/%i tk credits against you", victimname,
   tkcount[latestkiller[id]], maxtkcreds)
           new killername[33]
           get_user_name(latestkiller[id],killername,32)
           client_print(0,  print_chat, "%s major slapped %s for TKing.",
   victimname, killername)
           return PLUGIN_HANDLED
           }
       return PLUGIN_CONTINUE
       }
   //4. slow (20)
   /*
   public menu_option4(id,key)
   {
       if (choosing[id] == 1)
       {
           choosing[id] = 0
           new victimname[33]
           get_user_name(id,victimname,32)
           set_user_maxspeed(latestkiller[id],20 * 3.0)
           client_print(latestkiller[id],  print_chat,  "Slowed by %s for
   TKing.   You   now  have  %i  tk  credits  against  you",  victimname,
   tkcount[latestkiller[id]])
           new killername[33]
           get_user_name(latestkiller[id],killername,32)
           client_print(0,   print_chat,   "%s  slowed  %s  for  TKing.",
   victimname, killername)
           return PLUGIN_HANDLED
           }
       return PLUGIN_CONTINUE
       }
   */
   //5. Save revengecredits for later
   public menu_option5(id,key)
   {
       if (choosing[id] == 1)
       {
           choosing[id] = 0
           new killername[33]
           get_user_name(latestkiller[id],killername,32)
           new victimname[33]
           get_user_name(id,victimname,32)
           client_print(latestkiller[id],  print_chat,  "%s saved his/her
   revenge  on  you.  You  now  have  %i/%i  tk  credits  against  you.",
   victimname, tkcount[latestkiller[id]], maxtkcreds)
           client_print(0,  print_chat,  "%s  saved  his revenge on %s.",
   victimname, killername)
           return PLUGIN_HANDLED
           }
       return PLUGIN_CONTINUE
       }
   public logd_kill(id1,id2,weapon[]) {
       new team1[15]
       new team2[15]
       get_user_info(id1,"team",team1,14)
       get_user_info(id2,"team",team2,14)
       if(equal(team1,team2)  && (id1 != id2) && get_cvar_num("tkpunish")
   == 1)
           {
           latestkiller[id2] = id1
           new victimname[33]
           get_user_name(id2,victimname,32)
           new killername[33]
           get_user_name(latestkiller[id2],killername,32)
           client_print(0,print_chat,"%s killed teammate %s", killername,
   victimname)
           //client_print(0,      print_chat,      "%s      killed      a
   teammate",killername)
               //latestkiller[id2] = id1 //id1 killed id2
                       choosing[id2]  =  1  //something  to  do  with the
   menus
                       // Day of Defeat Support

                       //compare  if  it's  a  weapon  that does not have
   default

                       //Hand-to-Hand 20 points
                              if(equal(weapon,"amerknife")){
                           tkcount[id1] += 20
                                 lastcredit[id1] = 20
                           }
                       else if(equal(weapon,"bayonet")){
                           tkcount[id1] += 20
                           lastcredit[id1] = 20
                           }
                       else if(equal(weapon,"enf_bayonet")){
                           tkcount[id1] += 20
                           lastcredit[id1] = 20
                           }
                       else if(equal(weapon,"garandbutt")){
                           tkcount[id1] += 20
                           lastcredit[id1] = 20
                           }
                       else if(equal(weapon,"gerknife")){
                           tkcount[id1] += 20
                           lastcredit[id1] = 20
                           }
                       else if(equal(weapon,"spade")){
                           tkcount[id1] += 20
                           lastcredit[id1] = 20
                           }

                       //pistols 15 points
                       else if(equal(weapon,"colt")){
                           tkcount[id1] += 15
                           lastcredit[id1] = 15
                           }
                       else if(equal(weapon,"luger")){
                           tkcount[id1] += 15
                           lastcredit[id1] = 15
                           }
                       else if(equal(weapon,"webley")){
                           tkcount[id1] += 15
                           lastcredit[id1] = 15
                           }

                       //Sniper guns 13 points
                       else if(equal(weapon,"scopedkar")){
                           tkcount[id1] += 13
                           lastcredit[id1] = 13
                           }
                       else if(equal(weapon,"scoped_enfield")){
                           tkcount[id1] += 13
                           lastcredit[id1] = 13
                           }
                       else if(equal(weapon,"spring")){
                           tkcount[id1] += 13
                           lastcredit[id1] = 13
                           }

                       //SMGs 12 points
                       else if(equal(weapon,"fcarbine")){
                           tkcount[id1] += 12
                           lastcredit[id1] = 12
                           }
                       if(equal(weapon,"greasegun")){
                           tkcount[id1] += 12
                           lastcredit[id1] = 12
                           }
                       else if(equal(weapon,"m1carbine")){
                           tkcount[id1] += 12
                           lastcredit[id1] = 12
                           }
                       else if(equal(weapon,"mp40")){
                           tkcount[id1] += 12
                           lastcredit[id1] = 12
                           }
                       else if(equal(weapon,"sten")){
                           tkcount[id1] += 12
                           lastcredit[id1] = 12
                           }

                       //grenades 5 points
                       else if(equal(weapon,"grenade")){
                           tkcount[id1] += 5
                           lastcredit[id1] = 5
                           }
                       else if(equal(weapon,"grenade2")){
                           tkcount[id1] += 5
                           lastcredit[id1] = 5
                           }
                       else
                       {
                       //set the tkcount to default 10
                             tkcount[id1] += 10
                             lastcredit[id1] = 10
                       }
                       menushow(id2,id1)   //show   the   menu   for  the
   teamkilled
           }
       if(!equal(team1,team2)      &&      (id1      !=      id2)      &&
   get_cvar_num("cc_announce") == 1)
          {
          new victimname[33]
          get_user_name(id2,victimname,32)
          new killername[33]
          get_user_name(id1,killername,32)

          if(equal(weapon,"amerknife")   ||  equal(weapon,"gerknife")  ||
   equal(weapon,"brit_knife"))
              {
           //id1 dödar id2
           client_print(0,print_chat,"%s   planted  a  blade  in  %s.  ",
   killername, victimname)
           }
          else if(equal(weapon,"spade"))
              {
           client_print(0,print_chat,"%s  dug  a hole through %s with his
   spade!", killername, victimname)
           }
          else if(equal(weapon,"bayonet") || equal(weapon,"enf_bayonet"))
              {
               client_print(0,print_chat,"%s  probably  wonders  why %s's
   bayonet is in his body", victimname, killername)
           }
          else if (equal(weapon,"garand_butt"))
              {
              client_print(0,print_chat,"%s  garand butt ended up in %s's
   face",killername, victimname)
              }
          else
               {
           client_print(id2,   print_chat,"%s   killed   you   with  %s",
   killername, weapon)
           }


          }



       return PLUGIN_CONTINUE
       }
   public menushow(id,idkiller){
       new menutext[256]
           new killername[33]
           get_user_name(latestkiller[id],killername,32)

           if(tkcount[latestkiller[id]] < maxtkcreds)
           {
               new a[33]
                   format(a,32,"%s has %i TK
   credits^n",killername,tkcount[latestkiller[id]])
                   add(menutext,255,a)
                   add(menutext,255,"Choose punishment:^n^n")
                   add(menutext,255,"1. Forgive TK^n")
                   if(tkcount[latestkiller[id]] >= 5){
                       add(menutext,255,"2. Slap       (5)^n")
                       }
                   if(tkcount[latestkiller[id]] >= 15){
                       add(menutext,255,"3. Major Slap (15)^n")
                       }
                   /*
                   if(tkcount[latestkiller[id]] >= 20){
                       add(menutext,255,"4. Slow       (20)^n")
                       }
                   */
                   format(a,32,"4.    save    TK    credits    (ban    at
   %i)",maxtkcreds)
                   add(menutext,255,a)
                   show_menu(id,((1<<0)|(1<<1)|(1<<2)|(1<<3)),menutext)
   //show the menu
               }
           else //if TK credits are 50 or more, ban for a week
           {
               new bannr[32]
               get_user_authid(idkiller,bannr,31)
               client_print(0,  print_chat,  "%s is banned for a week for
   repeated TKing.",killername)
               server_cmd("banid 10080 %s kick; writeid", bannr)
               return PLUGIN_HANDLED
               }
           return PLUGIN_CONTINUE
       }
   public client_connect(id){
       tkcount[id] = 0
       choosing[id] = 0
       return PLUGIN_CONTINUE

       }
   public client_disconnect(id){
       tkcount[id] = 0
       choosing[id] = 0
           return PLUGIN_CONTINUE
       }
   public plugin_init(){
       register_plugin("TK punish","1.03","Arete")
       register_menucmd(gMenu,(1<<0),"menu_option1")
       register_menucmd(gMenu,(1<<1),"menu_option2")
       register_menucmd(gMenu,(1<<2),"menu_option3")
       //register_menucmd(gMenu,(1<<3),"menu_option4")
       register_menucmd(gMenu,(1<<3),"menu_option5")
       register_cvar("tkpunish","1")
       register_cvar("funkar","0")
       register_cvar("cc_announce","1")
       logd_init()
       maxtkcreds = 50
       return PLUGIN_CONTINUE
       }
