
   /*
   * Enter and Leave Message
   *  v 0.1
   *
   *  by [MUPPETS] Gonzo
   *   amx@deswahnsinns.de
   *
   * some code was taken from
   * welcome_hudmsg by JustinHoMi
   *
   */
   /*
   * Cvars:
   * amx_enter_message "%name% just entered %hostname%."
   * amx_leave_message "%name% just left %hostname%."
   *
   * If you are using csstats module then you may use
   * %rankpos% expression in amx_enter_message cvar.
   *
   */
   #include <amxmod>
   #include <csstats>
   public client_putinserver(id){
       new param[34], len
       param[0] = id
       len = get_user_name(id,param[1],31)
       set_task(2.0, "enter_msg", 0, param,len + 2)
       return PLUGIN_CONTINUE
   }
   public client_disconnect(id){
       new param[34], len
       param[0] = id
       len = get_user_name(id, param[1], 31)
       set_task(2.0, "leave_msg", 0, param, len + 2)
       return PLUGIN_CONTINUE
   }
   public enter_msg(param[]) {
       new message[192],hostname[64]
       get_cvar_string("amx_enter_message", message, 191)
       get_cvar_string("hostname", hostname, 63)
       replace(message,191, "%hostname%", hostname)
       if (cvar_exists("csstats_reset")){
           new data[8], rankpos[8], pos
           pos = get_user_stats(param[0],data,data)
           numtostr(pos,rankpos,7)
           replace(message, 191, "%rankpos%", rankpos)
       }
       replace(message, 191, "%name%", param[1])
       while(replace(message, 191, "\n", "^n")){}
       set_hudmessage(0, 225, 0, 0.05, 0.55, 0, 6.0, 6.0, 0.5, 0.15, 3)
       show_hudmessage(0, message)
       return PLUGIN_CONTINUE
   }
   public leave_msg(param[]) {
       new message[192],hostname[64]
       get_cvar_string("amx_leave_message", message, 191)
       get_cvar_string("hostname", hostname, 63)
       replace(message, 191, "%hostname%", hostname)
       replace(message, 191, "%name%", param[1])
       while(replace(message, 191, "\n", "^n")){}
       set_hudmessage(0, 225, 0, 0.05, 0.55, 0, 6.0, 6.0, 0.5, 0.15, 3)
       show_hudmessage(0, message)
       return PLUGIN_CONTINUE
   }
   public plugin_init() {
     register_plugin("Enter-Leave Message","0.2","[MUPPETS] Gonzo")
     register_cvar("amx_enter_message",      "%name%     just     entered
   %hostname%.")
     register_cvar("amx_leave_message", "%name% just left %hostname%.")
     return PLUGIN_CONTINUE
   }
