AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   Unapproved Plugins (https://forums.alliedmods.net/forumdisplay.php?f=109)
-   -   [L4D2] Add Player Country to Name (Connections messages and admin indication) (https://forums.alliedmods.net/showthread.php?t=121919)

n3wton 03-21-2010 00:30

[L4D2] Add Player Country to Name (Connections messages and admin indication)
 
3 Attachment(s)
[IMG]http://img407.**************/img407/4134/descriptiono.png[/IMG]

This is my first plugin, it took me about 6 hours to learn how to write it and make it work.

Basically it adds a players location tag (e.g. UK, US, FR ) to the end of a players name.
Example: N3wton [UK]

if a user is an admin the players name will look more like this:
Example: (A)N3wton [UK]

It also has an option to show a welcome message as players connect, this can be turned off.
The player join message can be changed in the .cfg, but the default is...
Example: N3wton from the United Kingdom has joined.
(admin users will be shown in yellow)

As I say this is my first plugin, so please be kind and suggest improvements.

NOTE
There is an error in the Left4Dead2 gamedata( in SorceMod 1.3.1) file located at...
"left4dead2/addons/sourcemod/gamedata/sdktools.games/engine.l4d2.txt"
the SetUserCvar for windows is set at 18, where as the correct value is 17.
I recommend updating your server to the latest STABLE snapshot located here.
(note: this bug only effects windows servers, linux servers should run fine)

[IMG]http://img91.**************/img91/4416/commandsm.png[/IMG]
sm_pactlist, !pactlist
lists all the connected players and the countries.

[IMG]http://img638.**************/img638/898/cvars.png[/IMG]

// Layout of how and what the admin tag should look like (Note: {NAME} equates to the string genorated from PACT_Name_Layout)
PACT_Admin_Layout "(A) {NAME}"

// Layout of how !pactlist should be displayed
PACT_List_Layout "{NAME} is from {CITY} in {LOC}"
// Layout of how the clients name should look ( Note: If you do not want a tag to be shown in the clients name, set this CVar to "{NAME}" )
PACT_Name_Layout "{NAME} [{TAG}]"

// Show a message on player join ('PLAYER' from 'LOCATION' has joined)
PACT_Player_Join_Message "1"

// Format of the welcome message, {NAME} = player name, {LOC} = country, {CITY} = city
PACT_Player_Join_Message_Layout "{NAME} from {CITY} in {LOC} has joined."
// Highlight admins in yellow in chat messages
PACT_Show_Admin_Messages "1"

// Put admintag infront of all admins in score
PACT_Show_Admin_Score "1"

// Version of the Player Add Country Tag (PACT) plugin.
PACT_Version "2.5.0"

[IMG]http://img144.**************/img144/7894/screenshotsb.png[/IMG]
Left4Dead2 - Scoreboard
[IMG]http://img13.**************/img13/5660/scoreso.png[/IMG]

[IMG]http://img641.**************/img641/1209/pactnewscores.png[/IMG]

Left4Dead2 - Connection Messages
[IMG]http://img130.**************/img130/8231/connectionmsg.png[/IMG]

Left4Dead2 - List Players via sm_pactlist (or !pactlist)
[IMG]http://img641.**************/img641/953/listplayers.png[/IMG]


[IMG]http://img202.**************/img202/2596/changelog.png[/IMG]
* Version 2.5.0
- Fixed some bugs
- Added Client City Support
- Removed Typos

* Version 2.0.0
- Complete rewrite to generally tidy up all the code.
- Should now work with SourceMod 1.4
- Added more Cvars for fuller customisation

* Version 1.1.0
- Now supports showing of admins, and has two extra cvars
(if updating from an old version please remove the .cfg file)

* Version 1.0.2
- Fixed a small gramitical error if the players location is unknown.

* Version 1.0.1:
-Added sm_pactlist (!pactlist) command.

* Version 1.0.0:
-Initial Release

NOTE:
As this plugin now uses my geocity include, it will no longer compile on the web (get plugin button) as the web compiler doesn't have my include. If you only want the plugin pleae download the PlayerAddCountryTag.smx file. If you wish to compile the sourcecode for yourself, please follow the instructions located here.

Setting Up City name Use:
1 - Download PlayerAddCountryTag.smx and put in addons\sourcemod\plugins on your server.
2 - Download GeoLiteCity.zip and extract the GeoLiteCity.sq3 into addons\sourcemod\data\sqlite on your server.
3 - if you are updating from an older version, please delete the PlayerAddCountryTag.cfg from cfg\sourcemod
4 - Restart your server

For Use without City names:
1 - Download the PlayerAddCountryTag - No Cites version of the plugin (via get plugin button ) and put in addons\sourcemod\plugins on your server.
2 - Restart your server.

Additional Downloads

GeoLiteCity.zip {RapidShare}
GeoLiteCity.zip {MegaUpload}

Yours
N3wton

psychonic 03-22-2010 11:04

Re: [ANY] Add Player Country to Name
 
What does this plugin have over this one? http://forums.alliedmods.net/showthread.php?p=738756

n3wton 03-22-2010 11:36

Re: [ANY] Add Player Country to Name
 
it has the abillity to stop the start up message and the abillity to change the format of the start up message, and you can list all the players via a command, and finally, it puts it at the end of the name rather than the beginning :P

Ok, Ok, They basically do the samething, It just annoyed me that the version you mention wasn't very flexable, so I made my own.

Yours
N3wton

marvel 03-23-2010 09:07

Re: [ANY] Add Player Country to Name
 
Thanks for sharing! I was looking for this one. I can't believe why some people still complain when somebody takes the time to write a plugin and share it with us, it even has more functionality.

The more the merrier, keep them coming :)

psychonic 03-23-2010 09:41

Re: [ANY] Add Player Country to Name
 
Quote:

Originally Posted by marvel (Post 1126373)
I can't believe why some people still complain...

If you're referring to me, I'm not sure how it was a complaint, rather than a valid question to save myself some time comparing and possibly weed out a duplicate in case the author was unaware of the other plugin.

@n3wton
Rather than using a usermessage hook to block the name change text, it would be more efficient to use the SetEventBroadcast native in your player_namechange hook to stop the event from broadcasting to clients. This can also be used in place of returning Plugin_Handled in the player_changename event so that other server functions involving the event, like logging, aren't affected.

I also recommend using the MAX_NAME_LENGTH define for the size of your name strings, rather than a (seemingly) arbitrary value.

Also, you might want to borrow the renaming methods from scripting/playercommands/rename.sp or note in the first post that this plugin with only work for orangebox and above, not "ANY" (ie. not CS:S, Insugency, etc.).

marvel 03-23-2010 13:46

Re: [ANY] Add Player Country to Name
 
Quote:

Originally Posted by psychonic (Post 1126388)
If you're referring to me, I'm not sure how it was a complaint, rather than a valid question to save myself some time comparing and possibly weed out a duplicate in case the author was unaware of the other plugin.

Noted, but this plugin has a couple more features, you could have seen that by comparing both plugins (which you are explaining right now why you didn't).

Maybe I shouldn't have used the word 'complain' as it was indeed a question, I might have overlooked the question mark sorry for that :wink:

n3wton 03-31-2010 06:21

Re: [ANY] Add Player Country to Name
 
Just uploaded a quick update, I noticed a grammer error if the players country was unkown, so I fixed it :)

n3wton 04-04-2010 17:28

Re: [L4D2] Add Player Country to Name (Connections messages and admin indication)
 
Uploaded a new version which now supports admin recognition, such that if a client is an admin the connection message is shown in yellow where as other users are shown in white. Also admins names are prefixed with (A). Both these options can be disabled via the CVars.

p.s. What do I need to do to get this plugin approved?

Yours
N3wton

marvel 04-05-2010 09:20

Re: [L4D2] Add Player Country to Name (Connections messages and admin indication)
 
There's a sticky what you need to do to get it approved :)

Thanks for the plugin and the updates, I'm going to test this. I was using the old one but I had one case where it would continue to add the country name to the name of the player. It looked like this:

[ZA][ZA][ZA][ZA][ZA][ZA]kernel.

And it would add a new [ZA] with every mapswitch lol.

Btw. one more request, could you add a cvar to add the country name before or after the nick? Thx :)

marvel 04-05-2010 09:28

Re: [L4D2] Add Player Country to Name (Connections messages and admin indication)
 
Wow major glitch, look at the player names now :)

Code:

#  | Name                          | Frags | Time   
01 |  [JP]                        | 4    | 01:34:30
02 | | Vergil [SE] [GB] [GB]      | 0    | 01:23:49
03 | r garde | Vergil [SE] [GB]    | 0    | 01:04:03
04 |  [SE] [GB] [GB] [NO]          | 1    | 00:51:14
05 | ] [IL]                        | 2    | 00:40:45
06 | Eyelander garde | Vergil [SE] | 0    | 00:17:26
07 | B] [GB] [NO] [RU]            | 0    | 00:05:17
08 | [NO] [RU] [SE]                | 1    | 00:02:16



All times are GMT -4. The time now is 19:56.

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