Connect Announce – By Arg!
Description: Replacement for standard connection and disconnection message for players. Displays country and steam id of joining player. Colors are fully customizable by editing the file ‘addons\sourcemod\data\cannounce_settings.txt ‘. Allows for custom join messages eg, players can set a message that will display every time they connect to the server. This is not open to all players as they have to be allowed by an admin prior to setting their message. Menu integration included for allowing/disallowing custom join messages.
Notes: The connect messages show later than the default one, as the player has to be authorized (steam id validated, and sourcemod admin checked) before we can use it. ROOT privileges are required to allow/disallow join messages but this can be changed in the code at the top of joinmsg.sp
This plugin stores custom join messages and sound paths in the file ‘addons\sourcemod\data\cannounce_messages.txt ‘. If you manually edit this file, you will need to restart the plugin for changes to apply. If you do not the file may be overwritten on map change, without your changes.
Plugin settings such as the player connect message are stored in the file ‘addons\sourcemod\data\cannounce_settings.txt ‘
When adding join sounds, all paths are to be specified relative to the sounds folder of your mod, eg the sound path ‘player\death.wav’ refers to the path ‘<modname>\sounds\player\death.wav’. Any sound included in your game/mod can be used, or any custom sound, depending on your sv_pure setup. Any custom sound specified will automatically be downloaded to all clients on map change.
MP3’s do work as custom join sounds but they may need to be amplified to make them work as well as wav’s.
This plugin contains support for the GeoIPCity sourcemod extension by GoD-Tony which adds extra player location based information and should be faster than the core sourcemod location information API. The extension is NOT required to run this plugin and if it is not present will use the default information provided by core sourcemod. Use the link above for more information on installing GeoIPCity extension.
Commands:
- sm_geolist <name or #userid> – lists player(s) and their country.
- sm_joinmsg [message] – (console command) player can use this to set their custom join message (if allowed) or if no message provided will display their currently set message.
- sm_joinmsgon <name or #userid> – allow target to set their custom join message.
- sm_joinmsgonid ‘<steamId>’ ‘<player name>’ – allows specified steam id to set a custom join message, useful if player not in game. Player name is only an indicator so the file storing the messages is human readable.
- sm_joinmsgoff <name or #userid> – disallow target from having a custom join message.
- sm_joinmsgoffid ‘<steamId>’ – disallow specified steam id from having a custom join message.
- sm_setjoinmsg <name or #userid> ‘<message>’ – set a custom join message for target, if they are allowed to have one.
- sm_setjoinmsgid ‘<steamId>’ ‘<message>’ – set a custom join message for steam id, if it is allowed
- sm_setjoinsnd <name or #userid> ‘<sound file path>’ – set a custom join sound for target, if they are allowed to have one.
- sm_setjoinsndid ‘<steamId>’ ‘<sound file path>’ – set a custom join sound for steam id, if it is allowed
- sm_playsnd ‘<sound file path>’ – plays sound file to all clients, useful for testing sound files before applying to a client.
Cvars:
- sm_ca_connectdisplaytype – <1|0> if 1 then displays enhanced connect message after admin check and allows the {PLAYERTYPE} placeholder. If 0 displays enhanced connect message on client auth (earlier) and disables the {PLAYERTYPE} placeholder
- sm_ca_disableclientmsgchange – prevent ALL clients from setting their own custom join message.
- sm_ca_showenhanced <1|0> – shows the enhanced player connect message from this plugin.
- sm_ca_showenhanceddisc <1|0> – shows the enhanced player disconnect message from this plugin.
- sm_ca_showstandard <1|0> – shows the standard player connect message.
- sm_ca_showstandarddisc <1|0> – shows the standard player disconnect message.
- sm_ca_showenhancedadmins <1|0> – shows a different enhanced connect/disconnect message to admins with the generic flag. Message customised in /data/cannounce_settings.txt’
- sm_ca_autoallowmsg <1|0> – allows admins with the kick flag to always be able to set a custom join message.
- sm_ca_playsound <1|0> – if enabled, plays a sound on each player connect.
- sm_ca_playsoundfile <sound file path> – specifies sound file to play if sm_ca_playsound is enabled.
- sm_ca_playdiscsound <1|0> – if enabled, plays a sound on each player disconnect.
- sm_ca_playdiscsoundfile <sound file path> – specifies sound file to play if sm_ca_playdiscsound is enabled.
- sm_ca_mapstartnosound (float, defaults to 30.0) – specify time to play NO connect sounds after map start
Thanks to:
- bl4nk
- Sourcemod forums posters + IRC lurkers in general
- berni – Map Decals plugin helped a lot in custom sounds release
- DJ Tsunami – I used pieces of the Advertisements plugin placeholder parsing code for this.
- Dont Fear The Reaper – Wrote all the GeoIPCity extension support!
- Bara, exvel and Dr. McKay for color handling.
Install Instructions:
- ‘plugins/cannounce.smx’ goes into ‘sourcemod/plugins’
- ‘translations/cannounce.phrases.txt’ goes into ‘sourcemod/translations’
- after loading plugin, file ‘cfg/sourcemod/cannounce.cfg’ gets created and can be modified to change default cvar settings
- after loading plugin, file ‘addons/sourcemod/data/cannounce_settings.txt’ gets created which can be used to change the connect/disconnect messages. Here you can customise the standard messages and the ones displayed to admins when sm_ca_showenhancedadmins is set.
Placeholder Constants:
Connect/Disconnect messages can be customized in the file ‘addons/sourcemod/data/cannounce_settings.txt’ which gets created on initial plugin load. The following placeholders can be used to customize the messages:
- {PLAYERNAME} – Players name
- {PLAYERTYPE} – Displays ‘Admin’ if the client has the generic admin flag, otherwise ‘Player’
- {STEAMID} – Players steam ID
- {PLAYERCOUNTRY} – Players country eg. Australia
- {PLAYERCOUNTRYSHORT} – Players country code eg. AU
- {PLAYERCOUNTRYSHORT3} – 3 letter Players county code eg. AUS – Only if GeoIPCity extension present
- {PLAYERREGION} – Player region if applicable – Only if GeoIPCity extension present
- {PLAYERCITY} – Player city – Only if GeoIPCity extension present
- {PLAYERIP} – IP address of player
- {DISC_REASON} – Enhanced disconnect message only. Displays player disconnect reason.
Color Placeholders:
Color placeholders are obtained from [INC] Multi Colors which in turn gets its colors from
[INC] Colors (1.0.5)
and
[INC] More Colors (1.9.1)
Which are available depending on the version of the Source engine your game is using. Please see those threads for availble colors.
When setting custom join messages, you can use any available color placeholders:
If you join the server from a local area network, this plugin will detect it. In this instance you can set what is displayed in the location based placeholders in the cannonce.phrases.txt file.