/* This plugin was made by: Sharpsniper it is a revision of Fah-Q[Dio]' plugin but this  * pluin announces every person that connects to your server in a typesay form and  * greets them.
 * Plugin Created: October 13, 2001, 12:48 AM 
 * Sharpsniper: $harp$sniper Enjoy!
 * Changes Made: Announce Delay is now 30 seconds, Everyone gets announced
*/
 
#include <core>
#include <string>
#include <admin>
#include <adminlib>
 
#define ACCESS_ALL 0
#define ANNOUNCE_DELAY 30
 
new STRING_VERSION[MAX_DATA_LENGTH] = "2.50.07";
 
plr_announce(strName[], lConnect=0) {
 
  new Text[MAX_TEXT_LENGTH] = "";
 
  if (lConnect == 1) {
    strcat(Text,"Welcome ^n ",MAX_DATA_LENGTH);
    strcat(Text, strName,MAX_DATA_LENGTH);
    strcat(Text, " Enjoy playing here!!",MAX_DATA_LENGTH);
  } else {
    strcat(Text, strName,MAX_DATA_LENGTH);
    strcat(Text, "^n has left but will return again!",MAX_DATA_LENGTH);
  }
  typesay(Text, 7, 12, 125, 12);
}
 
public plugin_connect(HLUserName,HLIP,UserIndex) {
 
	new strName[MAX_NAME_LENGTH];
	convert_string(HLUserName, strName, MAX_NAME_LENGTH);
 
	set_timer("ann_timer",ANNOUNCE_DELAY, 1, strName);
 
	return PLUGIN_CONTINUE;
}
 
public plugin_disconnect(HLUserName, UserIndex) {
 
  new strName[MAX_NAME_LENGTH];
  convert_string(HLUserName, strName, MAX_NAME_LENGTH);
 
  if (access(ACCESS_ALL, strName)!=0)
    plr_announce(strName, 0);
 
  return PLUGIN_CONTINUE;
}
 
public ann_timer(Timer,Repeat,HLName,HLParam) {
  new strName[MAX_NAME_LENGTH];
 
  convert_string(HLParam,strName,MAX_NAME_LENGTH);
 
  if (access(ACCESS_ALL, strName)!=0)
		plr_announce(strName, 1);
 
}
 
public plugin_init() {
  plugin_registerinfo("Client Connect Greeting!","Announces and Greets Every Player That Connects!",STRING_VERSION);  
 
  return PLUGIN_CONTINUE;
}