Raised This Month: $32 Target: $400
 8% 

[CSS] Plugin Only in a Specified Map


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
away000
Veteran Member
Join Date: Sep 2010
Old 04-02-2012 , 17:52   [CSS] Plugin Only in a Specified Map
Reply With Quote #1

How can i do to run a plugin only in a pre defined map?

I want a "code" who i can put in "OnPluginStart" and check if is the map who need the plugin, if is the map them RUN plugin if not them no load the plugin (but plugin stay in PLUGIN folder in case run the map after...)
__________________
away000 is offline
Lord Canistra
Senior Member
Join Date: Mar 2009
Location: Tallinn, Estonia
Old 04-02-2012 , 18:20   Re: [CSS] Plugin Only in a Specified Map
Reply With Quote #2

Check map with GetCurrentMap, then disable it by some means (try sm plugin unload *plugin_name*)
__________________
Lord Canistra is offline
minimoney1
SourceMod Donor
Join Date: Dec 2010
Old 04-02-2012 , 18:47   Re: [CSS] Plugin Only in a Specified Map
Reply With Quote #3

can just make a global bool which tells the plugin if it should function or not.
OnMapStart you can call GetCurrentMap and check if it's a specific map.

If you want to do this with another plugin and disable it, you can use ServerCommand("sm plugins unload \"plugin name\"");
minimoney1 is offline
mcpan313
Senior Member
Join Date: Mar 2010
Old 04-03-2012 , 11:18   Re: [CSS] Plugin Only in a Specified Map
Reply With Quote #4

PHP Code:
new bool:g_bPluginEnable;

public 
OnMapStart()
{
    
decl String:map_name[32];
    
GetCurrentMap(map_namesizeof(map_name));
    if (
strcmp(map_name"de_dust") == ||
        
strcmp(map_name"de_dust2") == 0)
    {
        
g_bPluginEnable true;
    }

__________________
sorry, for my poor english.
mcpan313 is offline
Send a message via MSN to mcpan313
away000
Veteran Member
Join Date: Sep 2010
Old 04-03-2012 , 11:22   Re: [CSS] Plugin Only in a Specified Map
Reply With Quote #5

Thanks, that is what i want but why have Dust and Dust2? how i can do to map run only in Dust and not in Dust2? (for example)
__________________
away000 is offline
TnTSCS
AlliedModders Donor
Join Date: Oct 2010
Location: Undisclosed...
Old 04-03-2012 , 11:26   Re: [CSS] Plugin Only in a Specified Map
Reply With Quote #6

what you want is StrEqual then...

PHP Code:
if(StrEqual(map_name"de_dust"false))
{
    
g_bPluginEnable true;

OR

Have your plugin use a CVar to enable (or disable) the plugin and use map configs
__________________
View my Plugins | Donate

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

Quote:
Originally Posted by TnTSCS View Post
what you want is StrEqual then...

PHP Code:
if(StrEqual(map_name"de_dust"false))
{
    
g_bPluginEnable true;

OR

Have your plugin use a CVar to enable (or disable) the plugin and use map configs
Thanks TnT but i got this....


X2AeonGameChooser.sp(23) : error 017: undefined symbol "map_name"
X2AeonGameChooser.sp(25) : error 017: undefined symbol "g_bPluginEnable"
X2AeonGameChooser.sp(25) : warning 215: expression has no effect

2 Errors.




Thanks mcpan

Quote:
Originally Posted by mcpan313 View Post
PHP Code:
new bool:g_bPluginEnable;

public 
OnMapStart()
{
    
decl String:map_name[32];
    
GetCurrentMap(map_namesizeof(map_name));
    if (
strcmp(map_name"de_dust") == ||
        
strcmp(map_name"de_dust2") == 0)
    {
        
g_bPluginEnable true;
    }


But got this:


X2AeonGameChooser.sp(27) : warning 204: symbol is assigned a value that is never used: "g_bPluginEnable"
Header size: 2444 bytes
Code size: 3608 bytes
Data size: 4816 bytes
Stack/heap size: 16384 bytes; Total requirements: 27252 bytes

1 Warning.
__________________

Last edited by away000; 04-03-2012 at 11:52.
away000 is offline
TnTSCS
AlliedModders Donor
Join Date: Oct 2010
Location: Undisclosed...
Old 04-03-2012 , 11:50   Re: [CSS] Plugin Only in a Specified Map
Reply With Quote #8

well... you have to integrate that code snippit into your plugin

Are you asking for coding help, or SM help?


Here's my above suggestion in the code mcpan313 provided:
PHP Code:
new bool:g_bPluginEnable;

public 
OnMapStart()
{
    
decl String:map_name[32];
    
map_name[0] = '\0';

    
GetCurrentMap(map_namesizeof(map_name));

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

__________________
View my Plugins | Donate

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

Any help would be awsome

About integrate that code into the plugin is my problem, i don't know how to do this....
__________________
away000 is offline
TnTSCS
AlliedModders Donor
Join Date: Oct 2010
Location: Undisclosed...
Old 04-03-2012 , 12:05   Re: [CSS] Plugin Only in a Specified Map
Reply With Quote #10

if you want someone to alter a plugin to only be enabled on certain maps, then either post in that plugins thread or in the Requests And Suggestions section...

But since you started here, if you want, post the plugin (or link to the thread you got it from) and someone can probably oblige.
__________________
View my Plugins | Donate
TnTSCS 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 00:41.


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