Raised This Month: $23 Target: $400
 5% 

[L4D2] pcsWelcome Message (1.23)


Post New Thread Reply   
 
Thread Tools Display Modes
Author
ball2hi
Senior Member
Join Date: Feb 2010
Plugin ID:
8714
Plugin Version:
Plugin Category:
General Purpose
Plugin Game:
Left 4 Dead
Plugin Dependencies:
    Servers with this Plugin:
     
    Plugin Description:
    Uses hook event 'player_team' to determine fully-loaded players, and display a message.
    Old 06-16-2024 , 16:02   [L4D2] pcsWelcome Message (1.23)
    Reply With Quote #1

    Description
    This plugin uses HookEvent("player_team") and grabs their new (and old) team. If their team is 0, they aren't fully-loaded. If their team is 1, they are loaded but haven't been assigned a team yet because other players are still loading (or are about to be assigned a team). Once players have been assigned to team 2 (survivors) or team 3 (infected), they are fully past the loading screen and can see chat. This plugin then displays a message to them. This plugin should be compatible with competitive L4D2 servers as well.

    By default, this prints 2 messages to each player individual, translated to their language provided in the phrases file. You also have an option to make it print every map, or just on the very first time they connect to the server. Once they disconnect, they'll see the welcome message again.

    An autoexec is created in cfg/sourcemod for this plugin.

    Cvars
    • pcs_everymap "1" // Whether to print every map.
    • pcs_lines "2" // How many lines to print.
    • pcs_finalmsg "1" // Should we print a final message?
    • pcs_lines_final "2" // How many lines to print for final message?

    Other plugins use things like player_connect, player_spawn, or OnClientPutInServer(), etc. Some of these fire multiple times in L4D2 especially during map changes, and don't cover the initial time everyone is loading in from a lobby where load times and connections vary. As well, things like OnClientPutInServer() will fire before a client finishes loading.

    Compiling

    In order to compile, you will need colors.inc ->
    https://forums.alliedmods.net/showthread.php?t=96831

    Installation

    You don't need to mess with any of the code to change the messages in the translation files.
    pcsWelcome.smx -> addons/sourcemod/plugins
    pcswelcome.phrases.txt -> addons/sourcemod/translations

    Changelog:
    Code:
    1.23 (July 18th - 2024)
       - Fixed and reworked Event_PlayerQuit to stop making errors. Working on trying to find a better way to detect Player vs Player modes.
    
    1.22 (July 18th - 2024)
       - I'm a dumb dumb. I was grabbing userid in Event_VehicleLeave and Event_VersusFinished. Instead, switched to CPrintToChatAll. SHOULD be auto-translated, based on colors.inc coding.
    
    1.21 (July 17th - 2024)
       - Added some validity checks in PlayerQuit, Event_VehicleLeave, and Event_VersusFinished to prevent client 0 errors.
    
    1.2 (July 16th - 2024)
       - Added cvars and code related to sending a "final message" to the players. Using "versus_match_finished" and "finale_vehicle_leaving".
    
    1.1 (July 16th - 2024)
       - Used ArrayList and user's SteamAuth to check if they were connected. Prior design caused mismatches for "pcs_everymap" "0".
    
    1.0 (July 16th - 2024)
       - Initial release.
    Additional
    This is a very simple plugin. While I plan to add to it, the whole point of it is for others to build on it and tailor it to their own liking. You can increase the amount of lines by changing a few things in a few places easily. The plugin also should work for Left4Dead1, but I do not have a server setup to test these so if you want you can remove the public APLRes AskPluginLoad2 at the top to let it load.
    Attached Files
    File Type: txt pcswelcome.phrases.txt (910 Bytes, 44 views)
    File Type: smx pcsWelcome.smx (8.2 KB, 19 views)
    File Type: sp Get Plugin or Get Source (pcsWelcome.sp - 19 views - 4.8 KB)

    Last edited by ball2hi; 06-18-2024 at 14:14.
    ball2hi is offline
    sonic155
    Senior Member
    Join Date: Mar 2019
    Old 06-16-2024 , 16:04   Re: [L4D2] pcsWelcome Message
    Reply With Quote #2

    no sp
    no plugin
    no Translation
    sonic155 is offline
    ball2hi
    Senior Member
    Join Date: Feb 2010
    Old 06-16-2024 , 16:10   Re: [L4D2] pcsWelcome Message
    Reply With Quote #3

    Quote:
    Originally Posted by sonic155 View Post
    no sp
    no plugin
    no Translation
    I noticed as soon as I submitted. I've edited the post and uploaded them immediately. Having issues with the website being slow for me at the moment.
    ball2hi is offline
    liquidplasma
    Member
    Join Date: May 2023
    Old 06-16-2024 , 22:52   Re: [L4D2] pcsWelcome Message (1.1)
    Reply With Quote #4

    does colors work for L4D2?
    liquidplasma is offline
    ball2hi
    Senior Member
    Join Date: Feb 2010
    Old 06-17-2024 , 01:23   Re: [L4D2] pcsWelcome Message (1.1)
    Reply With Quote #5

    Quote:
    Originally Posted by liquidplasma View Post
    does colors work for L4D2?
    It's been working for me on my servers with CPrintToChat.
    ball2hi is offline
    Bluetool
    Junior Member
    Join Date: Jul 2016
    Location: South Korea
    Old 06-17-2024 , 09:26   Re: [L4D2] pcsWelcome Message (1.1)
    Reply With Quote #6

    Quote:
    Originally Posted by ball2hi View Post
    It's been working for me on my servers with CPrintToChat.
    only few colors are working in l4d2. does color.inc supports other colors in l4d2? (Purple, Pink etc.)

    Current Color works in l4d2:

    Default
    Grey(Spectator)
    Blue(Survivors)
    Red(Infected)
    Olive(Achievement)
    Orange
    Lightgreen
    Bluetool is offline
    ball2hi
    Senior Member
    Join Date: Feb 2010
    Old 06-17-2024 , 12:02   Re: [L4D2] pcsWelcome Message (1.1)
    Reply With Quote #7

    Quote:
    Originally Posted by Bluetool View Post
    only few colors are working in l4d2. does color.inc supports other colors in l4d2? (Purple, Pink etc.)

    Current Color works in l4d2:

    Default
    Grey(Spectator)
    Blue(Survivors)
    Red(Infected)
    Olive(Achievement)
    Orange
    Lightgreen
    I don't think I've seen purple or pink. Someone would probably have to test all the colors. I think someone somewhere already has, but I don't remember.
    ball2hi is offline
    JustMadMan
    Member
    Join Date: Feb 2023
    Old 06-17-2024 , 15:57   Re: [L4D2] pcsWelcome Message (1.1)
    Reply With Quote #8

    Quote:
    Originally Posted by Bluetool View Post
    only few colors are working in l4d2. does color.inc supports other colors in l4d2? (Purple, Pink etc.)

    Current Color works in l4d2:

    Default
    Grey(Spectator)
    Blue(Survivors)
    Red(Infected)
    Olive(Achievement)
    Orange
    Lightgreen
    There have never been other chat colors in L4D2

    Last edited by JustMadMan; 06-17-2024 at 16:00.
    JustMadMan is offline
    ball2hi
    Senior Member
    Join Date: Feb 2010
    Old 06-18-2024 , 12:14   Re: [L4D2] pcsWelcome Message (1.1)
    Reply With Quote #9

    Quote:
    Originally Posted by JustMadMan View Post
    There have never been other chat colors in L4D2
    I think one also has to be careful based on the team of each player, which can't display certain colors. Some of the most widely used colors which are safe I believe are {default} {orange} {olive} and probably the lightgreen.

    I've also updated the original post with 1.22. In my haste, I forgot cola I was copying code from other functions and grabbing the "userid" of HookEvent("versus_match_finished", Event_VersusFinished); and HookEvent("finale_vehicle_leaving", Event_VehicleLeave);. Which is basically non-sense. So I fixed that, and just put in CChatPrintToAll. Have to do some more testing with Event_VehicleLeave. It's hard to test since you need a vehicle to leave in, and Parish seems to not fire that if you just noclip to the end.

    Last edited by ball2hi; 06-18-2024 at 12:19.
    ball2hi is offline
    JustMadMan
    Member
    Join Date: Feb 2023
    Old 06-18-2024 , 14:47   Re: [L4D2] pcsWelcome Message (1.1)
    Reply With Quote #10

    Quote:
    Originally Posted by ball2hi View Post
    I think one also has to be careful based on the team of each player, which can't display certain colors. Some of the most widely used colors which are safe I believe are {default} {orange} {olive} and probably the lightgreen.

    I've also updated the original post with 1.22. In my haste, I forgot cola I was copying code from other functions and grabbing the "userid" of HookEvent("versus_match_finished", Event_VersusFinished); and HookEvent("finale_vehicle_leaving", Event_VehicleLeave);. Which is basically non-sense. So I fixed that, and just put in CChatPrintToAll. Have to do some more testing with Event_VehicleLeave. It's hard to test since you need a vehicle to leave in, and Parish seems to not fire that if you just noclip to the end.
    'cause L4D2 you cannot make red and blue chat color together.Server will be get issue "Using two team colors in one message is not allowed"

    Last edited by JustMadMan; 06-18-2024 at 14:52.
    JustMadMan 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 17:22.


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