AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   Scripting (https://forums.alliedmods.net/forumdisplay.php?f=107)
-   -   [L4D2] Retrieving the name/id of the campaign (https://forums.alliedmods.net/showthread.php?t=316657)

thresh0ld 06-03-2019 09:08

[L4D2] Retrieving the name/id of the campaign
 
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.

CliptonHeist 06-03-2019 09:55

Re: [L4D2] Retrieving the name/id of the campaign
 
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.

Lux 06-03-2019 11:15

Re: [L4D2] Retrieving the name/id of the campaign
 
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.

thresh0ld 06-03-2019 12:48

Re: [L4D2] Retrieving the name/id of the campaign
 
Quote:

Originally Posted by Lux (Post 2654214)
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!


All times are GMT -4. The time now is 02:23.

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