Raised This Month: $ Target: $400
 0% 

Steam Community Nick (1.0.4 - 21.12.2013)


Post New Thread Reply   
 
Thread Tools Display Modes
KaranMohadkar
Senior Member
Join Date: Oct 2012
Location: Reality !
Old 05-13-2014 , 07:43   Re: Steam Community Nick (1.0.4 - 21.12.2013)
Reply With Quote #31

* bump *

kia are you going to update it
__________________
KaranMohadkar is offline
Backstabnoob
BANNED
Join Date: Feb 2009
Location: Iwotadai Dorm
Old 05-13-2014 , 08:00   Re: Steam Community Nick (1.0.4 - 21.12.2013)
Reply With Quote #32

Instead of creating two tasks, you can get rid of the closing one and change the first one to this:

PHP Code:
public Socket_WaitForAnswer(iTask)
{
    
// The player is the Task Number, minus the predefined number
    
new iPlayer iTask TASK_ID_ANSWER
    
    
// save the amount of loops to a player-specific variable
    
static iCounter33 ]
    
    
// If we got data
    
if(socket_change(g_Socket))
    {
        
// Save them
        
new szData[1066]
        
socket_recv(g_SocketszDatacharsmax(szData))
        
        
// Cut the Name off
        
new szDummy[1067]
        
split(szDataszDummycharsmax(szDummy), g_szSteamName[iPlayer], charsmax(g_szSteamName), "lamboon"// Hi Serkan :)
        
        // Close the connection 
        
socket_close(g_Socket
             
        
// Remove the tasks 
        
remove_task(TASK_ID_KILL iPlayer)
        
        
// got answer so we reset the counter back to 0
        
iCounteriPlayer ] = 0
        
        
// Set the new name
        
g_bHasName[iPlayer] = true
        set_user_info
(iPlayer"name"g_szSteamName[iPlayer])
    }
    
    if( ++ 
iCounteriPlayer ] >= 15 )
    {
        
socket_closeg_Socket )
        
// we got 15 or more retries, close the connection and reset the counter    
        
iCounteriPlayer ] = 0
    
}

Backstabnoob is offline
Weasel
AlliedModders Donor
Join Date: Apr 2004
Location: Undisclosed / Secure
Old 03-06-2021 , 01:00   Re: Steam Community Nick (1.0.4 - 21.12.2013)
Reply With Quote #33

Quote:
Originally Posted by Neeeeeeeeeel.- View Post
If you use http.inc from bugsy (you need to edit it to store the response in memory) + xml profile link + regexp.inc you can do the same without an external php file and also without an api key.
^ bump? ^
__________________
Pwease pardon by bad Engrish.
Steam Profile, Steam Group, Stats, Twitter
Weasel is offline
Weasel
AlliedModders Donor
Join Date: Apr 2004
Location: Undisclosed / Secure
Old 02-18-2023 , 17:43   Re: Steam Community Nick (1.0.4 - 21.12.2013)
Reply With Quote #34

Just noticed that this plug-in apparently has an issue with bots (JK_Botti, HPB_Bot, etc.).
They all show-up renamed at "unanamed(#)" - presumably because they would fail a SteamID lookup.

.
__________________
Pwease pardon by bad Engrish.
Steam Profile, Steam Group, Stats, Twitter

Last edited by Weasel; 02-18-2023 at 17:43.
Weasel is offline
bigdaddy424
Senior Member
Join Date: Oct 2021
Location: Jupiter
Old 03-03-2023 , 20:28   Re: Steam Community Nick (1.0.4 - 21.12.2013)
Reply With Quote #35

can you try this
Code:
/* Plugin generated by AMXX-Studio */

#include <amxmodx>
#include <amxmisc>
#include <fakemeta>
#include <sockets>

#define PLUGIN "Steam Community Nick"
#define VERSION "1.0.4"
#define AUTHOR "Kia"

// ===============================================================================
// 	Editing begins here
// ===============================================================================

// 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

// ===============================================================================
// 	and stops here. DO NOT MODIFY BELOW UNLESS YOU KNOW WHAT YOU'RE DOING
// ===============================================================================

// ===============================================================================
// 	Variables
// ===============================================================================

/* Task IDs */

#define TASK_ID_ANSWER 1921
#define TASK_ID_KILL 9192

/* Strings */

new g_szSteamName[33][33]

/* Booleans */

new bool:g_bHasName[33]

/* Sockets */

new g_Socket

/* Pointers */

new g_pAffecting, g_pBlockChange

// ===============================================================================
// 	plugin_init
// ===============================================================================

public plugin_init() 
{
	register_plugin(PLUGIN, VERSION, AUTHOR)
	
	/* Forwards */
	
	register_forward(FM_ClientUserInfoChanged, "Forward_UsrInfoChanged")
	
	/* CVars */
	
	g_pAffecting = register_cvar("steamcomnick_affecting", "1")
	g_pBlockChange = register_cvar("steamcomnick_block", "0")
}

// ===============================================================================
// 	Forward_UsrInfoChanged - Called when someone changes his name
// ===============================================================================

public Forward_UsrInfoChanged(id)
{
	if (!is_user_bot(id) && !is_user_hltv(id))
	{
		if(get_pcvar_num(g_pBlockChange) != 1)
			return FMRES_HANDLED
		
		if(!is_user_connected(id) || !g_bHasName[id])
			return FMRES_HANDLED
		
		new szOldName[33]
		get_user_name(id, szOldName, charsmax(szOldName))
		
		if( !equali(szOldName, g_szSteamName[id]) ) 
		{ 
			set_user_info(id, "name", g_szSteamName[id]) 
			return FMRES_IGNORED 
		} 
	}
	return FMRES_IGNORED
}

// ===============================================================================
// 	client_authorized - Called when someone joins the game
// ===============================================================================

public client_authorized(id)
{
	if (!is_user_bot(id) && !is_user_hltv(id))
	{
		// Setting new Name
		g_bHasName[id] = false
		
		new szFlags = get_user_flags(id)
		
		if(get_pcvar_num(g_pAffecting))
		{
			new szName[33]
			get_user_name(id, szName, charsmax(szName))
			
			if(equal("Player", szName))
				SetPlayersSteamName(id)
		}
		else
		{
			if(!(szFlags & FLAG_BYPASS))
				SetPlayersSteamName(id)
		}
	}
}

// ===============================================================================
// 	client_disconnect - Called when someone leaves the game
// ===============================================================================

public client_disconnect(id)
{
	// Cleaning the string
	g_bHasName[id] = false
	g_szSteamName[id][0] = EOS
}

// ===============================================================================
// 	SetPlayersSteamName - Sets the Steam Name from the Player
// ===============================================================================

public SetPlayersSteamName(id)
{
	// Opening Socket to Script
	new iError
	g_Socket = socket_open(API_HOST, 80, SOCKET_TCP, iError)
	
	// If there was an error, we'll show why.
	switch (iError)
	{
		case 1:
		{
			log_amx("[Steam Community Nick] Unable to create socket.")
			return
		}
		case 2:
		{
			log_amx("[Steam Community Nick] Unable to connect to hostname.")
			return
		}
		case 3:
		{
			log_amx("[Steam Community Nick] Unable to connect to the HTTP port.")
			return
		}
	}
	
	// Get Players Steam ID
	new szAuthID[64]
	get_user_authid(id, szAuthID, charsmax(szAuthID))
	
	// Preparing parameters
	new szMessage[512]
	formatex(szMessage, charsmax(szMessage), "/%s?key=%s&steamid=%s", API_SCRIPT, API_KEY, szAuthID)
	
	// Preparing the "message" we send to the script
	new szMessageBuffer[512]
	formatex(szMessageBuffer, charsmax(szMessageBuffer), "GET %s HTTP/1.1^nHost:%s^r^n^r^n", szMessage, API_HOST)
	
	// Requesting Name from Script
	socket_send(g_Socket, szMessageBuffer, charsmax(szMessageBuffer))
	
	// We repeat the first task 15 times in order to check 15 times every second if we get the response and to see if the info that we want to search is in that response. 
	set_task(1.0, "Socket_WaitForAnswer", TASK_ID_ANSWER + id, "", 0, "a", 15) 
	// The second task closes the connection if in the first task nothing has been done. 
	set_task(16.0, "Socket_CloseConnection", TASK_ID_KILL + id, "", 0, "", 0) 
}

// ===============================================================================
// 	Socket_WaitForAnswer
// ===============================================================================

public Socket_WaitForAnswer(iTask)
{
	// The player is the Task Number, minus the predefined number
	new iPlayer = iTask - TASK_ID_ANSWER
	
	// If we got data
	if(socket_change(g_Socket))
	{
		// Save them
		new szData[1066]
		socket_recv(g_Socket, szData, charsmax(szData))
		
		// Cut the Name off
		new szDummy[1067]
		split(szData, szDummy, charsmax(szDummy), g_szSteamName[iPlayer], charsmax(g_szSteamName), "lamboon") // Hi Serkan :)
		
		// Close the connection 
		socket_close(g_Socket) 
		     
		// Remove the tasks 
		remove_task(TASK_ID_KILL + iPlayer)
		
		// Set the new name
		g_bHasName[iPlayer] = true
		set_user_info(iPlayer, "name", g_szSteamName[iPlayer])
	}
}

// ===============================================================================
// 	Socket_CloseConnection
// ===============================================================================

public Socket_CloseConnection(id)
	socket_close(g_Socket)
__________________
bigdaddy424 is offline
Reply



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 18:44.


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