Exemple #1
0
void StrandOfTheAncient::TimeTick()
{
	SetTime(GetRoundTime() - 5,0);
	if(GetRoundTime() == 0)
	{
		sEventMgr.RemoveEvents(this, EVENT_SOTA_TIMER);
	}
};
// sents the round time and state to all clients
void CBaseRoundRules::SendRoundTimeToClients(bool bPaused)
{
	extern int gmsgClockTime;

	MESSAGE_BEGIN(MSG_ALL, gmsgClockTime);
	WRITE_SHORT((int)(GetRoundTime() - gpGlobals->time));
	WRITE_SHORT((bPaused ? CLOCK_PAUSE : CLOCK_ROUND));
	MESSAGE_END();
}
// sets the length of the round
void CBaseRoundRules::SetRoundLength(float flRoundTime, bool bPaused)
{
	// - cap the round length to the round time limit or pause time limit depending on state
	if(!bPaused)
	{
		if(flRoundTime > GetRoundTimeLimit())
			flRoundTime =  GetRoundTimeLimit();
	}
	else
	{
		if(flRoundTime > GetPauseTimeLimit())
			flRoundTime = GetPauseTimeLimit();
	}

	// - check for greater than zero value and set round length if so
	if(flRoundTime > 0.0)
	{
		m_flRoundTime = gpGlobals->time + flRoundTime;
	}
	// - sets to the limit if it is less than zero
	else
	{
		// -- this is wierd so log it
		ALERT(at_console, "Bad Round Length being set - (%1.f)\n", flRoundTime);
		UTIL_LogPrintf(ROUND_LOGGING, "World triggered \"Bad Round Length\" (round_length \"%1.f\") (old_round_length \"1.f\") (respawn_style \"%i\") (round_state \"%i\")\n", flRoundTime, GetRoundTime(), (int)m_iRespawnStyle, (int)m_iRoundState);

		if(!bPaused)
			m_flRoundTime = gpGlobals->time + GetRoundTimeLimit();
		else
			m_flRoundTime = gpGlobals->time + GetPauseTimeLimit();
	}

	// - send client the round time
	SendRoundTimeToClients(bPaused);
}