
   /* AMX Mod script.
   *
   * Autocam by Bolche
   * This file is provided as is (no warranties).
   *
   *  This plugin set the mp_forcechasecam to "2" if
   *  there players on-lan (same ip)
   *  amx_lan displays who is on lan
   *  thx to Rav, PsychoGuard and karma_k
   */
   #include <amxmod>
   public auto_cam(){
       new players[32], pnum
       new i, j, lan
       new ips[32][16]
       get_players(players, pnum,"c");
       //array of ips
       for(i = 0; i < pnum; ++i){
           get_user_ip(players[i],ips[i],16,1);
       }
       for(i = 0; i < pnum;i++){
           for(j=i+1;j<=pnum;j++){
               if (equal(ips[i],ips[j])){
                   lan = 1;
                   break;break
               }
           }
       }
       //set the mp_forcechasecam to 0 or 2
       if (lan == 0)
       set_cvar_num("mp_forcechasecam",0)
       else
       set_cvar_num("mp_forcechasecam",2)
       return PLUGIN_CONTINUE
   }
   public admin_lan(id,level,cid){
       new players[32], pnum, name1[32],name2[32]
       new i, j, lan
       new ips[32][16]
       get_players(players, pnum,"c");
       //array of ips
       for(i = 0; i < pnum; ++i){
           get_user_ip(players[i],ips[i],16,1);
       }
       for(i = 0; i < pnum;i++){
           for(j=i+1;j<=pnum;j++){
               if (equal(ips[i],ips[j])){
                   lan = 1;
                   get_user_name(players[i],name1,31)
                   get_user_name(players[j],name2,31)
                   console_print(id,"%s on lan with %s",name1,name2)
               }
           }
       }
       if (lan == 0)
           console_print(id,"no lan")
       return PLUGIN_HANDLED_MAIN
   }
   public client_putinserver(id){
       auto_cam()
   }
   public client_disconnect(id){
       auto_cam()
   }
   public plugin_init() {
       register_concmd("amx_lan","admin_lan",ADMIN_KICK,"display  who  is
   on lan")
       register_plugin("Auto forcechasecam","0.7","Bolche")
       return PLUGIN_CONTINUE
   }
