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

[L4D2] Improved Automatic Campaign Switcher (ACS) [v2.3.0 (20201024)]


Post New Thread Reply   
 
Thread Tools Display Modes
Mr. Man
Veteran Member
Join Date: Mar 2011
Location: Huh?
Old 07-06-2018 , 04:58   Re: [L4D2] Improved Automatic Campaign Switcher (ACS) [v1.9.0 (20180706)]
Reply With Quote #11

What file am I missing here exactly:

Code:
L 07/06/2018 - 03:57:43: [L4D2_missionmanager.smx] An error occured while parsing maps.phrases.txt(English), code:1
L 07/06/2018 - 03:57:43: [L4D2_missionmanager.smx] Map name localization file addons/sourcemod/translations/maps.phrases.txt does not exist!
Was I supposed to have created one myself or?

Also would be good if you added the auto reset to defined map/change maps when server is empty for x amount of time.

Last edited by Mr. Man; 07-06-2018 at 05:05.
Mr. Man is offline
rikka0w0
Member
Join Date: May 2018
Location: Sydney, Australia / Beij
Old 07-06-2018 , 10:05   Re: [L4D2] Improved Automatic Campaign Switcher (ACS) [v1.9.0 (20180706)]
Reply With Quote #12

Quote:
Originally Posted by Crasher_3637 View Post
Congrats.

I haven't had the time to convert the source code to the new syntax yet. I could probably shorten the code by 50-100 lines once I convert it.

And maybe we can work together to add L4D1 support.
The latest version completely abandon the old syntax.
The problem is that I didn't buy L4D1, there no way for me to test it. However in theory this plugin should be compatible with L4D, as long as the campaign/map list can be correctly generated.
rikka0w0 is offline
rikka0w0
Member
Join Date: May 2018
Location: Sydney, Australia / Beij
Old 07-06-2018 , 10:17   Re: [L4D2] Improved Automatic Campaign Switcher (ACS) [v1.9.0 (20180706)]
Reply With Quote #13

Quote:
Originally Posted by Mr. Man View Post
What file am I missing here exactly:

Code:
L 07/06/2018 - 03:57:43: [L4D2_missionmanager.smx] An error occured while parsing maps.phrases.txt(English), code:1
L 07/06/2018 - 03:57:43: [L4D2_missionmanager.smx] Map name localization file addons/sourcemod/translations/maps.phrases.txt does not exist!
Was I supposed to have created one myself or?

Also would be good if you added the auto reset to defined map/change maps when server is empty for x amount of time.
"maps.phrases.txt" is used for localizing individual maps, e.g. c1m1_hotel to some human-readable name. If you don't want to localize them, it's completely fine. Create a file with the following content as the "maps.phrases.txt":
PHP Code:
"Phrases"
{


As a result, the maps will be shown as names like "c1m1_hotel".
To localize map names, your "maps.phrases.txt" should be something like:
PHP Code:
"Phrases"
{
    
"c1m1_hotel"
    
{
        
"en"        "Hotel"
    
}


Sorry I forgot to mention this in the intro

Quote:
Also would be good if you added the auto reset to defined map/change maps when server is empty for x amount of time.
I had another plugin which does something similar, it switches to c1m1_hotel when the empty server is running 3-rd party maps. Some people doesn't have 3-rd maps, they cannot log on to the server and change the map if the server is already running a 3-rd map. I think it might be good to include this function into the ACS.

Last edited by rikka0w0; 07-06-2018 at 10:22.
rikka0w0 is offline
Psyk0tik
Veteran Member
Join Date: May 2012
Location: Homeless
Old 07-06-2018 , 11:08   Re: [L4D2] Improved Automatic Campaign Switcher (ACS) [v1.9.0 (20180706)]
Reply With Quote #14

Both .sp files failed to compile. The reason is that you didn't parenthesize the values that you were using the view_as operator for.

Before: view_as<something>something2
After: view_as<something>(something2)

I also replaced all the "FCVAR_PLUGIN" plugin stuff with an underscore since they're deprecated.

Another thing I did was add #pragma newdecls required to both plugins. For acs.sp, you didn't add "void" for the ConVar.AddChangeHook callbacks and other things like OnMapStart and OnPluginStart. You also didn't add "int" for the MenuHandler.

Before: public VoteMenuHandler
After: public int VoteMenuHandler

Aside from that, everything checks out so far, though I do see a lot of hard-coded stuff that could easily be shortened/fixed by Silvers' suggestion. I second his suggestion since it really will reduce all those mutations to like around 25-30 lines of code and will support all mutations including custom ones.

This is the one that Silvers is suggesting.

PHP Code:
int g_iCurrentMode;
bool IsAllowedGameMode()
{
    if( 
g_hCvarMPGameMode == null )
        return 
false;

    
int iCvarModesTog g_hCvarModesTog.IntValue;
    if( 
iCvarModesTog != )
    {
        
g_iCurrentMode 0;

        
int entity CreateEntityByName("info_gamemode");
        
DispatchSpawn(entity);
        
HookSingleEntityOutput(entity"OnCoop"OnGamemodetrue);
        
HookSingleEntityOutput(entity"OnSurvival"OnGamemodetrue);
        
HookSingleEntityOutput(entity"OnVersus"OnGamemodetrue);
        
HookSingleEntityOutput(entity"OnScavenge"OnGamemodetrue);
        
ActivateEntity(entity);
        
AcceptEntityInput(entity"PostSpawnActivate");
        
AcceptEntityInput(entity"Kill");

        if( 
g_iCurrentMode == )
            return 
false;

        if( !(
iCvarModesTog g_iCurrentMode) )
            return 
false;
    }

    
char sGameModes[64], sGameMode[64];
    
g_hCvarMPGameMode.GetString(sGameModesizeof(sGameMode));
    
Format(sGameModesizeof(sGameMode), ",%s,"sGameMode);

    
g_hCvarModes.GetString(sGameModessizeof(sGameModes));
    if( 
strcmp(sGameModes"") )
    {
        
Format(sGameModessizeof(sGameModes), ",%s,"sGameModes);
        if( 
StrContains(sGameModessGameModefalse) == -)
            return 
false;
    }

    
g_hCvarModesOff.GetString(sGameModessizeof(sGameModes));
    if( 
strcmp(sGameModes"") )
    {
        
Format(sGameModessizeof(sGameModes), ",%s,"sGameModes);
        if( 
StrContains(sGameModessGameModefalse) != -)
            return 
false;
    }

    return 
true;
}

public 
void OnGamemode(const char[] outputint callerint activatorfloat delay)
{
    if( 
strcmp(output"OnCoop") == )
        
g_iCurrentMode 1;
    else if( 
strcmp(output"OnSurvival") == )
        
g_iCurrentMode 2;
    else if( 
strcmp(output"OnVersus") == )
        
g_iCurrentMode 4;
    else if( 
strcmp(output"OnScavenge") == )
        
g_iCurrentMode 8;

Make sure to call it anytime after the round starts since it creates the info_gamemode entity and you'll get errors if you try to create it on OnMapStart or anything before configs are executed. I highly recommend checking out his plugins, like Mutant Zombies and Gun Cabinet since he calls the check on OnConfigsExecuted. A lot of his plugins contain code that not many users know about or tried before so maybe they can help you optimize your plugins.
Attached Files
File Type: sp Get Plugin or Get Source (acs.sp - 193 views - 64.3 KB)
File Type: sp Get Plugin or Get Source (l4d2_mission_manager.sp - 212 views - 33.8 KB)
__________________

Last edited by Psyk0tik; 07-06-2018 at 11:25.
Psyk0tik is offline
rikka0w0
Member
Join Date: May 2018
Location: Sydney, Australia / Beij
Old 07-06-2018 , 11:56   Re: [L4D2] Improved Automatic Campaign Switcher (ACS) [v1.9.0 (20180706)]
Reply With Quote #15

Quote:
Both .sp files failed to compile. The reason is that you didn't parenthesize the values that you were using the view_as operator for.
Which version of sourcemod are you using? I use 1.7 and it compiles without any warning or error. I probably should fix them.

For transforming the syntax, the thing I did is to remove things like : and decl, and change const Stringxx[] to const char[] xxx. I forget to add return/parameter types as required by the new syntax.

I'm really appreciate that you point out these problems
rikka0w0 is offline
Psyk0tik
Veteran Member
Join Date: May 2012
Location: Homeless
Old 07-06-2018 , 12:05   Re: [L4D2] Improved Automatic Campaign Switcher (ACS) [v1.9.0 (20180706)]
Reply With Quote #16

I use SM 1.8.0.6048 (latest stable build). I don't use the unstable builds.
__________________
Psyk0tik is offline
Lux
Veteran Member
Join Date: Jan 2015
Location: Cat
Old 07-06-2018 , 12:06   Re: [L4D2] Improved Automatic Campaign Switcher (ACS) [v1.9.0 (20180706)]
Reply With Quote #17

Quote:
Originally Posted by rikka0w0 View Post
Which version of sourcemod are you using? I use 1.7 and it compiles without any warning or error. I probably should fix them.

For transforming the syntax, the thing I did is to remove things like : and decl, and change const Stringxx[] to const char[] xxx. I forget to add return/parameter types as required by the new syntax.

I'm really appreciate that you point out these problems
Use 1.8 compiler 1.7 you can use View_as<> without the brackets which was not ment to be
__________________
Connect
My Plugins: KlickME
[My GitHub]

Commission me for L4D
Lux is offline
Mr. Man
Veteran Member
Join Date: Mar 2011
Location: Huh?
Old 07-06-2018 , 12:18   Re: [L4D2] Improved Automatic Campaign Switcher (ACS) [v1.9.0 (20180706)]
Reply With Quote #18

Quote:
Originally Posted by rikka0w0 View Post
"maps.phrases.txt" is used for localizing individual maps, e.g. c1m1_hotel to some human-readable name. If you don't want to localize them, it's completely fine. Create a file with the following content as the "maps.phrases.txt":
PHP Code:
"Phrases"
{


As a result, the maps will be shown as names like "c1m1_hotel".
To localize map names, your "maps.phrases.txt" should be something like:
PHP Code:
"Phrases"
{
    
"c1m1_hotel"
    
{
        
"en"        "Hotel"
    
}

Sorry I forgot to mention this in the intro.
I have done that but the ingame still isn't parsing the menu correctly. Is it something on my end?
Mr. Man is offline
rikka0w0
Member
Join Date: May 2018
Location: Sydney, Australia / Beij
Old 07-06-2018 , 12:35   Re: [L4D2] Improved Automatic Campaign Switcher (ACS) [v1.9.0 (20180706)]
Reply With Quote #19

Quote:
Originally Posted by Mr. Man View Post
I have done that but the ingame still isn't parsing the menu correctly. Is it something on my end?
1. Check: is there a "mission.cache" folder in "left4dead2" directory? ("left4dead2" also contains "addons" and "cfg" folder)
2. If you are using Linux, permission can cause trouble, so make sure that "mission.cache" is writable by the current user (the one you used to launch srcds). Try "chmod -R 777 mission.cache"
3. A screen shot might be helpful
rikka0w0 is offline
Mr. Man
Veteran Member
Join Date: Mar 2011
Location: Huh?
Old 07-06-2018 , 12:54   Re: [L4D2] Improved Automatic Campaign Switcher (ACS) [v1.9.0 (20180706)]
Reply With Quote #20

Quote:
Originally Posted by rikka0w0 View Post
1. Check: is there a "mission.cache" folder in "left4dead2" directory? ("left4dead2" also contains "addons" and "cfg" folder)
2. If you are using Linux, permission can cause trouble, so make sure that "mission.cache" is writable by the current user (the one you used to launch srcds). Try "chmod -R 777 mission.cache"
3. A screen shot might be helpful
No mission.cache file in the main directory. I'll get you a screenshot in a second. Here's what I see:


Last edited by Mr. Man; 07-06-2018 at 12:59.
Mr. Man 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 01:33.


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