added sv_events

This commit is contained in:
eeeee 2012-12-23 20:36:13 +03:00 committed by Learath2
parent 02036bc876
commit 1c8c20c93e
3 changed files with 35 additions and 25 deletions

View file

@ -215,4 +215,6 @@ MACRO_CONFIG_INT(SvSpamMuteDuration, sv_spam_mute_duration, 60, 0, 3600 , CFGFLA
// banmaster
MACRO_CONFIG_INT(SvGlobalBantime, sv_global_ban_time, 60, 0, 1440, CFGFLAG_SERVER, "The time a client gets banned if the ban server reports it. 0 to disable")
MACRO_CONFIG_INT(SvEvents, sv_events, 1, 0, 1, CFGFLAG_SERVER, "Enable triggering of server events, like the happy eyeemotes on some holidays.")
#endif

View file

@ -676,31 +676,35 @@ void CGameContext::OnClientEnter(int ClientID)
Console()->Print(IConsole::OUTPUT_LEVEL_DEBUG, "game", aBuf);
time_t rawtime;
struct tm* timeinfo;
char d[16], m [16], y[16];
int dd, mm, yy;
time ( &rawtime );
timeinfo = localtime ( &rawtime );
strftime (d,sizeof(y),"%d",timeinfo);
strftime (m,sizeof(m),"%m",timeinfo);
strftime (y,sizeof(y),"%Y",timeinfo);
dd = atoi(d);
mm = atoi(m);
yy = atoi(y);
if((mm == 12 && dd >= 20))
if (g_Config.m_SvEvents)
{
char aBuf[128];
str_format(aBuf, sizeof(aBuf), "Happy %d from GreYFoX", yy+1);
SendBroadcast(aBuf, ClientID);
}
else if(mm == 1 && dd <= 20)
{
char aBuf[128];
str_format(aBuf, sizeof(aBuf), "Happy %d from GreYFoX", yy);
SendBroadcast(aBuf, ClientID);
time_t rawtime;
struct tm* timeinfo;
char d[16], m [16], y[16];
int dd, mm, yy;
time ( &rawtime );
timeinfo = localtime ( &rawtime );
strftime (d,sizeof(y),"%d",timeinfo);
strftime (m,sizeof(m),"%m",timeinfo);
strftime (y,sizeof(y),"%Y",timeinfo);
dd = atoi(d);
mm = atoi(m);
yy = atoi(y);
if((mm == 12 && dd >= 20))
{
char aBuf[128];
str_format(aBuf, sizeof(aBuf), "Happy %d from GreYFoX", yy+1);
SendBroadcast(aBuf, ClientID);
}
else if(mm == 1 && dd <= 20)
{
char aBuf[128];
str_format(aBuf, sizeof(aBuf), "Happy %d from GreYFoX", yy);
SendBroadcast(aBuf, ClientID);
}
}
}
m_VoteUpdate = true;

View file

@ -55,7 +55,11 @@ CPlayer::CPlayer(CGameContext *pGameServer, int ClientID, int Team)
mm = atoi(m);
yy = atoi(y);
m_DefEmote = ((mm == 12 && dd >= 20) || (mm == 1 && dd <= 20)) ? EMOTE_HAPPY : EMOTE_NORMAL;
m_DefEmote = EMOTE_NORMAL;
if (g_Config.m_SvEvents)
{
m_DefEmote = ((mm == 12 && dd >= 20) || (mm == 1 && dd <= 20)) ? EMOTE_HAPPY : EMOTE_NORMAL;
}
m_DefEmoteReset = -1;
GameServer()->Score()->PlayerData(ClientID)->Reset();