Raised This Month: $32 Target: $400
 8% 

Steam Community Nick (1.0.4 - 21.12.2013)


Post New Thread Reply   
 
Thread Tools Display Modes
Plugin Info:     Modification:   ALL        Category:   Admin Commands       
Kia
AlliedModders Donor
Join Date: Apr 2010
Location: In a world of madness
Old 12-20-2013 , 13:31   Steam Community Nick (1.0.4 - 21.12.2013)
Reply With Quote #1

Steam Community Nick
- v1.0.4, last updated : 21.12.2013

This plugin uses a external PHP-Script to get the players Steam Name and set it as the players name.
You can also decide if you only want players with the Name "Player" to be forced to use their Steam name, and if Name changing is allowed.


Requirements
  • Webspace with PHP Support (should be any)
  • Steam API Key (requires Steam Account)

Credits
  • ot_207 - For his Socket Tutorial
  • ConnorMcLeod - For some code in the plugin (idk what exactly, sorry)
  • Unknown - Steam ID Converter
  • Arkshine - Thread Design
  • Weasel - Original Idea

Notes
Defines

PHP Code:
// API Key from http://steamcommunity.com/dev/apikey
#define API_KEY "YOURAPIKEYHERE"

// Site where PHP Script is hosted
#define API_HOST "kiasserver.tk"

// Name of PHP Script
#define API_SCRIPT "steamparser.php"

// Flag for bypassing plugin
#define FLAG_BYPASS ADMIN_BAN 
Change Log
v1.0.2 : [ 21.12.2013 ]

Added Defines
PHP Code:
// If defined, only Players with the name "Player" will be forced to use their steam name
#define ONLY_PLAYER

// If defined, changing names will be blocked, otherwise it is allowed
//#define BLOCK_NAME_CHANGE 
v1.0.3 : [ 21.12.2013 ]

Added Defines
PHP Code:
// If defined, players with flag FLAG_BYPASS won't be affected by this plugin
#define ADMIN_BYPASS

#if defined ADMIN_BYPASS

// Flag for bypassing Plugin
#define FLAG_BYPASS ADMIN_BAN

#endif 
v1.0.4 : [ 21.12.2013 ]
  • Removed some Defines and replaced them with CVars
  • New CVars
    • steamcomnick_affecting (Default : 1) - If 1, only players with the name "Player" will be forced to change name, otherwise all players.
    • steamcomnick_block (Default : 0) - If 1, changing name is not allowed, otherwise it is.
PHP Script

PHP Code:
<?php

$apikey 
$_GET["key"];
$steamid ConvertID($_GET["steamid"]);
$url "http://api.steampowered.com/ISteamUser/GetPlayerSummaries/v0002/?key=" .$apikey"&steamids=" .$steamid"&format=xml";

$xml = @simplexml_load_file($url) or die($errorMsg);
$result $xml->players->player->personaname;

echo 
'lamboon'.$result;

?>

<?php

function ConvertID($steamId) {
    
$iServer "0";
    
$iAuthID "0";
     
    
$szTmp strtok($steamId":");
     
    while((
$szTmp strtok(":")) !== false)
    {
        
$szTmp2 strtok(":");
        if(
$szTmp2 !== false)
        {
            
$iServer $szTmp;
            
$iAuthID $szTmp2;
        }
    }
    if(
$iAuthID == "0")
        return 
"0";
 
    
$steamId64 bcmul($iAuthID"2");
    
$steamId64 bcadd($steamId64bcadd("76561197960265728"$iServer)); 
     
    return 
$steamId64;
}

?>

Attached Files
File Type: sma Get Plugin or Get Source (steamcomnick.sma - 1309 views - 6.2 KB)
__________________

Last edited by Kia; 12-21-2013 at 13:44.
Kia is offline
Jhob94
AMX Mod X Donor
Join Date: Jul 2012
Location: Siiiiiiiiuu
Old 12-20-2013 , 13:35   Re: Steam Community Nick (1.0.0 - 20.12.2013)
Reply With Quote #2

Good Job
__________________
Jhob94 is offline
Kia
AlliedModders Donor
Join Date: Apr 2010
Location: In a world of madness
Old 12-20-2013 , 13:49   AW: Re: Steam Community Nick (1.0.0 - 20.12.2013)
Reply With Quote #3

Quote:
Originally Posted by Jhob94 View Post
Good Job
Thank you. If you have suggestions, please post them.
Will add Clan Support and Blacklist-only support tomorrow.
__________________

Last edited by Kia; 12-20-2013 at 13:50.
Kia is offline
PoLiCe
Senior Member
Join Date: Apr 2013
Location: Xen™
Old 12-20-2013 , 13:55   Re: Steam Community Nick (1.0.0 - 20.12.2013)
Reply With Quote #4

Nice, Good Job
__________________

Last edited by PoLiCe; 12-20-2013 at 13:56.
PoLiCe is offline
Send a message via MSN to PoLiCe Send a message via Skype™ to PoLiCe
fysiks
Veteran Member
Join Date: Sep 2007
Location: Flatland, USA
Old 12-20-2013 , 13:58   Re: Steam Community Nick (1.0.0 - 20.12.2013)
Reply With Quote #5

The option to only do this if the player is named "Player" and only do it once so that they can change their name later would be the best IMO, since I like being able to not be forced to use my Steam Friends name like they do in Source games.

This would prevent people from changing their name to "Player" also.
__________________

Last edited by fysiks; 12-20-2013 at 13:58.
fysiks is offline
Kia
AlliedModders Donor
Join Date: Apr 2010
Location: In a world of madness
Old 12-20-2013 , 13:59   AW: Re: Steam Community Nick (1.0.0 - 20.12.2013)
Reply With Quote #6

Quote:
Originally Posted by fysiks View Post
The option to only do this if the player is named "Player" and only do it once so that they can change their name later would be the best IMO, since I like being able to not be forced to use my Steam Friends name like they do in Source games.

This would prevent people from changing their name to "Player" also.
Will be added in tomorrow's update, thanks.
__________________
Kia is offline
joshknifer
Veteran Member
Join Date: Jun 2011
Location: Denver, CO
Old 12-20-2013 , 14:27   Re: Steam Community Nick (1.0.0 - 20.12.2013)
Reply With Quote #7

I agree with Fysiks. Other than than, looks great Kia.
__________________
joshknifer is offline
Send a message via Skype™ to joshknifer
Kia
AlliedModders Donor
Join Date: Apr 2010
Location: In a world of madness
Old 12-20-2013 , 14:33   AW: Re: Steam Community Nick (1.0.0 - 20.12.2013)
Reply With Quote #8

Quote:
Originally Posted by joshknifer View Post
I agree with Fysiks. Other than than, looks great Kia.
Thanks.
__________________
Kia is offline
Blizzard_87
Veteran Member
Join Date: Oct 2012
Old 12-20-2013 , 22:23   Re: Steam Community Nick (1.0.0 - 20.12.2013)
Reply With Quote #9

Kia id give credit to the guy who gave you the idea for this...

https://forums.alliedmods.net/showthread.php?t=231690
__________________
Blizzard_87 is offline
Weasel
AlliedModders Donor
Join Date: Apr 2004
Location: Undisclosed / Secure
Old 12-20-2013 , 22:25   Re: Steam Community Nick (1.0.0 - 20.12.2013)
Reply With Quote #10

Excellent!

Out of curiosity, why did you have to resort to using an external PHP script? instead of doing that in the plug-in itself?
__________________
Pwease pardon by bad Engrish.
Steam Profile, Steam Group, Stats, Twitter
Weasel 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 23:21.


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