Raised This Month: $27 Target: $400
 6% 

[L4D & L4D2] Set Server Name


Post New Thread Reply   
 
Thread Tools Display Modes
Author
MoRanYue
Member
Join Date: Dec 2024
Location: Fuzhou, Fujian, China
Plugin ID:
8899
Plugin Version:
1.0.2
Plugin Category:
Server Management
Plugin Game:
Left 4 Dead
Plugin Dependencies:
    Servers with this Plugin:
    24 
    Plugin Description:
    Set the server name with format text and add UTF-8 characters.
    Old 02-13-2025 , 00:54   [L4D & L4D2] Set Server Name
    Reply With Quote #1

    Description:

    A lot of server owners set their server name with their own language, but SRCDS console does not like direct UTF-8 characters.

    I found 2 snippets of source code, one allows users to hard-encode their server name and the other allows users to write theirs in a file. However, this plugin have more general method: similar to Minecraft servers, allows Unicode code points in server name.

    To use this plugin, what you need to do is CVar ssn_host_name. You need some tools to convert the characters that SRCDS console does not accept (Chinese, Japanese, Korean and so on) to code points. (For eample, the code points of "求生之路" (Chinese translation of "Left 4 Dead") are "\u6c42\u751f\u4e4b\u8def"), the plugin will convert the code points in that CVar to actual character.
    By the way, you can add text "{id}" to CVar ssn_host_name, if you set up multiple servers on the same machine and their ports are continuous, with ssn_first_port, you can easily get incrementing server number.

    Installation:
    1. Download set_server_name.smx below and put it in your servers /addons/sourcemod/plugins/.
    2. Start your server and edit cfg/sourcemod/set_server_name.cfg.

    CVars:

    PHP Code:
    // 0 will disable the plugin, other number will enable it.
    ssn_is_enabled "1"

    // It affects {id} format item. {id} = 'ssn_first_id + hostport - ssn_first_port'.
    ssn_first_port "27015"

    // It affects {id} format item. {id} = 'ssn_first_id + hostport - ssn_first_port'.
    ssn_first_id "1"

    // Server name format string. {id} = Server number
    ssn_host_name "Left 4 Dead 2 Server" 
    Attached Files
    File Type: smx set_server_name.smx (5.0 KB, 16 views)
    File Type: sp Get Plugin or Get Source (set_server_name.sp - 27 views - 4.7 KB)
    __________________
    Hello! Were you happy today?

    I'm just new to Sourcemodding, and just creating plugins and addons for L4D2.
    Contact links: Steam | GitHub | Email
    Some plugins: New Left 4 Chat 2

    Last edited by MoRanYue; 04-03-2025 at 22:01. Reason: Memory optimization and more safety check
    MoRanYue is offline
    BloodyBlade
    Senior Member
    Join Date: Feb 2018
    Old 02-14-2025 , 14:50   Re: [L4D & L4D2] Set Server Name
    Reply With Quote #2

    UTF without BOM. No, haven't you heard? Use NotePad++ to edit the server.cfg and save it in UTF encoding without BOM and there will be no problem.
    BloodyBlade is offline
    MoRanYue
    Member
    Join Date: Dec 2024
    Location: Fuzhou, Fujian, China
    Old 02-15-2025 , 22:16   Re: [L4D & L4D2] Set Server Name
    Reply With Quote #3

    Quote:
    Originally Posted by BloodyBlade View Post
    UTF without BOM. No, haven't you heard? Use NotePad++ to edit the server.cfg and save it in UTF encoding without BOM and there will be no problem.
    I have never known it, but that seems not to work after my attempt.

    The CFG file executed:
    Code:
    hostname "求生之路"
    __________________
    Hello! Were you happy today?

    I'm just new to Sourcemodding, and just creating plugins and addons for L4D2.
    Contact links: Steam | GitHub | Email
    Some plugins: New Left 4 Chat 2

    Last edited by MoRanYue; 02-15-2025 at 22:16.
    MoRanYue is offline
    z282846139
    Member
    Join Date: Aug 2018
    Old 03-09-2025 , 05:46   Re: [L4D & L4D2] Set Server Name
    Reply With Quote #4

    大佬好东西,赞
    z282846139 is offline
    MoRanYue
    Member
    Join Date: Dec 2024
    Location: Fuzhou, Fujian, China
    Old 03-26-2025 , 13:13   Version 1.0.1
    Reply With Quote #5

    Code:
    1.0.1 (2025-Mar-27)
    - Minor memory optimization.
    - Added more string safety check to avoid possible "out of bound" error.
    __________________
    Hello! Were you happy today?

    I'm just new to Sourcemodding, and just creating plugins and addons for L4D2.
    Contact links: Steam | GitHub | Email
    Some plugins: New Left 4 Chat 2
    MoRanYue is offline
    MoRanYue
    Member
    Join Date: Dec 2024
    Location: Fuzhou, Fujian, China
    Old 04-03-2025 , 22:00   Version 1.0.2
    Reply With Quote #6

    Now that I have rented a server, a new CVar has been added.

    Code:
    1.0.2 (2025-Apr-4)
    - Added CVars: ssn_first_id
    __________________
    Hello! Were you happy today?

    I'm just new to Sourcemodding, and just creating plugins and addons for L4D2.
    Contact links: Steam | GitHub | Email
    Some plugins: New Left 4 Chat 2
    MoRanYue 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 22:18.


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