/* This is an updated plugin that doesnt show the motd, encase your using past tense or want to show something else. */
 
/* by Dale*/
 
#include <core>
#include <console>
#include <string>
#include <admin>
#include <adminlib>
 
new STRING_VERSION[MAX_DATA_LENGTH] = "1.0.1.0";
 
/* from the old adminmod */
addstr(strBegin[],strEnd[]) {
	new i=0;
	new Length = strlen(strEnd);
	new j;
	while(strBegin[i]!=0) i++;
	for(j=0;j<Length;j++)
		strBegin[i+j]=strEnd[j];
	/* Null-terminate the string. */
	strBegin[i+j] = NULL_CHAR;
}
 
public NumToStr(num,str[])
{
	new Base = 1;
	new Digits = 1;
	new i = 0;
 
	/* Special case: 0 */
	if (num == 0) {
		str[i++] = '0';
		str[i++] = NULL_CHAR;
	} else {
 
		if (num < 0) {
			str[i++] = '-';	
			num *= -1;
		}
 
 
		while (Base <= num) {
			Base *= 10;
			Digits++;
		}
 
		while (--Digits > 0) {
			Base /= 10;
			str[i++] = '0' + (num - (num % Base)) / Base;
			num = num % Base;
		}
		str[i++] = NULL_CHAR;
	}
}
 
public GetTeamCount(iTeam) {
	new i;
	new maxplayers = maxplayercount();
	new SessionID;
	new Team;
	new TeamCount = 0;
	new WONID;
	new Name[MAX_NAME_LENGTH];
 
	for(i = 1; i <=	maxplayers; i++) {
		if(playerinfo(i,Name,MAX_NAME_LENGTH,SessionID,WONID,Team)==1) {
			if(Team==iTeam) {
				TeamCount++;
			}
		}
	}
	return TeamCount;
}
 
public plugin_connect(HLUserName,HLIP,UserIndex) {
	new strName[MAX_NAME_LENGTH],strIP[MAX_DATA_LENGTH];
	new strSeconds[MAX_NUMBER_LENGTH];
	new strNumber[MAX_NUMBER_LENGTH];
	new NextMap[MAX_NAME_LENGTH];
	nextmap(NextMap,MAX_NAME_LENGTH);
	new conmsg[MAX_TEXT_LENGTH];
	new host[MAX_TEXT_LENGTH];
	new CurrentMap[MAX_NAME_LENGTH];
	new varTeamCount;
	new Seconds = timeleft(0);
	new numPlayers = playercount();
	new numMaxPlayers = maxplayercount();
	Seconds /= 60;
	NumToStr(Seconds, strSeconds);
	currentmap(CurrentMap,MAX_NAME_LENGTH);
	getstrvar("hostname",host,MAX_TEXT_LENGTH);
	convert_string(HLUserName, strName,MAX_NAME_LENGTH);
	convert_string(HLIP,strIP,MAX_DATA_LENGTH);
	/* the start of the greeting */
	consgreet("");
	consgreet("");
	consgreet("");
	consgreet("");
	consgreet("");
	consgreet("");
	consgreet("");
	consgreet("");
	consgreet("");
	consgreet("");
	consgreet("");
	consgreet("");
	consgreet("");
	consgreet("");
	consgreet("");
	consgreet("");
	consgreet("-----------------------Something to read for now--------------------------");
	addstr(conmsg,"This server is Using Dales consgreet which is an updated version of Ascads");
	addstr(conmsg,STRING_VERSION);
	consgreet(conmsg);
	conmsg = "";
	consgreet("to contact me, AIM me(Dale) at Daledude2");
	consgreet("or email me at Dalereinalda@hotmail.com visit To find out more about admin mod go to www.adimnmod.org");
	consgreet("================================================================");
	addstr(conmsg,"Hello, ");
	addstr(conmsg,strName);
	addstr(conmsg,", Welcome to ");
	addstr(conmsg,host);
	consgreet("");
	consgreet(conmsg);
	conmsg = "";
	addstr(conmsg,"Your ip address is: ");
	addstr(conmsg,strIP);
	consgreet(conmsg);
	conmsg = "";
	consgreet("================================================================");
	consgreet("-------------------------------Current info-------------------------------");
	conmsg = "";
	addstr(conmsg,"The current map is: ");
	addstr(conmsg,CurrentMap);
	consgreet(conmsg);
	conmsg = "";
	addstr(conmsg,"The next map in the mapcycle is: ");
	addstr(conmsg,NextMap);
	consgreet(conmsg);
	conmsg = "";
	addstr(conmsg,"Time remaining on map is: ");
	addstr(conmsg,strSeconds);
	addstr(conmsg," Minutes");
	consgreet(conmsg);
	conmsg = "";
	addstr(conmsg, "The current playercount is: ");
	NumToStr(numPlayers, strNumber);
	addstr(conmsg, strNumber);
	addstr(conmsg, " / ");
	NumToStr(numMaxPlayers, strNumber);
	addstr(conmsg, strNumber);
	consgreet(conmsg);
	conmsg = "";
	conmsg = "Team #1 currently has: ";
	varTeamCount = GetTeamCount(1);
	NumToStr(varTeamCount, strNumber);
	addstr(conmsg, strNumber);
	addstr(conmsg, " players!");
	consgreet(conmsg);
	conmsg = "";
	conmsg = "Team #2 currently has: ";
	varTeamCount = GetTeamCount(2);
	NumToStr(varTeamCount, strNumber);
	addstr(conmsg, strNumber);
	addstr(conmsg, " players!");
	consgreet(conmsg);
	conmsg = "";
	conmsg = "Team #3 currently has: ";
	varTeamCount = GetTeamCount(3);
	NumToStr(varTeamCount, strNumber);
	addstr(conmsg, strNumber);
	addstr(conmsg, " players!");
	consgreet(conmsg);
	conmsg = "";
	conmsg = "Team #4 currently has: ";
	varTeamCount = GetTeamCount(4);
	NumToStr(varTeamCount, strNumber);
	addstr(conmsg, strNumber);
	addstr(conmsg, " players!");
	consgreet(conmsg);
	conmsg = "";
	consgreet("");
	conmsg = "";
 
	if(fileexists("consgreet.txt")==1) {
	consgreet("================================================================");
	consgreet("------------------------------Server Stuff--------------------------------");
	consgreet("consgreet.txt");
	consgreet("");
	}
	consgreet("================================================================");
	consgreet("----------------------------------MO Server Stuff------------------------------------");
	consgreet("Moserverstuff.txt");
	consgreet("");
	consgreet("================================================================");
	consgreet("");
	consgreet("");
	consgreet("--------------------Now just wait to get connected--------------------");
	consgreet("");
	consgreet("");
	return PLUGIN_CONTINUE;
}
 
public plugin_init() {
	plugin_registerinfo("Dales consgreet /updated from Ascads/","Shows message on connect.",STRING_VERSION);
 
	return PLUGIN_CONTINUE;
}