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

[L4D] Force Mission Changer 1.4.0


Post New Thread Reply   
 
Thread Tools Display Modes
Author
Dionys
Senior Member
Join Date: Sep 2008
Location: Terra, Russia
Plugin ID:
675
Plugin Version:
1.4.0
Plugin Category:
Server Management
Plugin Game:
Left 4 Dead
Plugin Dependencies:
    Servers with this Plugin:
    343 
    Plugin Description:
    Old 12-14-2008 , 15:33   [L4D] Force Mission Changer 1.4.0
    Reply With Quote #1

    The plug-in compulsorily changes mission on following (according to options). At change of mission players automatically pass to new mission.
    It working for all L4D mission (according to options).
    Before install [L4D] Force Mission Changer move the NEXTMAP.SMX to the disabled folder.

    CHANGELOG
    v1.4.0 (2009.10.20):
    New plugin and config name sm_l4d_mapchanger (old sm_l4dvs_mapchanger.smx will be automatically deleted)
    Hook change gamemode event and autoload mission list for new gamemode on the server
    Add support sm_l4dco_mapchanger.txt and sm_l4dvs_mapchanger.txt for coop and versus gamemodes
    Plugin stop activity if discovered survival gamemode and wait for change gamemode to coop or versus or change map
    v1.3.6 (2009.10.17):
    Fix autoloading of a following map bug
    Fix custom settings for versus map bug
    v1.3.5 (2009.09.10):
    Add autoloading of a following map of the list if the server has become empty
    v1.3.4:
    Any critical bugs fixes (thx Red Alex)
    v1.3.2 (2009.07.13):
    Add support of wrong custom versus map
    Add server commands:
    sm_l4d_fmc_crec_add - Add custom value sm_l4d_fmc_crec for the specified map. Max 50.
    Use: sm_l4d_fmc_crec_add <existing custom map> <custom sm_l4d_fmc_crec integer value (max 99)> <custom sm_l4d_fmc_re_timer_block float value>
    sm_l4d_fmc_crec_clear - Clear all custom value sm_l4d_fmc_crec.
    sm_l4d_fmc_crec_list - Show all custom value sm_l4d_fmc_crec.
    Manual set next mission name in sm_l4dvs_mapchanger.txt
    Add displays and log team winner index at round_end in debug mode
    v1.3.2 (2009.04.26):
    Fix mission announce bug
    Add cvar sm_l4d_fmc_dbug write event log to file
    Add cvar sm_l4d_fmc_re_timer_block block double event round_end
    v1.3.1 (2009.04.24)
    Ready for L4D version 1.0.1.2
    v1.2 (2009-04-01):
    at change mission delay timers is added
    v1.1 (2009-02-22):
    removed cvar sm_l4d_fmc_gmode (autodetect gamemode now).
    v1.03 (2008-12-21):
    new sm_l4dvs_mapchanger.txt - support all l4d gamemode.
    v1.03:
    Choice possibility is added - whether mission will change if all players were lost on a final map.
    new cvar is added.
    v1.02:
    Support coop mode is added (if it is used in a coop mode - players pass in the following mission without display of results).
    new cvar is added.
    [L4D] Force Mission Changer v1.0:
    Possibility to set a missions cycle in a options file is added.

    CVAR
    sm_l4d_fmc_version - Version of L4D Force Mission Changer plugin.
    sm_l4d_fmc - Enables Force changelevel when mission end.
    sm_l4d_fmc_ifdie - Enables Force changelevel when all player die on final map in coop gamemode.
    sm_l4d_fmc_crec - Quantity of events RoundEnd before force of changelevel for versus mode (def - 8. don't change it!).
    sm_l4d_fmc_def - Mission for change by default.
    sm_l4d_fmc_chdelayvs - Delay before versus mission change in sec.
    sm_l4d_fmc_chdelaycoop - Delay before coop mission change in sec.
    sm_l4d_fmc_re_timer_block - time block double event round_end in sec.
    sm_l4d_fmc_announce - Enables next mission to advertise to players.
    sm_l4d_fmc_dbug - write event log to file

    Server commands
    sm_l4d_fmc_crec_add - Add custom value sm_l4d_fmc_crec and sm_l4d_fmc_re_timer_block for the specified map. Max 50.
    sm_l4d_fmc_crec_clear - Clear all custom value sm_l4d_fmc_crec and sm_l4d_fmc_re_timer_block.
    sm_l4d_fmc_crec_list - Show all custom value sm_l4d_fmc_crec and sm_l4d_fmc_re_timer_block.

    All variables are appointed in a file .\cfg\sourcemod\sm_l4d_mapchanger.cfg
    The cycle of missions is adjusted in a file .\addons\sourcemod\data\sm_l4dvs_mapchanger.t xt and .\addons\sourcemod\data\sm_l4dco_mapchanger.t xt

    An example:
    Code:
    "ForceMissionChangerSettings"
    {
        "l4d_*current_mission_end_map*"
        {
            "next mission map" "l4d_*next_mission_map*"
            "next mission name" "*Next Mission*"
        }
    ...
    }
    If the current map is found in a file of options sm_l4dvs_mapchanger.txt, but the map of the following mission is specified incorrectly - the server will replace mission with a map specified in a variable sm_l4d_fmc_def.

    special thx:
    - DDR Khat

    - Red Alex

    warning: Use as is. There is a desire to change code - make it - I not against. In a this topic I ask to write only about the found errors.
    Attached Files
    File Type: txt sm_l4dco_mapchanger.txt (617 Bytes, 5239 views)
    File Type: txt sm_l4dvs_mapchanger.txt (640 Bytes, 5081 views)
    File Type: cfg sm_l4d_mapchanger.cfg (943 Bytes, 5251 views)
    File Type: sp Get Plugin or Get Source (sm_l4d_mapchanger.sp - 13908 views - 15.3 KB)
    File Type: zip Force Mission Changer (l4d) 1.4.0.zip (15.2 KB, 9605 views)

    Last edited by Dionys; 10-20-2009 at 16:02.
    Dionys is offline
    Antithasys
    Moderator
    Join Date: Apr 2008
    Old 12-14-2008 , 16:07   Re: [L4D] Force mapchanger
    Reply With Quote #2

    .rar file types are not permitted. Please upload the plugin as the .sp file.

    If it must be compressed the following formats are approved:

    zip, tar, bz2, or gz
    __________________
    [my plugins]

    When you think about asking a question... consider what have you tried?
    Antithasys is offline
    Sammy-ROCK!
    Senior Member
    Join Date: Jun 2008
    Location: Near Mrs.Lag
    Old 12-14-2008 , 19:07   Re: [L4D] Force mapchanger
    Reply With Quote #3

    Why don't you try:
    Code:
    #pragma semicolon 1
    #include <sourcemod>
    #define Version "0.1"
    new Handle:Allowed = INVALID_HANDLE;
    new RoundEndCounter = 0;
    new MaxPlayers = 0;
    new String:Map[64];
    
    public Plugin:myinfo = 
    {
        name = "L4D Auto Map Changer",
        author = "Dionys",
        description = "Force changelevel when mission end (For Farm VS and Hospital VS).",
        version = Version,
        url = "[email protected]"
    };
    
    public OnPluginStart()
    {
        decl String:ModName[50];
        GetGameFolderName(ModName, sizeof(ModName));
        if(!StrEqual(ModName, "left4dead", false))
            SetFailState("Use this for Left 4 Dead only.");
        HookEvent("round_end", Event_RoundEnd);
        Allowed = CreateConVar("sm_l4dvs_mapchangeforce", "1", "Enables Force changelevel when mission end.");
        AutoExecConfig(true, "sm_l4dvs_mapchanger");
    }
    
    public OnMapStart()
    {
        RoundEndCounter = 0;
        MaxPlayers = GetMaxClients();
        GetCurrentMap(Map, sizeof(Map));
    }
    
    stock ChangeMap(String:NextMap[])
    {
        for(new player=1; player<=MaxPlayers; player++)
        {
            if(IsClientInGame(player) && IsFakeClient(player))
                KickClient(player);
        }
        ServerCommand("changelevel %s", NextMap);
    }
    
    public Action:Event_RoundEnd(Handle:event, const String:name[], bool:dontBroadcast)
    {
        RoundEndCounter += 1; //What if admin enables at last second?
        if(GetConVarInt(Allowed) && RoundEndCounter >= 4)
        {
            if(StrEqual(Map, "l4d_vs_farm05_cornfield"))
                ChangeMap("l4d_vs_hospital01_apartment");
            else if(StrEqual(Map, "l4d_vs_hospital05_rooftop"))
                ChangeMap("l4d_vs_farm01_hilltop");
        }
    }
    I suggest you read http://wiki.alliedmods.net/Optimizing_Plugins_(SourceMod_Scripting)
    PM me for any questions.

    Last edited by Sammy-ROCK!; 12-14-2008 at 19:09.
    Sammy-ROCK! is offline
    Sammy-ROCK!
    Senior Member
    Join Date: Jun 2008
    Location: Near Mrs.Lag
    Old 12-14-2008 , 19:10   Re: [L4D] Force mapchanger
    Reply With Quote #4

    Also I already tried something similar but it makes bugs in l4d. The next canpaign won't leave 1st stage (Unless they fixed).
    Sammy-ROCK! is offline
    Dionys
    Senior Member
    Join Date: Sep 2008
    Location: Terra, Russia
    Old 12-14-2008 , 19:42   Re: [L4D] Force mapchanger
    Reply With Quote #5

    Quote:
    Originally Posted by Sammy-ROCK! View Post
    I suggest you read http://wiki.alliedmods.net/Optimizing_Plugins_(SourceMod_Scripting)
    PM me for any questions.
    I use the knowledge php with the minimum specificity sourcemod. The size of my free time does not allow to study foreign specificity deeply. The plug-in works - is the purpose.

    Quote:
    Originally Posted by Sammy-ROCK! View Post
    Also I already tried something similar but it makes bugs in l4d. The next canpaign won't leave 1st stage (Unless they fixed).
    My plug-in perfectly works and does not allow to a server to lag or crash at any quantity of cycles of mission normally vary.
    Dionys is offline
    Dionys
    Senior Member
    Join Date: Sep 2008
    Location: Terra, Russia
    Old 12-14-2008 , 20:20   Re: [L4D] Force mapchanger
    Reply With Quote #6

    Quote:
    Originally Posted by Sammy-ROCK! View Post
    PM me for any questions.
    I use your offer
    The HELP is necessary
    Dionys is offline
    Sammy-ROCK!
    Senior Member
    Join Date: Jun 2008
    Location: Near Mrs.Lag
    Old 12-14-2008 , 21:49   Re: [L4D] Force mapchanger
    Reply With Quote #7

    I'll show you why I linked you to optimizations page.
    Code:
    public Action:Event_RoundEnd(Handle:event, const String:name[], bool:dontBroadcast)
    {
        if(GetConVarInt(Allowed))
        {
            decl String:currentMap[64];
            GetCurrentMap(currentMap, 64); //Why get map name everytime a roundend is called? Simply get once on mapstart and your done.
    
            if (StrEqual(currentMap, "l4d_vs_farm05_cornfield") == true || StrEqual(currentMap, "l4d_vs_hospital05_rooftop") == true)
            {
                RoundEndCounter += 1;
    
                if (RoundEndCounter == 4 && StrEqual(currentMap, "l4d_vs_farm05_cornfield") == true) //Didn't we already check if we were on this map?
                {
                    for (new player=1; player<=GetMaxClients(); player++) //Here you'll be using GetMaxClients() for each loop we do. If server has 16 slots GetMaxClients() will be called 16 times without a need.
                    {
                        if (IsClientInGame(player) && IsFakeClient(player))
                        {
                            ServerCommand("kick %s", player); //We got a command for this: KickClient
                        }
                    }
    
                    ServerCommand("changelevel %s", "l4d_vs_hospital01_apartment"); //Why are you using %s if your setting it in core not by variable?
                }
                if (RoundEndCounter == 4 && StrEqual(currentMap, "l4d_vs_hospital05_rooftop") == true) //Again we already checked the map and if the code above matched this is a waste. Also 2nd time we check RoundEndCounter
                {
                    for (new player=1; player<=GetMaxClients(); player++)
                    {
                        if (IsClientInGame(player) && IsFakeClient(player))
                        {
                            ServerCommand("kick %s", player);
                        }
                    }
    
                    ServerCommand("changelevel %s", "l4d_vs_farm01_hilltop");
                }
            }
        }
    }
    About a realtime game we have to make it as smother as possible. The cpu your wasting could be used to make server run smother. Also if every plugin we make we waste cpu if we stick them in a server we have lag. The lag is not necessary because of 1 single plugin not optimized.

    Also I answered the thread you sent.
    Sammy-ROCK! is offline
    Dionys
    Senior Member
    Join Date: Sep 2008
    Location: Terra, Russia
    Old 12-14-2008 , 22:06   Re: [L4D] Force mapchanger
    Reply With Quote #8

    What optimisation?
    That will faster work: the direct command to server [ServerCommand ("kick %s", player);] [ServerCommand ("changelevel %s", "l4d_vs_farm01_hilltop");] or function which sourcemod should process [KickClient (player);] [ChangeMap ("l4d_vs_farm01_hilltop");]?
    Dionys is offline
    DontWannaName
    Veteran Member
    Join Date: Jun 2007
    Location: VALVe Land, WA
    Old 12-15-2008 , 02:27   Re: [L4D] Force mapchanger
    Reply With Quote #9

    Hey im running 62 plugins on a 32 slot server and not one of them makes me lag. If I were to add 1 bad one, it could screw me up and all 62 of my plugins. Just an example.
    __________________

    DontWannaName is offline
    Sammy-ROCK!
    Senior Member
    Join Date: Jun 2008
    Location: Near Mrs.Lag
    Old 12-15-2008 , 06:48   Re: [L4D] Force mapchanger
    Reply With Quote #10

    If you wanna keep with bad coding have fun. I personaly don't care was just trying to help you make better plugins. Also you should think on what the sourcemod function would process instead of ignoring and doing it by anyway.
    Sammy-ROCK! is offline
    Reply


    Thread Tools
    Display Modes

    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 09:10.


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