
   /* AMX Mod script.
   *
   * Private Chat
   *
   * (c) Copyright 2002, Phreak <phreak@gerald-online.de>
   * This file is provided as is (no warranties).
   *
   * This Plugin lets Admins open a private chat to other players.
   * Once a chat is open, you can use normal say to talk in private.
   * teamsay is not changed, so you can still can talk to your
   * team members.
   * The chat can be closed by the admin.
   *
   * Usage:
   *  amx_pchat <authid, nick or #userid>
   *  amx_closechat
   *
   */
   #include <amxmod>
   #include <amxmisc>
   new talking[32]
   public set_chat(id) {
       new text[32],name[32]
       read_args(text,31)
       parse(text,name,31)
       new priv = cmd_target(id,name,0)
       if (!priv) return PLUGIN_HANDLED
       new name2[32]
       get_user_name(priv,name2,31)
       get_user_name(id,name,31)
       talking[id] = priv
       talking[priv] = id
       client_print(priv,  print_chat, "[AMX] %s has opend a private chat
   to you.",name)
       client_print(priv,  print_chat,  "[AMX]  Only  %s can see what you
   say. You can still use team_say to communicate with your team.",name)
       client_print(id,   print_chat,   "[AMX]   Private   chat  with  %s
   opened.",name2)
       return PLUGIN_HANDLED
   }
   public stop_chat(id) {
       if (talking[id] == -1)
           return PLUGIN_HANDLED
       new name[32],name2[32]
       get_user_name(talking[id],name2,31)
       get_user_name(id,name,31)
       client_print(id, print_chat, "[AMX] Chat with %s closed",name2)
       client_print(talking[id],  print_chat,  "[AMX]  %s closed the chat
   with you",name)
       talking[talking[id]] = -1
       talking[id] = -1
       return PLUGIN_HANDLED
   }
   public catch_say(id) {
       if (talking[id] == -1)
           return PLUGIN_CONTINUE
       new name2[32],name[32],message[192]
       get_user_name(talking[id],name2,31)
       get_user_name(id,name,31)
       read_args(message,191)
       remove_quotes(message)
       client_print(talking[id],        print_chat,       "(%s)       %s:
   %s",name,name2,message)
       client_print(id, print_chat, "(%s) %s: %s",name2,name,message)
       return PLUGIN_HANDLED
   }
   public plugin_init(){
       new i
       register_plugin("Private Chat","0.1","Phreak")
       register_clcmd("say","catch_say")
       register_concmd("amx_pchat","set_chat",ADMIN_CHAT,"<authid,   nick
   or #userid>")
       register_concmd("amx_stopchat","stop_chat",ADMIN_CHAT,"  -  Closes
   private Chat")
       // initialize talking array
       for (i=0;i<32;i++)
           talking[i] = -1
       return PLUGIN_CONTINUE
   }
