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

[L4D1 & L4D2] Hostname - Display Map Name [v1.0.2 | 16-March-2021]


Post New Thread Reply   
 
Thread Tools Display Modes
Author
Marttt
Veteran Member
Join Date: Jan 2019
Location: Brazil
Plugin ID:
6749
Plugin Version:
1.0.2
Plugin Category:
Gameplay
Plugin Game:
Left 4 Dead
Plugin Dependencies:
    Servers with this Plugin:
    14 
    Plugin Description:
    Displays the specified map name in the hostname.
    Old 10-07-2019 , 21:07   [L4D1 & L4D2] Hostname - Display Map Name [v1.0.2 | 16-March-2021]
    Reply With Quote #1

    About

    I made this plugin because I usually access my favorite [L4D]/[L4D2] servers through the "openserverbrowser" console command and,
    despite knowing the dev name of the vanilla campaigns (c*m*), some customs maps don't follow this name pattern for its chapters,
    Also, the chapter name doesn't appear through the Steam Group servers list, or through the Friend List, only the map name is displayed,
    Making it difficult to identify which chapter the map is currently running.

    Description

    This plugin will add the map name to the hostname, based on a KeyValue file located at data folder.
    It was made mainly for [L4D]/[L4D2] game because the campaign (map-chapter) style, but should also work with other games.

    Example

    My hostname is "Mart Server" and I'm currently playing in the "c1m1" map.
    The name "Dead Center [1-5]" was added for the "c1m1" map at the KeyValue file.
    And the hostname format is set to {hostname} | {mapname}.
    When the plugin runs, it will turn my hostname into "Mart Server | Dead Center [1-5]"

    Cvars

    A configuration file named "hostname_mapdisplay.cfg" will automatically be created for you upon the first run in the "\cfg\sourcemod\" folder.

    PHP Code:
    // Enables/Disables the plugin. 0 = Plugin OFF, 1 = Plugin ON.
    // -
    // Default: "1"
    // Minimum: "0.000000"
    // Maximum: "1.000000"
    hostname_mapdisplay_enabled "1"

    // Display format.
    // Available tags: {hostname},{mapname},{gamemode},{GAMEMODE}
    // Note: If the "format" attribute is set in the KeyValue file located at data folder, this cvar will be ignored.
    // -
    // Default: "{hostname} | {GAMEMODE} | {mapname}"
    hostname_mapdisplay_format "{hostname} | {GAMEMODE} | {mapname}"

    // Hostname used by the {hostname} tag.
    // Note: If the "hostname" attribute is set in the KeyValue file located at data folder, this cvar will be ignored.
    // -
    // Default: "<your hostname>."
    hostname_mapdisplay_hostname "<your hostname>"

    // Enables/Disables the plugin when the map is not found in the KeyValue file located at data folder. 0 = OFF, 1 = ON (shows the map dev name).
    // -
    // Default: "0"
    // Minimum: "0.000000"
    // Maximum: "1.000000"
    hostname_mapdisplay_mapnotfound "0" 
    Admin Commands

    PHP Code:
    sm_hostname_mapdisplay_reload  // Reloads the hostname based on a KeyValue file located at data folder. (needs "z" flag).
    sm_print_cvars_hostname_mapdisplay // Prints the plugin related cvars and their respective values to the console. (needs "z" flag). 
    Change Log

    Spoiler


    Notes
    • This plugin isn't compatible with other plugins that also changes the hostname.
    • On the first run, the hostname_mapdisplay_hostname cvar will be filled with your current hostname.
    • If your hostname is large, the map name may truncate.
    • Seems that unicode characters don't load properly from ".cfg" files so if you want to have unicode characters in the hostname (e.g.: Simplified Chinese), use the configs in the KeyValue file located at data folder as a workaround instead of the ".cfg" file generated with the cvars of the plugin.
    • If any config from the "Host" section in the KeyValue file is set, the related cvar value will be ignored.

    To Do
    • Add a translation file.
    • Add more tags (player count/timeleft?).
    • Add support to customize gamemode tags. (e.g. Versus => Vs)

    Thank you!

    Related Plugins

    Post Reply
    • Any feedbacks, bug reports, fixes, improvements, translations or suggestions for the plugin are welcome.

    Installation
    • Put the "hostname_mapdisplay.txt" file in your "\addons\sourcemod\data\" folder. [Note: this file is currently based on some L4D2 maps]
    • Put the "hostname_mapdisplay.smx" file (click Get Plugin) in your "\addons\sourcemod\plugins\" folder.
    Attached Files
    File Type: txt hostname_mapdisplay.txt (17.3 KB, 272 views)
    File Type: sp Get Plugin or Get Source (hostname_mapdisplay.sp - 348 views - 15.2 KB)
    __________________

    Last edited by Marttt; 01-15-2023 at 20:32.
    Marttt is offline
    viaxiamu
    New Member
    Join Date: Jun 2016
    Old 11-15-2019 , 15:13   Re: [ANY] Hostname - Display Map Name
    Reply With Quote #2

    if set to Simplified Chinese, it will not be displayed. can fix??
    viaxiamu is offline
    Marttt
    Veteran Member
    Join Date: Jan 2019
    Location: Brazil
    Old 11-20-2019 , 19:44   Re: [ANY] Hostname - Display Map Name [v1.0.1 | 20-November-2019]
    Reply With Quote #3

    Thanks for the report viaxiamu,

    It seems that when a plugin try to read a Unicode character from the .cfg file, the cvar fails to read.
    I simulate that changing the "hostname" in the server .cfg and in my case it still didn't work.

    So I added a new config in the KeyValue (.txt) file where you can set the hostname. It shall work now.
    If you have any questions, PM me.
    __________________

    Last edited by Marttt; 11-21-2019 at 13:19.
    Marttt is offline
    MarcoCSGO
    Member
    Join Date: May 2020
    Old 05-04-2020 , 06:14   Re: [ANY] Hostname - Display Map Name [v1.0.1 | 20-November-2019]
    Reply With Quote #4

    This plugin does not work for CSGO right out of the box, small changes are required. Just wondering if you could update the plugin to skip game mode if it does not exist or use a manual mapping for CSGO?
    E.g.
    Aim_MAP = Aim
    MG_MAP = Multi Game

    Thank you.
    MarcoCSGO is offline
    TiTz
    Member
    Join Date: Jan 2020
    Old 05-05-2020 , 17:28   Re: [ANY] Hostname - Display Map Name [v1.0.1 | 20-November-2019]
    Reply With Quote #5

    Hi,

    Here's a L4D1 mapdisplay.txt save you a few hours work ... has a lot of maps - most popular ones....
    Attached Files
    File Type: txt hostname_mapdisplay.txt (12.0 KB, 415 views)
    TiTz is offline
    DARG367
    AlliedModders Donor
    Join Date: Aug 2018
    Old 03-11-2022 , 03:41   Re: [L4D1 & L4D2] Hostname - Display Map Name [v1.0.1 | 20-November-2019]
    Reply With Quote #6

    Based on Marttt's and TiTz's this one also includes the following...

    Wan Li, Day Break, Fall in Death, The Bloody Moors, Time to Die, SaltHell Park, Heaven Can Wait II, Whispers of Winter, Carried Off, Red Tide, Dead Center: Rebirth, Dead High School, The Grave Outdoors, Salvation Falls, Blood Woods APOCALYPSE 2, Crunch Time, Free Passage, Hopeless, Farewell Chenming, Big Wat, Blackout Basement, No Mercy Apocalypse, Crash Course Apocalypse, Death Toll Apocalypse, Blood Woods Apocalypse, Fatal Freight: Remastered, Gridlock, Dead Center - Christmas Edition, Lockdown DLC, Beldurra, Zengcheng, Freezing Point.

    I should also mention that "The Grave Outdoors" conflicts with "Dead Military 2". So you decide which one your server has and delete the other one.

    Edit 1: Added more campaigns
    Edit 2: Fixed some maps displaying the wrong number.
    Edit 3: Updated the list to only include tab indents not spaces.
    Attached Files
    File Type: txt hostname_mapdisplay.txt (32.5 KB, 149 views)

    Last edited by DARG367; 03-18-2022 at 19:04. Reason: Updated file
    DARG367 is offline
    Krufftys Killers
    Senior Member
    Join Date: Jan 2014
    Old 03-16-2022 , 00:03   Re: [L4D1 & L4D2] Hostname - Display Map Name [v1.0.1 | 20-November-2019]
    Reply With Quote #7

    Got his using sm_hostname_mapdisplay_print_cvars command

    L 03/15/2022 - 22:59:24: SourceMod error session started
    L 03/15/2022 - 22:59:24: Info (map "c1m1_hotel") (file "C:\servers\kruffty\left4dead2\addons\sourcem od\logs\errors_20220315.log")
    L 03/15/2022 - 22:59:24: [SM] Exception reported: Client index 0 is invalid
    L 03/15/2022 - 22:59:24: [SM] Blaming: hostname_mapdisplay.smx
    L 03/15/2022 - 22:59:24: [SM] Call stack trace:
    L 03/15/2022 - 22:59:24: [SM] [0] PrintToChat
    L 03/15/2022 - 22:59:24: [SM] [1] Line 211, hostname_mapdisplay.sp::AdmCmdReload
    Krufftys Killers is offline
    Marttt
    Veteran Member
    Join Date: Jan 2019
    Location: Brazil
    Old 03-16-2022 , 06:18   Re: [L4D1 & L4D2] Hostname - Display Map Name [v1.0.1 | 20-November-2019]
    Reply With Quote #8

    Thanks @Krufftys,

    I did this plugin a long time ago (one of the first ones)

    I gonna rewrite it when I have time, for now I updated with a fix for this exception.

    Code:
    1.0.2 (16-March-2021)
        - Fixed missing valid client check on reload command.
    __________________
    Marttt is offline
    Krufftys Killers
    Senior Member
    Join Date: Jan 2014
    Old 03-16-2022 , 06:54   Re: [L4D1 & L4D2] Hostname - Display Map Name [v1.0.2 | 16-March-2021]
    Reply With Quote #9

    @Marttt here is my hostname_mapdisplay text with 197 custom maps for the next update.
    Thanks for the fix.
    Attached Files
    File Type: txt hostname_mapdisplay.txt (60.0 KB, 169 views)

    Last edited by Krufftys Killers; 03-17-2022 at 08:10.
    Krufftys Killers is offline
    Krufftys Killers
    Senior Member
    Join Date: Jan 2014
    Old 03-16-2022 , 07:10   Re: [L4D1 & L4D2] Hostname - Display Map Name [v1.0.2 | 16-March-2021]
    Reply With Quote #10

    Marttt the fix is not working not reading hostname_mapdisplay text anymore and it's not making .cfg file anymore

    Last edited by Krufftys Killers; 03-16-2022 at 07:13.
    Krufftys Killers 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 11:48.


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