View Single Post
Hinchy
New Member
Join Date: Dec 2011
Old 01-27-2013 , 18:17   Re: TF2: Roll the Dice RTD - v0.4 - NEW!
Reply With Quote #1006

My server plays with RTD on very infrequently, and we have a SourceMod admin menu toggle to turn it on and off as such. However, when it's off, the plugin still misleadingly posts the RTD advert. The fix is a very small code change though, so if the plugin author wants to add it - and boy would I appreciate it - here's the code I changed:

OLD:
Code:
public Event_RoundActive(Handle:hEvent, const String:strEventName[], bool:bDontBroadcast)
{
	if(GameRules_GetRoundState() == RoundState_RoundRunning)
	{
		switch(GetRandomIntBetween(1, 2))
		{
			case 1: PrintToChatAll("%s %T", PLUGIN_PREFIX, "RTD_Advert1", LANG_SERVER, COLOR_PERK_ORANGE, 0x01);
			case 2: PrintToChatAll("%s %T", PLUGIN_PREFIX, "RTD_Advert1", LANG_SERVER, COLOR_PERK_ORANGE, 0x01);
		}
	}
}
NEW:
Code:
public Event_RoundActive(Handle:hEvent, const String:strEventName[], bool:bDontBroadcast)
{
	if(GameRules_GetRoundState() == RoundState_RoundRunning)
	{
		if(GetConVarInt(g_hCvarEnabled))
		{
			switch(GetRandomIntBetween(1, 2))
			{
				case 1: PrintToChatAll("%s %T", PLUGIN_PREFIX, "RTD_Advert1", LANG_SERVER, COLOR_PERK_ORANGE, 0x01);
				case 2: PrintToChatAll("%s %T", PLUGIN_PREFIX, "RTD_Advert1", LANG_SERVER, COLOR_PERK_ORANGE, 0x01);
			}
		}
	}
}
(I also noticed that that random switch doesn't do anything. Shouldn't case 2 be referring to RTD_Advert2?)
Hinchy is offline