Fortress Forever

Go Back   Fortress Forever > Help & Technical > Server Administration

Reply
 
Thread Tools Display Modes
Old 04-29-2008, 02:37 PM   #1
KubeDawg
Nade Whore
Server Owner
Beta Tester
 
KubeDawg's Avatar
 
Join Date: Sep 2007
Location: Oklahoma
Class/Position: Scout/Soldier
Gametype: CTF/TDM
Affiliations: blunt. Moto
Posts Rated Helpful 128 Times
Server plugins?

Well, I've got Sourcemod currently, but it's meh, so is there a better addon for FF besides it? Either way, I'm in the process of adding some useful plugins to my server, but also removing some of the ability for them to work during things like matches and pickups. Any ideas for plugin web sites aside from the main sourcemod site that are already configered for FF?
__________________
Moto's Funhouse | Dallas, TX - 74.91.114.247:27015

ff_plunder - Complete
KubeDawg is offline   Reply With Quote


Old 04-29-2008, 03:19 PM   #2
[AE] 82694
Retired FF Staff
 
[AE] 82694's Avatar
 
Join Date: Mar 2007
Posts Rated Helpful 0 Times
You basically only have a couple choices I know of. Mani Admin Mod, Source Mod, And there is one called Bat or Bap I forget which.

But source mod has "WarMode" wich disables all unnecessary plugins any way.
What are you trying to do?
__________________
I Love GenghisTron . I miss you sooooo Much. LOL.
[AE] 82694 is offline   Reply With Quote


Old 04-29-2008, 04:01 PM   #3
KubeDawg
Nade Whore
Server Owner
Beta Tester
 
KubeDawg's Avatar
 
Join Date: Sep 2007
Location: Oklahoma
Class/Position: Scout/Soldier
Gametype: CTF/TDM
Affiliations: blunt. Moto
Posts Rated Helpful 128 Times
Add things like Rockthevote, and just random plugins I feel would keep people coming to my server.
__________________
Moto's Funhouse | Dallas, TX - 74.91.114.247:27015

ff_plunder - Complete
KubeDawg is offline   Reply With Quote


Old 04-29-2008, 04:13 PM   #4
Dr.Satan
Wiki Team
Fortress Forever Staff
 
Dr.Satan's Avatar
 
Join Date: Sep 2007
Location: Greeley, CO
Class/Position: Med / Solly
Gametype: PAYLOAD
Affiliations: DET-
Posts Rated Helpful 19 Times
Quote:
Originally Posted by KubeDawg
Add things like Rockthevote, and just random plugins I feel would keep people coming to my server.
You can do that with SM...
__________________
(Released) conc_school | hellion_classic | ksour_PAYLOAD | mulch_faf
(Beta) alchimy_b1
(Lua) base_payload_2015
(Models) props_trainyard
Support FF:
Dr.Satan is offline   Reply With Quote


Old 04-29-2008, 04:30 PM   #5
KubeDawg
Nade Whore
Server Owner
Beta Tester
 
KubeDawg's Avatar
 
Join Date: Sep 2007
Location: Oklahoma
Class/Position: Scout/Soldier
Gametype: CTF/TDM
Affiliations: blunt. Moto
Posts Rated Helpful 128 Times
Well SM as it is I've been having a few issues with such as prematch, changing cfg's and things like that. Is there anything more stable or better than SM? I've never used manimod before.
__________________
Moto's Funhouse | Dallas, TX - 74.91.114.247:27015

ff_plunder - Complete
KubeDawg is offline   Reply With Quote


Old 04-29-2008, 04:30 PM   #6
[AE] 82694
Retired FF Staff
 
[AE] 82694's Avatar
 
Join Date: Mar 2007
Posts Rated Helpful 0 Times
Ya Kube the first thing I would do is check out the plugins section on alliedmodders forums. http://www.sourcemod.net/ then just hit forims button and go to approved plugins.

also metamod has a new release 1.4.3 out and sourcemod has released their first stable build 1.0.
__________________
I Love GenghisTron . I miss you sooooo Much. LOL.
[AE] 82694 is offline   Reply With Quote


Old 04-29-2008, 04:55 PM   #7
Dr.Satan
Wiki Team
Fortress Forever Staff
 
Dr.Satan's Avatar
 
Join Date: Sep 2007
Location: Greeley, CO
Class/Position: Med / Solly
Gametype: PAYLOAD
Affiliations: DET-
Posts Rated Helpful 19 Times
Quote:
Originally Posted by KubeDawg
Well SM as it is I've been having a few issues with such as prematch, changing cfg's and things like that. Is there anything more stable or better than SM? I've never used manimod before.
Can you elaborate? I never have had an issue on any of the servers I have rcon / admin on with SM...
__________________
(Released) conc_school | hellion_classic | ksour_PAYLOAD | mulch_faf
(Beta) alchimy_b1
(Lua) base_payload_2015
(Models) props_trainyard
Support FF:
Dr.Satan is offline   Reply With Quote


Old 04-29-2008, 05:11 PM   #8
KubeDawg
Nade Whore
Server Owner
Beta Tester
 
KubeDawg's Avatar
 
Join Date: Sep 2007
Location: Oklahoma
Class/Position: Scout/Soldier
Gametype: CTF/TDM
Affiliations: blunt. Moto
Posts Rated Helpful 128 Times
For instance, and I'm not sure if it's my fault or SM fault, but when I change a cfg, change the map, it goes back to the CFG we were just using. I noticed 3 locations where all my cfgs are stored, the main FF directory, FF/cfgs directory, and FF/cfgs/sourcemod directory. Don't know why there are 3 folders for all the server cfgs and I'm probably thinking we only need 1 or 2, but I'm not 100% which ones to delete.

Anywho, can I dl the update to SM w/o having to do a fresh install of it and same for metamod?
__________________
Moto's Funhouse | Dallas, TX - 74.91.114.247:27015

ff_plunder - Complete
KubeDawg is offline   Reply With Quote


Old 04-29-2008, 05:30 PM   #9
[AE] 82694
Retired FF Staff
 
[AE] 82694's Avatar
 
Join Date: Mar 2007
Posts Rated Helpful 0 Times
You need to make some back up copies of certain files that you may not want over written. Like your admin.cfg or admin group depending on which one you use. your adminmenue_maplist.ini file shit like that. But yes you can update with out deleting anything they give specific directions for it.

Also on meta mod the main improvement is it will now function off of metamod.vdf instead of the gameinfo.txt so when you update the Game you don't have to redo the gameinfo.txt file.

edit: this should fix your cfg problem.Add this line to your server.cfg

servercfgfile "server.cfg"

Then if you want to run a say UGC.cfg for a match

servercfgfile "UGC.cfg"

in the UGC.cfg

or a practice.cfg

servercfgfile "practice.cfg" in the practice.cfg

you get the picture.
__________________
I Love GenghisTron . I miss you sooooo Much. LOL.

Last edited by [AE] 82694; 04-29-2008 at 05:36 PM.
[AE] 82694 is offline   Reply With Quote


Old 04-29-2008, 06:48 PM   #10
Scuzzy
D&A Member
Retired FF Staff
 
Scuzzy's Avatar
 
Join Date: Mar 2007
Location: Server: 206.217.134.170:27016
Posts Rated Helpful 2 Times
Quote:
Originally Posted by KubeDawg
Add things like Rockthevote, and just random plugins I feel would keep people coming to my server.
RocktheVote comes with SourceMod, but I believe you have to move the plugin into the directory... I don't think it's a default loaded plugin. We use it (with a few modifications)... like we delay RockTheVote for 5 minutes after a map starts and we broadcast who votes for what map, but those are manual changes to the plugin I've made. (I can send you that if you'd like)

What other plugins would you like, 82 and I can probably help you find them.

Scuzzy
__________________
"Player Quality, not Quantity, is what we strive for." - The LLama Wrangler
"A clan is defined by the nature of it's enemies. - The Llama Wrangler
Scuzzy is offline   Reply With Quote


Old 04-29-2008, 07:06 PM   #11
Dr.Satan
Wiki Team
Fortress Forever Staff
 
Dr.Satan's Avatar
 
Join Date: Sep 2007
Location: Greeley, CO
Class/Position: Med / Solly
Gametype: PAYLOAD
Affiliations: DET-
Posts Rated Helpful 19 Times
Quote:
Originally Posted by Scuzzy
like we delay RockTheVote for 5 minutes after a map starts and we broadcast who votes for what map, but those are manual changes to the plugin I've made. (I can send you that if you'd like)

Scuzzy
Can you send me how you did that Scuzzy?
__________________
(Released) conc_school | hellion_classic | ksour_PAYLOAD | mulch_faf
(Beta) alchimy_b1
(Lua) base_payload_2015
(Models) props_trainyard
Support FF:
Dr.Satan is offline   Reply With Quote


Old 04-29-2008, 08:36 PM   #12
KubeDawg
Nade Whore
Server Owner
Beta Tester
 
KubeDawg's Avatar
 
Join Date: Sep 2007
Location: Oklahoma
Class/Position: Scout/Soldier
Gametype: CTF/TDM
Affiliations: blunt. Moto
Posts Rated Helpful 128 Times
I don't want to set a time limit to be able to rockthevote. If people want to rock it, and enough do so, then it shall be changed.

Anywho, thanks for the info Scuzzy.
__________________
Moto's Funhouse | Dallas, TX - 74.91.114.247:27015

ff_plunder - Complete
KubeDawg is offline   Reply With Quote


Old 04-29-2008, 09:43 PM   #13
[AE] 82694
Retired FF Staff
 
[AE] 82694's Avatar
 
Join Date: Mar 2007
Posts Rated Helpful 0 Times
If you check your addons/sourcemod/plugins/disabled folder it probably is sitting in there already. Just move it to the plugins folder.

Adjusting when rtv can start and how many %of voters/players for it to work is in your rtv.cfg.

If you are running one of the later versions of SM then it will be located here if you have it enabled.

cfg/sourcemod/rtv.cfg

The only thing I haven't been able to find is how long the vote lasts. Seems like about 30 sec.
__________________
I Love GenghisTron . I miss you sooooo Much. LOL.
[AE] 82694 is offline   Reply With Quote


Old 04-29-2008, 10:04 PM   #14
GeoKill----->
Community Member
Server Owner
Beta Tester
Forum Moderator
 
GeoKill----->'s Avatar
 
Join Date: Mar 2007
Location: Hawthorne, California
Class/Position: Soldier/Spy/Scout
Gametype: AvD
Affiliations: :e0:Eternal Order Leader
Posts Rated Helpful 12 Times
Ya and 30 secs is not long enough, people tend to forget to vote, I know i had when I'm after the flag or trying to kill someone.
__________________

:e0: Will live on Forever
Support FF:
GeoKill-----> is offline   Reply With Quote


Old 04-30-2008, 12:36 AM   #15
KubeDawg
Nade Whore
Server Owner
Beta Tester
 
KubeDawg's Avatar
 
Join Date: Sep 2007
Location: Oklahoma
Class/Position: Scout/Soldier
Gametype: CTF/TDM
Affiliations: blunt. Moto
Posts Rated Helpful 128 Times
Quote:
Originally Posted by [AE] 82694
If you check your addons/sourcemod/plugins/disabled folder it probably is sitting in there already. Just move it to the plugins folder.

Adjusting when rtv can start and how many %of voters/players for it to work is in your rtv.cfg.

If you are running one of the later versions of SM then it will be located here if you have it enabled.

cfg/sourcemod/rtv.cfg

The only thing I haven't been able to find is how long the vote lasts. Seems like about 30 sec.
Ok cool. I know how to do a bit of advanced stuff in plugins, it's just a bit different than CS 1.6.
__________________
Moto's Funhouse | Dallas, TX - 74.91.114.247:27015

ff_plunder - Complete
KubeDawg is offline   Reply With Quote


Old 05-07-2008, 10:20 AM   #16
Scuzzy
D&A Member
Retired FF Staff
 
Scuzzy's Avatar
 
Join Date: Mar 2007
Location: Server: 206.217.134.170:27016
Posts Rated Helpful 2 Times
Sorry so late on this guys, I didn't subscribe to this thread and I completely forgot about it. I tag all my changes in SourceMod plugins so when a new version comes out I can easily port the changes to the new batch of source. I've bolded everything below related to the delay and the time change, the 300 is what makes it 5 minutes instead of 30 seconds... The rest just let's the users know why rockthevote isn't working for them by telling them they can't in the first 5 minutes (otherwise you get a ton of "why isn't rock the vote enabled!?!?") The code below is from a build about a week ago.

Code:
/**
 * vim: set ts=4 :
 * =============================================================================
 * SourceMod Rock The Vote Plugin
 * Creates a map vote when the required number of players have requested one.
 *
 * SourceMod (C)2004-2007 AlliedModders LLC.  All rights reserved.
 * =============================================================================
 *
 * This program is free software; you can redistribute it and/or modify it under
 * the terms of the GNU General Public License, version 3.0, as published by the
 * Free Software Foundation.
 * 
 * This program is distributed in the hope that it will be useful, but WITHOUT
 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
 * FOR A PARTICULAR PURPOSE.  See the GNU General Public License for more
 * details.
 *
 * You should have received a copy of the GNU General Public License along with
 * this program.  If not, see <http://www.gnu.org/licenses/>.
 *
 * As a special exception, AlliedModders LLC gives you permission to link the
 * code of this program (as well as its derivative works) to "Half-Life 2," the
 * "Source Engine," the "SourcePawn JIT," and any Game MODs that run on software
 * by the Valve Corporation.  You must obey the GNU General Public License in
 * all respects for all other code used.  Additionally, AlliedModders LLC grants
 * this exception to all derivative works.  AlliedModders LLC defines further
 * exceptions, found in LICENSE.txt (as of this writing, version JULY-31-2007),
 * or <http://www.sourcemod.net/license.php>.
 *
 * Version: $Id: rockthevote.sp 1895 2008-02-22 21:01:08Z dvander $
 */

#include <sourcemod>

#pragma semicolon 1

public Plugin:myinfo =
{
	name = "Rock The Vote",
	author = "AlliedModders LLC",
	description = "Provides RTV Map Voting",
	version = SOURCEMOD_VERSION,
	url = "http://www.sourcemod.net/"
};

// ScuzTools Start Mod
new bool:g_Startup =true;
// ScuzTools End Mod

new Handle:g_Cvar_Needed = INVALID_HANDLE;
new Handle:g_Cvar_Maps = INVALID_HANDLE;
new Handle:g_Cvar_Nominate = INVALID_HANDLE;
new Handle:g_Cvar_MinPlayers = INVALID_HANDLE;

new Handle:g_MapList = INVALID_HANDLE;
new Handle:g_RTVMapList = INVALID_HANDLE;
new Handle:g_MapMenu = INVALID_HANDLE;
new Handle:g_RetryTimer = INVALID_HANDLE;
new g_mapFileSerial = -1;

new bool:g_CanRTV = false;		// True if RTV loaded maps and is active.
new bool:g_RTVAllowed = false;	// True if RTV is available to players. Used to delay rtv votes.
new bool:g_RTVStarted = false;	// Indicates that the actual map vote has started
new bool:g_RTVEnded = false;	// Indicates that the actual map vote has concluded
new g_Voters = 0;				// Total voters connected. Doesn't include fake clients.
new g_Votes = 0;				// Total number of "say rtv" votes
new g_VotesNeeded = 0;			// Necessary votes before map vote begins. (voters * percent_needed)
new bool:g_Voted[MAXPLAYERS+1] = {false, ...};
new bool:g_Nominated[MAXPLAYERS+1] = {false, ...};

public OnPluginStart()
{
	LoadTranslations("common.phrases");
	LoadTranslations("rockthevote.phrases");
	
	new arraySize = ByteCountToCells(33);	
	g_MapList = CreateArray(arraySize);
	g_RTVMapList = CreateArray(arraySize);
	
	g_Cvar_Needed = CreateConVar("sm_rtv_needed", "0.60", "Percentage of players needed to rockthevote (Def 60%)", 0, true, 0.05, true, 1.0);
	g_Cvar_Maps = CreateConVar("sm_rtv_maps", "4", "Number of maps to be voted on. 2 to 6. (Def 4)", 0, true, 2.0, true, 6.0);
	g_Cvar_Nominate = CreateConVar("sm_rtv_nominate", "1", "Enables nomination system.", 0, true, 0.0, true, 1.0);
	g_Cvar_MinPlayers = CreateConVar("sm_rtv_minplayers", "0", "Number of players required before RTV will be enabled.", 0, true, 0.0, true, float(MAXPLAYERS));
	
	RegConsoleCmd("say", Command_Say);
	RegConsoleCmd("say_team", Command_Say);
	
	RegAdminCmd("sm_rtv_addmap", Command_Addmap, ADMFLAG_CHANGEMAP, "sm_rtv_addmap <mapname> - Forces a map to be on the RTV, and lowers the allowed nominations.");
	
	AutoExecConfig(true, "rtv");
}

public OnMapStart()
{
	g_Voters = 0;
	g_Votes = 0;
	g_VotesNeeded = 0;
	g_RTVStarted = false;
	g_RTVEnded = false;
}

public OnMapEnd()
{
	g_CanRTV = false;	
	g_RTVAllowed = false;
}

public OnConfigsExecuted()
{
	if (g_RTVMapList != INVALID_HANDLE)
	{
		ClearArray(g_RTVMapList);
	}
	
	if (ReadMapList(g_MapList,
					g_mapFileSerial,
					"rockthevote",
					MAPLIST_FLAG_CLEARARRAY|MAPLIST_FLAG_MAPSFOLDER)
		== INVALID_HANDLE)
	{
		if (g_mapFileSerial == -1)
		{
			LogError("Unable to create a valid map list.");
		}
	}
	
	BuildMapMenu();
	// ScuzTools Start Mod
	g_Startup=true;
	// ScuzTools End Mod
	g_CanRTV = true;
	CreateTimer(300.0, Timer_DelayRTV);
}

public bool:OnClientConnect(client, String:rejectmsg[], maxlen)
{
	if(!g_CanRTV || IsFakeClient(client))
		return true;
	
	g_Voted[client] = false;
	g_Nominated[client] = false;

	g_Voters++;
	g_VotesNeeded = RoundToFloor(float(g_Voters) * GetConVarFloat(g_Cvar_Needed));
	
	return true;
}

public OnClientDisconnect(client)
{
	if(!g_CanRTV || IsFakeClient(client))
		return;
	
	if(g_Voted[client])
	{
		g_Votes--;
	}
	
	g_Voters--;
	
	g_VotesNeeded = RoundToFloor(float(g_Voters) * GetConVarFloat(g_Cvar_Needed));
	
	if (g_Votes && g_Voters && g_Votes >= g_VotesNeeded && g_RTVAllowed && !g_RTVStarted) 
	{
		g_RTVStarted = true;
		CreateTimer(2.0, Timer_StartRTV, TIMER_FLAG_NO_MAPCHANGE);
	}	
}

public Action:Command_Addmap(client, args)
{
	if (args < 1)
	{
		ReplyToCommand(client, "[SM] Usage: sm_rtv_addmap <mapname>");
		return Plugin_Handled;
	}
	
	if (!g_CanRTV)
	{
		ReplyToCommand(client, "[SM] RockTheVote is not available.");
		return Plugin_Handled;
	}
	
	decl String:mapname[64];
	GetCmdArg(1, mapname, sizeof(mapname));

	if (FindStringInArray(g_MapList, mapname) == -1)
	{
		ReplyToCommand(client, "%t", "Map was not found", mapname);
		return Plugin_Handled;
	}
	
	if (GetArraySize(g_RTVMapList) > 0)
	{
		if (FindStringInArray(g_RTVMapList, mapname) != -1)
		{
			ReplyToCommand(client, "%t", "Map Already In Vote", mapname);
			return Plugin_Handled;				
		}
		
		ShiftArrayUp(g_RTVMapList, 0);
		SetArrayString(g_RTVMapList, 0, mapname);
		
		while (GetArraySize(g_RTVMapList) > GetConVarInt(g_Cvar_Maps))
		{
			RemoveFromArray(g_RTVMapList, GetConVarInt(g_Cvar_Maps));
		}
	}
	else
	{
		PushArrayString(g_RTVMapList, mapname);
	}
		
	decl String:item[64];
	for (new i = 0; i < GetMenuItemCount(g_MapMenu); i++)
	{
		GetMenuItem(g_MapMenu, i, item, sizeof(item));
		if (strcmp(item, mapname) == 0)
		{
			RemoveMenuItem(g_MapMenu, i);
			break;
		}			
	}	
	
	ReplyToCommand(client, "%t", "Map Inserted", mapname);
	LogAction(client, -1, "\"%L\" inserted map \"%s\".", client, mapname);

	return Plugin_Handled;		
}

public Action:Command_Say(client, args)
{
	if (!g_CanRTV || !client)
	{
		return Plugin_Continue;
	}

	decl String:text[192];
	if (!GetCmdArgString(text, sizeof(text)))
	{
		return Plugin_Continue;
	}
	
	new startidx = 0;
	if(text[strlen(text)-1] == '"')
	{
		text[strlen(text)-1] = '\0';
		startidx = 1;
	}
	
	if (strcmp(text[startidx], "rtv", false) == 0 || strcmp(text[startidx], "rockthevote", false) == 0)
	{
		// ScuzTools Start Change
		if (g_Startup)
		{
			PrintToChat(client, "\x04(ScuzTools) \x01 %s", "RTV not allowed for 5 minutes after map start.");
			return Plugin_Continue;
		}
		// ScuzTools End Change

		if (!g_RTVAllowed)
		{
			PrintToChat(client, "[SM] %t", "RTV Not Allowed");
			return Plugin_Continue;
		}
		
		if (g_RTVEnded)
		{
			PrintToChat(client, "[SM] %t", "RTV Ended");
			return Plugin_Continue;
		}
		
		if (g_RTVStarted)
		{
			PrintToChat(client, "[SM] %t", "RTV Started");
			return Plugin_Continue;
		}
		
		if (GetClientCount(true) < GetConVarInt(g_Cvar_MinPlayers) && g_Votes == 0) // Should we keep checking g_Votes here?
		{
			PrintToChat(client, "[SM] %t", "Minimal Players Not Met");
			return Plugin_Continue;			
		}
		
		if (g_Voted[client])
		{
			PrintToChat(client, "[SM] %t", "Already Voted");
			return Plugin_Continue;
		}	
		
		new String:name[64];
		GetClientName(client, name, sizeof(name));
		
		g_Votes++;
		g_Voted[client] = true;
		
		PrintToChatAll("[SM] %t", "RTV Requested", name, g_Votes, g_VotesNeeded);
		
		if (g_Votes >= g_VotesNeeded)
		{
			g_RTVStarted = true;
			CreateTimer(2.0, Timer_StartRTV, TIMER_FLAG_NO_MAPCHANGE);
		}
	}
	else if (GetConVarBool(g_Cvar_Nominate) && strcmp(text[startidx], "nominate", false) == 0)
	{
		if (g_RTVEnded)
		{
			PrintToChat(client, "[SM] %t", "RTV Ended");
			return Plugin_Continue;
		}		
		
		if (g_RTVStarted)
		{
			PrintToChat(client, "[SM] %t", "RTV Started");
			return Plugin_Continue;
		}
		
		if (g_Nominated[client])
		{
			PrintToChat(client, "[SM] %t", "Already Nominated");
			return Plugin_Continue;
		}
		
		if (GetArraySize(g_RTVMapList) >= GetConVarInt(g_Cvar_Maps))
		{
			PrintToChat(client, "[SM] %t", "Max Nominations");
			return Plugin_Continue;			
		}
		
		DisplayMenu(g_MapMenu, client, MENU_TIME_FOREVER);		
	}
	
	return Plugin_Continue;	
}

public Action:Timer_DelayRTV(Handle:timer)
{
	// ScuzTools Mod Start
	g_Startup =false;
	// ScuzTools Mod End
	g_RTVAllowed = true;
	g_RTVStarted = false;
	g_RTVEnded = false;	
}

public Action:Timer_StartRTV(Handle:timer)
{
	if (timer == g_RetryTimer)
	{
		g_RetryTimer = INVALID_HANDLE;
	}
	
	if (g_RetryTimer != INVALID_HANDLE)
	{
		return;
	}

	if (IsVoteInProgress())
	{
		// Can't start a vote, try again in 5 seconds.
		g_RetryTimer = CreateTimer(5.0, Timer_StartRTV, TIMER_FLAG_NO_MAPCHANGE);
		return;
	}			
	
	PrintToChatAll("[SM] %t", "RTV Vote Ready");
		
	new Handle:MapVoteMenu = CreateMenu(Handler_MapMapVoteMenu, MenuAction:MENU_ACTIONS_ALL);
	SetMenuTitle(MapVoteMenu, "Rock The Vote");
	
	new Handle:tempMaps  = CloneArray(g_MapList);
	decl String:map[32];

	GetCurrentMap(map, sizeof(map));
	new index = FindStringInArray(tempMaps, map);
	if (index != -1)
	{
		RemoveFromArray(tempMaps, index);
	}	
	
	// We assume that g_RTVMapList is within the correct limits, based on the logic for nominations
	for (new i = 0; i < GetArraySize(g_RTVMapList); i++)
	{
		GetArrayString(g_RTVMapList, i, map, sizeof(map));
		AddMenuItem(MapVoteMenu, map, map);
		
		index = FindStringInArray(tempMaps, map);
		if (index != -1)
		{
			RemoveFromArray(tempMaps, index);
		}
	}
	
	new limit = GetConVarInt(g_Cvar_Maps) - GetArraySize(g_RTVMapList);
	if (limit > GetArraySize(tempMaps))
	{
		limit = GetArraySize(tempMaps);
	}

	for (new i = 0; i < limit; i++)
	{
		new b = GetRandomInt(0, GetArraySize(tempMaps) - 1);
		GetArrayString(tempMaps, b, map, sizeof(map));		
		PushArrayString(g_RTVMapList, map);
		AddMenuItem(MapVoteMenu, map, map);			
		RemoveFromArray(tempMaps, b);
	}	
	
	CloseHandle(tempMaps);
	
	AddMenuItem(MapVoteMenu, "Don't Change", "Don't Change");
		
	SetMenuExitButton(MapVoteMenu, false);
	VoteMenuToAll(MapVoteMenu, 20);
		
	LogMessage("[SM] Rockthevote was successfully started.");
}

public Action:Timer_ChangeMap(Handle:hTimer, Handle:dp)
{
	new String:map[65];
	
	ResetPack(dp);
	ReadPackString(dp, map, sizeof(map));
	
	ServerCommand("changelevel \"%s\"", map);
	
	return Plugin_Stop;
}

public Handler_MapMapVoteMenu(Handle:menu, MenuAction:action, param1, param2)
{
	switch (action)
	{
		case MenuAction_End:
		{
			CloseHandle(menu);
		}
		
		case MenuAction_Display:
		{
	 		decl String:oldTitle[255], String:buffer[255];
			GetMenuTitle(menu, oldTitle, sizeof(oldTitle));
			Format(buffer, sizeof(buffer), "%T", oldTitle, param1);

			new Handle:panel = Handle:param2;
			SetPanelTitle(panel, buffer);
		}
		
		case MenuAction_DisplayItem:
		{
			if (GetMenuItemCount(menu) - 1 == param2)
			{
				decl String:buffer[255];
				Format(buffer, sizeof(buffer), "%T", "Don't Change", param1);
				return RedrawMenuItem(buffer);
			}
		}		

		// Why am I commented out? Because BAIL hasn't decided yet if
		// vote notification will be built into the Vote API.
		case MenuAction_Select:
		{
			decl String:Name[32], String:Map[32];
			GetClientName(param1, Name, sizeof(Name));
			GetMenuItem(menu, param2, Map, sizeof(Map));

			PrintToChatAll("(ScuzTools) %s has voted for map '%s'", Name, Map);
		}
		
		case MenuAction_VoteCancel:
		{
			if (param1 == VoteCancel_NoVotes)
			{
				PrintToChatAll("[SM] %t", "No Votes");
				g_RTVEnded = true;
			}
		}

		case MenuAction_VoteEnd:
		{
			new String:map[64];
			
			GetMenuItem(menu, param1, map, sizeof(map));
			
			if (GetMenuItemCount(menu) - 1 == param1) // This should always match the "Keep Current" option
			{
				PrintToChatAll("[SM] %t", "Current Map Stays");
				LogMessage("[SM] Rockthevote has ended, current map kept.");
			}
			else
			{
				PrintToChatAll("[SM] %t", "Changing Maps", map);
				LogMessage("[SM] Rockthevote has ended, changing to map %s.", map);
				new Handle:dp;
				CreateDataTimer(5.0, Timer_ChangeMap, dp);
				WritePackString(dp, map);
			}
			
			g_RTVEnded = true;
		}
	}
	
	return 0;
}

public Handler_MapSelectMenu(Handle:menu, MenuAction:action, param1, param2)
{
	switch (action)
	{
		case MenuAction_Select:
		{
			if (GetArraySize(g_RTVMapList) >= GetConVarInt(g_Cvar_Maps)) 
			{
				PrintToChat(param1, "[SM] %t", "Max Nominations");
				return;	
			}
			
			decl String:map[64], String:name[64];
			GetMenuItem(menu, param2, map, sizeof(map));
			
			if (FindStringInArray(g_RTVMapList, map) != -1)
			{
				PrintToChat(param1, "[SM] %t", "Map Already Nominated");
				return;
			}
			
			GetClientName(param1, name, 64);

			PushArrayString(g_RTVMapList, map);
			RemoveMenuItem(menu, param2);
			
			g_Nominated[param1] = true;
			
			PrintToChatAll("[SM] %t", "Map Nominated", name, map);
		}
	}
}

BuildMapMenu()
{
	if (g_MapMenu != INVALID_HANDLE)
	{
		CloseHandle(g_MapMenu);
		g_MapMenu = INVALID_HANDLE;
	}
	
	g_MapMenu = CreateMenu(Handler_MapSelectMenu);
	SetMenuTitle(g_MapMenu, "%t", "Nominate Title");

	decl String:map[64];		
	for (new i = 0; i < GetArraySize(g_MapList); i++)
	{
		GetArrayString(g_MapList, i, map, sizeof(map));
		AddMenuItem(g_MapMenu, map, map);
	}
	
	SetMenuExitButton(g_MapMenu, false);
}
__________________
"Player Quality, not Quantity, is what we strive for." - The LLama Wrangler
"A clan is defined by the nature of it's enemies. - The Llama Wrangler
Scuzzy is offline   Reply With Quote


Old 05-07-2008, 07:49 PM   #17
KubeDawg
Nade Whore
Server Owner
Beta Tester
 
KubeDawg's Avatar
 
Join Date: Sep 2007
Location: Oklahoma
Class/Position: Scout/Soldier
Gametype: CTF/TDM
Affiliations: blunt. Moto
Posts Rated Helpful 128 Times
Ok cool thanks.

Also, is there a way to do multiple Rockthevotes during 1 map if one or more of them fail?
__________________
Moto's Funhouse | Dallas, TX - 74.91.114.247:27015

ff_plunder - Complete
KubeDawg is offline   Reply With Quote


Old 05-07-2008, 09:06 PM   #18
Scuzzy
D&A Member
Retired FF Staff
 
Scuzzy's Avatar
 
Join Date: Mar 2007
Location: Server: 206.217.134.170:27016
Posts Rated Helpful 2 Times
Quote:
Originally Posted by KubeDawg
Ok cool thanks.

Also, is there a way to do multiple Rockthevotes during 1 map if one or more of them fail?
This is going to sound stupid, but what do you mean fail? Do you mean if everyone chooses 'stay' you want to be able to rockthevote later? I haven't really run into this... I think I know what it tells you, but let me know exactly what text you see when you "rtv" the second time. Then I can tell you what code to add to allow it... which will be either one line (which would allow you to immediately rock the vote again) or a bunch of lines to delay it a bit...

Scuzzy
__________________
"Player Quality, not Quantity, is what we strive for." - The LLama Wrangler
"A clan is defined by the nature of it's enemies. - The Llama Wrangler
Scuzzy is offline   Reply With Quote


Old 05-07-2008, 11:13 PM   #19
KubeDawg
Nade Whore
Server Owner
Beta Tester
 
KubeDawg's Avatar
 
Join Date: Sep 2007
Location: Oklahoma
Class/Position: Scout/Soldier
Gametype: CTF/TDM
Affiliations: blunt. Moto
Posts Rated Helpful 128 Times
Basically, if everyone rocks the vote, and it ends up not getting enough people for it to change, it will not allow you to rock the vote after that, meaning, if I wanted to rock it again, say in about 15 minutes, it will not let me. It gives me a message like You cannot rock the vote as it's already been rocked. This happens after the vote is over.
__________________
Moto's Funhouse | Dallas, TX - 74.91.114.247:27015

ff_plunder - Complete
KubeDawg is offline   Reply With Quote


Old 05-07-2008, 11:55 PM   #20
Dr.Satan
Wiki Team
Fortress Forever Staff
 
Dr.Satan's Avatar
 
Join Date: Sep 2007
Location: Greeley, CO
Class/Position: Med / Solly
Gametype: PAYLOAD
Affiliations: DET-
Posts Rated Helpful 19 Times
isn't that like the whole point of rtv...letting the people who are playing decide if they want to change the map or not?
__________________
(Released) conc_school | hellion_classic | ksour_PAYLOAD | mulch_faf
(Beta) alchimy_b1
(Lua) base_payload_2015
(Models) props_trainyard
Support FF:
Dr.Satan is offline   Reply With Quote


Reply


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT. The time now is 05:03 PM.


Powered by vBulletin® Version 3.8.7
Copyright ©2000 - 2024, vBulletin Solutions, Inc.