View Single Post
TnTSCS
AlliedModders Donor
Join Date: Oct 2010
Location: Undisclosed...
Old 04-03-2012 , 14:07   Re: [CSS] Plugin Only in a Specified Map
Reply With Quote #12

try this... check out what I did and you'll see how/where you can make changes...

I added the global g_bPluginEnable bool (true/false)

Then a check OnMapStart to set that bool to true if the map is de_dust and false otherwise.

Then in each of the command callbacks, I put a check to see if that bool is false and if it's false, let the client know the command cannot be run and stop processing that command.

In RED are the changes:
Code:
#pragma semicolon 1

#include <sourcemod>
#include <sdktools>
#include <cstrike>

new LastNormalGame = 0;

new bool:g_bPluginEnable;

public Plugin:myinfo = 
{
	name = "ba_jail_aeon_v1 Game random chooser",
	author = "_RaptorOne_",
	description = "Helper Plugin (!aeongame, !aeongame?) [ENGLISH]",
	version = "1.00",
	url = "http://www.gefaengnistrakt.de/forum/index.php?page=Portal"
};

public OnPluginStart()
{
	RegConsoleCmd("sm_aeongame", Execute_Game);
	RegConsoleCmd("sm_aeongame?", Execute_GameQuest);
}

public OnMapStart()
{
	decl String:map_name[32];
	GetCurrentMap(map_name, sizeof(map_name));

	if(StrEqual(map_name, "de_dust", false))
	{
		g_bPluginEnable = true;
	}
	else
	{
		g_bPluginEnable = false;
	}
}

public Action:Execute_Game(client, args)
{
	if (!g_bPluginEnable)
	{
		PrintToChat(client, "\x04[AeonGameChooser]: Command not active on this map!");
		return Plugin_Continue;
	}
	if (!IsPlayerAlive(client))
	{
		PrintToChat(client,"\x04[AeonGameChooser]: Only live player can randomly choose a game!");
		return Plugin_Continue;
	}
	if (!(GetClientTeam(client) == 3))
	{
		PrintToChat(client,"\x04[AeonGameChooser]: Only Counter-Terrorists can randomly choose a game!");
		return Plugin_Continue;
	}
	LastNormalGame = GetRandomInt(1, 14);
	switch (LastNormalGame)
	{
		case 1:
		{
			PrintToChatAll("\x04[AeonGameChooser]: Random game: High Diving!");
		}
		case 2:
		{
			PrintToChatAll("\x04[AeonGameChooser]: Random game: Pool Race!");
		}
		case 3:
		{
			PrintToChatAll("\x04[AeonGameChooser]: Random game: Soccer!");
		}
		case 4:
		{
			PrintToChatAll("\x04[AeonGameChooser]: Random game: Bomb Toss!");
		}
		case 5:
		{
			PrintToChatAll("\x04[AeonGameChooser]: Random game: Crazy Maze!");
		}
		case 6:
		{
			PrintToChatAll("\x04[AeonGameChooser]: Random game: Free Fall Tower!");
		}
		case 7:
		{
			PrintToChatAll("\x04[AeonGameChooser]: Random game: Helicopter Pressure!");
		}
		case 8:
		{
			PrintToChatAll("\x04[AeonGameChooser]: Random game: Time Blocks!");
		}
		case 9:
		{
			PrintToChatAll("\x04[AeonGameChooser]: Random game: Break the Blocks (Takeshis Castle)!");
		}
		case 10:
		{
			PrintToChatAll("\x04[AeonGameChooser]: Random game: Skipping!");
		}
		case 11:
		{
			PrintToChatAll("\x04[AeonGameChooser]: Random game: Drive Down (Carcrash)!");
		}
		case 12:
		{
			PrintToChatAll("\x04[AeonGameChooser]: Random game: Wrong Chair!");
		}
		case 13:
		{
			PrintToChatAll("\x04[AeonGameChooser]: Random game: Seven Colors (Color Simon Says)!");
		}
		case 14:
		{
			PrintToChatAll("\x04[AeonGameChooser]: Random game: Deep Diving!");
		}
		default:
		{
			PrintToChatAll("\x04[AeonGameChooser]: Random game: Drive Down (Carcrash)!");
		}
	}
	return Plugin_Continue;
}

public Action:Execute_GameQuest(client, args)
{
	if (!g_bPluginEnable)
	{
		PrintToChat(client, "\x04[AeonGameChooser]: Command not active on this map!");
		return Plugin_Continue;
	}

	new String:OutString1[192];
	new String:OutString2[192];
	new String:OutString3[192];
	new bool:OutType=false;
	if ((!IsPlayerAlive(client)) || (!(GetClientTeam(client) == 3)))
	{
		OutType = true;
	}
	switch (LastNormalGame)
	{
		case 0:
		{
			OutString1="\x04[AeonGameChooser]: Not choosen a game already.";
			OutString2="\x04-"; 
			OutString3="\x04-";
		}
		case 1:
		{
			OutString1="\x04[AeonGameChooser]: High Diving - The terrorists have to go on the jumptower.";
			OutString2="\x04The CT choose a colored platform to jump from and a colored hole to jump in."; 
			OutString3="\x04Location: at the Pool.";
		}
		case 2:
		{
			OutString1="\x04[AeonGameChooser]: Pool Race - The terrorists choose a springboard.";
			OutString2="\x04On the lot by the CT, the terrorists swim to the other side. If they reach them they come back. The fastest player wins";
			OutString3="\x04Location: beim Pool";
		}
		case 3:
		{
			OutString1="\x04[AeonGameChooser]: Soccer - the terrorists form 2 teams.";
			OutString2="\x04Now, the teams compete against each other. The Teams are not allowed to change the side of the field.";
			OutString3="\x04Location: Right next to the armory";
		}
		case 4:
		{
			OutString1="\x04[AeonGameChooser]: Bomb Toss";
			OutString2="\x04self-explanatory";
			OutString3="\x04Location: Massjail";
		}
		case 5:
		{
			OutString1="\x04[AeonGameChooser]: Crazy Maze";
			OutString2="\x04self-explanatory";
			OutString3="\x04Location: Minigame room, back right.";
		}
		case 6:
		{
			OutString1="\x04[AeonGameChooser]: Free Fall Tower - The terrorists choose a chamber.";
			OutString2="\x04The CT push the start button. The first terrorist who reaches the ground will be teleported and wins. The rest will be killed!";
			OutString3="\x04Location: Minigame room, back mid.";
		}
		case 7:
		{
			OutString1="\x04[AeonGameChooser]: Helicopter Pressure - The CT starts the helicopter. The terrorists are locked up in court.";
			OutString2="\x04The CT try now to crush the terrorists with the helicopter. (A touch is enough.)";
			OutString3="\x04Location: Minigame room, back left --> long corridor, 2nd way right.";
		}
		case 8:
		{
			OutString1="\x04[AeonGameChooser]: Time Blocks - The terrorists are locked up in court.";
			OutString2="\x04The CT push the start button. If enough player died, the CT push the stop button.";
			OutString3="\x04Location: Minigame room, back left --> long corridor, straight through.";
		}
		case 9:
		{
			OutString1="\x04[AeonGameChooser]: Break the Blocks (Takeshis Castle) - The terrorists form 2 teams.";
			OutString2="\x04Every team choose a side and wait till the CT push the start button. Now they try to shoot the enemy blocks.";
			OutString3="\x04Location: Minigame room, back left --> long corridor, first right";
		}
		case 10:
		{
			OutString1="\x04[AeonGameChooser]: Skipping - The terrorists are locked up in court.";
			OutString2="\x04The CT push the start button. If enough player died, the CT push thne stop button.";
			OutString3="\x04Location: Minigame wing, right";
		}
		case 11:
		{
			OutString1="\x04[AeonGameChooser]: Drive Down (Carcrash) - The terrorists are locked up in court.";
			OutString2="\x04The CT begins to control the car and crash into the terrorists.";
			OutString3="\x04Location: Minigame wing, straight trough";
		}
		case 12:
		{
			OutString1="\x04[AeonGameChooser]: Wrong Chair - The terrorists are locked up in court.";
			OutString2="\x04The CT push randomly a button. The T have to choose one chamber. If they are in the false chamber...";
			OutString3="\x04Location: Minigame wing, left, first room";
		}
		case 13:
		{
			OutString1="\x04[AeonGameChooser]: Seven Colors - The terrorists are locked up in court.";
			OutString2="\x04The CT push a colored button. The terrorists have now 1.75 sec time to get on these color.";
			OutString3="\x04Location: Minigame wing, left, 2nd room";
		}
		case 14:
		{
			OutString1="\x04[AeonGameChooser]: Deep Diving - The terrorists form a line before the pool.";
			OutString2="\x04On the go of the CT, the terrorists dive into the big hole in the pool. On the ground is bomb. Who get these bomb wins the game!";
			OutString3="\x04Location: Pool";
		}
		default:
		{
			OutString1="\x04[AeonGameChooser]: Unknown game - Plugin Error ";
			OutString2="\x04-";
			OutString3="\x04contact me please with a detailed description.";
		}
	}
	if (OutType)
	{
		PrintToChat(client, OutString1);
		PrintToChat(client, OutString2);
		PrintToChat(client, OutString3);
	}
	else
	{
		PrintToChatAll(OutString1);
		PrintToChatAll(OutString2);
		PrintToChatAll(OutString3);
	}
	return Plugin_Continue;
}
Attached Files
File Type: sp Get Plugin or Get Source (AeonGameChooser.sp - 112 views - 7.6 KB)
__________________
View my Plugins | Donate

Last edited by TnTSCS; 04-03-2012 at 14:09.
TnTSCS is offline