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

[L4D & L4D2] Map-based Configs


Post New Thread Reply   
 
Thread Tools Display Modes
Author
Chi_Nai
BANNED
Join Date: Apr 2018
Location: GB
Plugin ID:
6076
Plugin Version:
Plugin Category:
General Purpose
Plugin Game:
Left 4 Dead
Plugin Dependencies:
    Servers with this Plugin:
     
    Plugin Description:
    Allows for custom settings for each map
    Old 04-04-2018 , 07:15   [L4D & L4D2] Map-based Configs
    Reply With Quote #1

    I am sorry, my english is poor

    Individually set cvar and plug-in instructions for each level

    Can add cvar and other plug-in instructions in cfg

    Add custom maps to map_cvars

    Convars Configs File:
    \left4dead2\cfg

    thank Crasher_3637

    Provide me better code
    Attached Files
    File Type: 7z cfg.7z (1.3 KB, 995 views)
    File Type: sp Get Plugin or Get Source (map-based_configs.sp - 1910 views - 663 Bytes)

    Last edited by Chi_Nai; 04-05-2018 at 04:10.
    Chi_Nai is offline
    Send a message via ICQ to Chi_Nai Send a message via AIM to Chi_Nai Send a message via Yahoo to Chi_Nai Send a message via Skype™ to Chi_Nai
    Mi.Cura
    Veteran Member
    Join Date: Dec 2016
    Location: Brazil
    Old 04-04-2018 , 14:08   Re: [L4D2]Level Difficulty Edit
    Reply With Quote #2

    it would be better if it were cvar configurations for each type of difficulty:
    ( would suit any campaign, including custom )

    easy (cfg) / normal (cfg)/ advanced (cfg)/ expert (cfg).

    But for each MAP..., why?

    Last edited by Mi.Cura; 04-05-2018 at 12:57.
    Mi.Cura is offline
    Psyk0tik
    Veteran Member
    Join Date: May 2012
    Location: Homeless
    Old 04-04-2018 , 16:54   Re: [L4D2]Level Difficulty Edit
    Reply With Quote #3

    Why not just code it to where a config is executed based on the map name instead of hard-coding all the official maps?

    PHP Code:
    public void OnAutoConfigsBuffered()
    {
        
    char sMapConfig[128];
        
    GetCurrentMap(sMapConfigsizeof(sMapConfig));
        
    Format(sMapConfigsizeof(sMapConfig), "cfg/sourcemod/map_cvars/%s.cfg"sMapConfig);
        if (
    FileExists(sMapConfigtrue))
        {
            
    strcopy(sMapConfigsizeof(sMapConfig), sMapConfig[4]);
            
    ServerCommand("exec \"%s\""sMapConfig);
        }

    If you have a .cfg file in left4dead2/cfg/sourcemod/map_cvars called "c1m1_hotel.cfg" then that config will be executed when you switch to the c1m1_hotel map. It's a lot easier and shorter than what you have now, and it works with custom maps as well.
    __________________

    Last edited by Psyk0tik; 04-04-2018 at 18:15.
    Psyk0tik is offline
    Chi_Nai
    BANNED
    Join Date: Apr 2018
    Location: GB
    Old 04-04-2018 , 20:55   Re: [L4D2]Level Difficulty Edit
    Reply With Quote #4

    Quote:
    Originally Posted by Crasher_3637 View Post
    Why not just code it to where a config is executed based on the map name instead of hard-coding all the official maps?

    PHP Code:
    public void OnAutoConfigsBuffered()
    {
        
    char sMapConfig[128];
        
    GetCurrentMap(sMapConfigsizeof(sMapConfig));
        
    Format(sMapConfigsizeof(sMapConfig), "cfg/sourcemod/map_cvars/%s.cfg"sMapConfig);
        if (
    FileExists(sMapConfigtrue))
        {
            
    strcopy(sMapConfigsizeof(sMapConfig), sMapConfig[4]);
            
    ServerCommand("exec \"%s\""sMapConfig);
        }

    If you have a .cfg file in left4dead2/cfg/sourcemod/map_cvars called "c1m1_hotel.cfg" then that config will be executed when you switch to the c1m1_hotel map. It's a lot easier and shorter than what you have now, and it works with custom maps as well.

    Thanks This is a very early completion of the plugin Can I borrow your code Modify this plugin?
    Chi_Nai is offline
    Send a message via ICQ to Chi_Nai Send a message via AIM to Chi_Nai Send a message via Yahoo to Chi_Nai Send a message via Skype™ to Chi_Nai
    Psyk0tik
    Veteran Member
    Join Date: May 2012
    Location: Homeless
    Old 04-04-2018 , 21:18   Re: [L4D2]Level Difficulty Edit
    Reply With Quote #5

    Quote:
    Originally Posted by Chi_Nai View Post
    Thanks This is a very early completion of the plugin Can I borrow your code Modify this plugin?
    Sure! That code is all you really need to let end-users create .cfg files for each map, including custom maps.
    __________________
    Psyk0tik is offline
    Psyk0tik
    Veteran Member
    Join Date: May 2012
    Location: Homeless
    Old 04-05-2018 , 02:44   Re: [L4D2]Level Difficulty Edit
    Reply With Quote #6

    I looked at the source code of the latest version of your plugin and decided to fix it up for you by adding information about the plugin. This is how it looks:

    PHP Code:
    #include <sourcemod>
    #pragma semicolon 1
    #pragma newdecls required

    public Plugin myinfo =
    {
        
    name "[L4D & L4D2] Map-based Configs",
        
    author "Chi_Nai",
        
    version "1.2",
        
    description "Allows for custom settings for each map.",
        
    url "https://forums.alliedmods.net/showthread.php?t=306525"
    };

    public 
    void OnAutoConfigsBuffered()
    {
        
    char sMapConfig[128];
        
    GetCurrentMap(sMapConfigsizeof(sMapConfig));
        
    Format(sMapConfigsizeof(sMapConfig), "cfg/sourcemod/map_cvars/%s.cfg"sMapConfig);
        if (
    FileExists(sMapConfigtrue))
        {
            
    strcopy(sMapConfigsizeof(sMapConfig), sMapConfig[4]);
            
    ServerCommand("exec \"%s\""sMapConfig);
        }

    Attached Files
    File Type: sp Get Plugin or Get Source (map-based_configs.sp - 1309 views - 663 Bytes)
    __________________

    Last edited by Psyk0tik; 04-05-2018 at 02:56.
    Psyk0tik is offline
    Chi_Nai
    BANNED
    Join Date: Apr 2018
    Location: GB
    Old 04-05-2018 , 04:11   Re: [L4D2]Level Difficulty Edit
    Reply With Quote #7

    Quote:
    Originally Posted by Crasher_3637 View Post
    I looked at the source code of the latest version of your plugin and decided to fix it up for you by adding information about the plugin. This is how it looks:

    PHP Code:
    #include <sourcemod>
    #pragma semicolon 1
    #pragma newdecls required

    public Plugin myinfo =
    {
        
    name "[L4D & L4D2] Map-based Configs",
        
    author "Chi_Nai",
        
    version "1.2",
        
    description "Allows for custom settings for each map.",
        
    url "https://forums.alliedmods.net/showthread.php?t=306525"
    };

    public 
    void OnAutoConfigsBuffered()
    {
        
    char sMapConfig[128];
        
    GetCurrentMap(sMapConfigsizeof(sMapConfig));
        
    Format(sMapConfigsizeof(sMapConfig), "cfg/sourcemod/map_cvars/%s.cfg"sMapConfig);
        if (
    FileExists(sMapConfigtrue))
        {
            
    strcopy(sMapConfigsizeof(sMapConfig), sMapConfig[4]);
            
    ServerCommand("exec \"%s\""sMapConfig);
        }


    Thank you for updating
    Chi_Nai is offline
    Send a message via ICQ to Chi_Nai Send a message via AIM to Chi_Nai Send a message via Yahoo to Chi_Nai Send a message via Skype™ to Chi_Nai
    Lux
    Veteran Member
    Join Date: Jan 2015
    Location: Cat
    Old 04-05-2018 , 04:23   Re: [L4D & L4D2] Map-based Configs
    Reply With Quote #8

    This already exists here https://forums.alliedmods.net/showthread.php?p=760501

    however you could tailor it to l4d only with configs on special infected speed, health, bla bla lots of stuff
    __________________
    Connect
    My Plugins: KlickME
    [My GitHub]

    Commission me for L4D
    Lux is offline
    phoenix0001
    Senior Member
    Join Date: Apr 2010
    Location: China
    Old 04-05-2018 , 18:02   Re: [L4D & L4D2] Map-based Configs
    Reply With Quote #9

    How to disable a plugin?
    E.g:
    Plugin name aaa.smx
    Enable aaa.smx in C1M1, C1M2, C1M4
    Disabling aaa.smx in C1M3
    __________________
    I like this BBS sharing of spirit

    I come from China, my English is poor
    phoenix0001 is offline
    Chi_Nai
    BANNED
    Join Date: Apr 2018
    Location: GB
    Old 04-05-2018 , 19:11   Re: [L4D & L4D2] Map-based Configs
    Reply With Quote #10

    Quote:
    Originally Posted by phoenix0001 View Post
    How to disable a plugin?
    E.g:
    Plugin name aaa.smx
    Enable aaa.smx in C1M1, C1M2, C1M4
    Disabling aaa.smx in C1M3
    刪除C1M3.cfg 或是cfg裡不填入任何指令
    Chi_Nai is offline
    Send a message via ICQ to Chi_Nai Send a message via AIM to Chi_Nai Send a message via Yahoo to Chi_Nai Send a message via Skype™ to Chi_Nai
    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 11:36.


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