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

[L4D2] Retrieving the name/id of the campaign


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
thresh0ld
Senior Member
Join Date: Sep 2009
Location: Hell
Old 06-03-2019 , 09:08   [L4D2] Retrieving the name/id of the campaign
Reply With Quote #1

Does anyone know a way where I could retrieve the campaign name/id based on the map name? For ex: I need to have a function where I would pass "c5m3_cemetery" as the argument and get "The Parish" as the result.

Been looking all over the web,so far no luck. If this is not possible, then my last option would be to create a mapping file, just wondering if there is an easier/better way to do it.
thresh0ld is offline
CliptonHeist
Senior Member
Join Date: Feb 2016
Old 06-03-2019 , 09:55   Re: [L4D2] Retrieving the name/id of the campaign
Reply With Quote #2

Just check for the campaign in the map name? e.g.
PHP Code:
public void CheckCampaign()
{
    
char sMap[128];
    
GetCurrentMap(sMapsizeof(sMap));

    if(
StrContains(sMap"c1") != -1)
        
PrintToChatAll("Dead Center");
    else if(
StrContains(sMap"c2") != -1)
        
PrintToChatAll("Dark Carnival");

    
// etc etc...

Obviously wouldn't work for custom campaigns though.
CliptonHeist is offline
Lux
Veteran Member
Join Date: Jan 2015
Location: Cat
Old 06-03-2019 , 11:15   Re: [L4D2] Retrieving the name/id of the campaign
Reply With Quote #3

Rikka did some work around this kinda of thing.

https://github.com/rikka0w0/l4d2_mis...anager.inc#L32

I think that is what you are looking for.
For valve maps you will usually get strings like "#L4D360UI_CampaignName_C1" which as translated clientsided.
__________________
Connect
My Plugins: KlickME
[My GitHub]

Commission me for L4D
Lux is offline
thresh0ld
Senior Member
Join Date: Sep 2009
Location: Hell
Old 06-03-2019 , 12:48   Re: [L4D2] Retrieving the name/id of the campaign
Reply With Quote #4

Quote:
Originally Posted by Lux View Post
Rikka did some work around this kinda of thing.

https://github.com/rikka0w0/l4d2_mis...anager.inc#L32

I think that is what you are looking for.
For valve maps you will usually get strings like "#L4D360UI_CampaignName_C1" which as translated clientsided.
Thanks! I'll take a look

Edit: This is exactly what I was looking for!

Last edited by thresh0ld; 06-03-2019 at 13:06.
thresh0ld 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 18:57.


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