Monthly Target: $400 Donations: $554
 138% 

[CSS] Plugin Only in a Specified Map


Post New Thread Reply   
 
Thread Tools Display Modes
away000
Veteran Member
Join Date: Sep 2010
Old 04-03-2012 , 12:14   Re: [CSS] Plugin Only in a Specified Map
Reply With Quote #11

Is a Plugin who come with a map, i want only to work only with this map, here are the source and u will understand what i'm tryng to do
Attached Files
File Type: sp Get Plugin or Get Source (AeonGameChooser.sp - 38 views - 7.1 KB)
__________________
away000 is offline
TnTSCS
SourceMod 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 - 29 views - 7.6 KB)
__________________

Last edited by TnTSCS; 04-03-2012 at 14:09.
TnTSCS is offline
away000
Veteran Member
Join Date: Sep 2010
Old 04-03-2012 , 14:13   Re: [CSS] Plugin Only in a Specified Map
Reply With Quote #13

Soo Thanks TnT for ur help (or try ^^) i will check if it works and post about ;D
__________________
away000 is offline
TnTSCS
SourceMod Donor
Join Date: Oct 2010
Location: Undisclosed...
Old 04-03-2012 , 14:36   Re: [CSS] Plugin Only in a Specified Map
Reply With Quote #14

Hope it works for you I didn't test it.

Don't forget to give to Lord Canistra, minimoney1, and mcpan313 for their input
__________________

Last edited by TnTSCS; 04-03-2012 at 14:37.
TnTSCS is offline
away000
Veteran Member
Join Date: Sep 2010
Old 04-03-2012 , 14:40   Re: [CSS] Plugin Only in a Specified Map
Reply With Quote #15

Can u have a look at another plugin who is not working?

https://forums.alliedmods.net/showth...40#post1677140

I know is much more than i expect but try is free
__________________
away000 is offline
TheAvengers2
BANNED
Join Date: Jul 2011
Old 04-04-2012 , 00:38   Re: [CSS] Plugin Only in a Specified Map
Reply With Quote #16

Couldn't you simply put a [map name].cfg in /cstrike/maps/cfg with sm plugins unload [plugin]?
TheAvengers2 is offline
TnTSCS
SourceMod Donor
Join Date: Oct 2010
Location: Undisclosed...
Old 04-04-2012 , 00:40   Re: [CSS] Plugin Only in a Specified Map
Reply With Quote #17

yes... that's why I asked him if he was asking for scripting help or general SM usage help... your solution is for general SM usage help - which is what he probably needed.
__________________
TnTSCS is offline
rodrigo286
Veteran Member
Join Date: Sep 2010
Location: Brazil, São Paulo
Old 04-06-2012 , 21:11   Re: [CSS] Plugin Only in a Specified Map
Reply With Quote #18

It is possible to operate only in specific maps, code example, only in de_ maps?

Thanks.
__________________
My Plugins | VIEW HERE | I accept private requests, send me a PM.
Buy respawn | Uber Recall | Grenade drop | Damage Supperssor
Meet the Medic | Disguise Expert | Crazy Jet

CZSBrasil TEAM
rodrigo286 is offline
Reply


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 -4. The time now is 21:45.


Powered by vBulletin®
Copyright ©2000 - 2015, vBulletin Solutions, Inc.
Theme made by Freecode