Raised This Month: $51 Target: $400
 12% 

[L4D2] Detect L4D1 Campaing


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
DeepLearning
Junior Member
Join Date: Dec 2017
Old 02-25-2018 , 19:02   [L4D2] Detect L4D1 Campaing
Reply With Quote #1

Is there an easier way to detect L4D1 Campaign by OnMapStart?
The only idea that i had:
Code:
public void OnMapStart()
{
	char mapname[64];
	GetCurrentMap(mapname, sizeof(mapname));
	
	if(StrContains(mapname, "EveryL4D1CampaignName")
}

Last edited by DeepLearning; 02-25-2018 at 19:06. Reason: Campaing > Campaign
DeepLearning is offline
cravenge
Veteran Member
Join Date: Nov 2015
Location: Chocolate Factory
Old 02-25-2018 , 21:52   Re: [L4D2] Detect L4D1 Campaing
Reply With Quote #2

I'm NOT sure if these Left 4 Downtown 2 forwards do their thing BEFORE the map is loaded but you can give it a try.
PHP Code:
// ...
#include <left4downtown>

bool bL4D1Campaign;

public 
void OnMapStart()
{
    if (
bL4D1Campaign)
    {
        
// Do your stuff here...
    
}
}

public 
Action L4D_OnGetSurvivorSet(int &retVal)
{
    if (
retVal == && !bL4D1Campaign)
    {
        
bL4D1Campaign true;
    }
    else if (
bL4D1Campaign && retVal == 2)
    {
        
bL4D1Campaign false;
    }
    return 
Plugin_Continue;
}

public 
Action L4D_OnFastGetSurvivorSet(int &retVal)
{
    if (
retVal == && !bL4D1Campaign)
    {
        
bL4D1Campaign true;
    }
    else if (
bL4D1Campaign && retVal == 2)
    {
        
bL4D1Campaign false;
    }
    return 
Plugin_Continue;
}
// ... 
cravenge is offline
Spirit_12
Veteran Member
Join Date: Dec 2012
Location: Toronto, CA
Old 02-25-2018 , 22:34   Re: [L4D2] Detect L4D1 Campaing
Reply With Quote #3

Keep one thing in mind that when you use survivor set for detection, it will not filter any custom maps.
__________________
Spirit_12 is offline
cravenge
Veteran Member
Join Date: Nov 2015
Location: Chocolate Factory
Old 02-25-2018 , 22:38   Re: [L4D2] Detect L4D1 Campaing
Reply With Quote #4

Quote:
Originally Posted by Spirit_12 View Post
[...]
Yes. It will always check for every map, either stock or custom.
cravenge is offline
Visual77
Veteran Member
Join Date: Jan 2009
Old 02-26-2018 , 06:53   Re: [L4D2] Detect L4D1 Campaing
Reply With Quote #5

Only use downtown for things you cannot do within sourcemod itself. Strcontains would suffice.

I think c6m is l4d2 campaign, honestly I don't even remember anymore.

Code:
char L4D1campaigns[][] = { "c7m", "c8m", "c9m", "c10m", "c11m", "c12m" };

public void OnMapStart()
{
	char mapname[64];
	GetCurrentMap(mapname, sizeof(mapname));

	for (int i = 0; i < sizeof(L4D1campaigns); i++)
	{
		if (StrContains(mapname, L4D1campaigns[i], false) != -1)
		{
			// L4D1 campaign
		}
	}
}

Last edited by Visual77; 02-26-2018 at 07:00.
Visual77 is offline
Reply



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 07:52.


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