This site is a testing version, but all data is shared with the live forum.


Raised This Month: $ Target: $400
 0% 

Plugin to show UserID


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
PepeZukas
Member
Join Date: Oct 2015
Location: Banana Republic
Old 04-01-2017 , 17:29   Plugin to show UserID
Reply With Quote #1

Someone can make a plugin to simply show the name of all users with their UserID (not SteamID), and show in the chat to only the admin.

For example:
#1 PepeZukas
#2 Louis
#3 Francis
#4 Bill

I know that typing status on the console works, but I just wanted the UserID and the direct player name in the chat for the admin only.

I'm grateful.

Last edited by PepeZukas; 04-01-2017 at 17:30.
PepeZukas is offline
Drixevel
AlliedModders Donor
Join Date: Sep 2009
Location: Somewhere headbangin'
Old 04-01-2017 , 18:37   Re: Plugin to show UserID
Reply With Quote #2

Code:
#pragma semicolon 1
#pragma newdecls required

#include <sourcemod>

public Plugin myinfo = 
{
	name = "Show client indexes", 
	author = "Keith Warren (Drixevel)", 
	description = "Shows client indexes and their names on command.", 
	version = "1.0.0", 
	url = "http://www.drixevel.com/"
};

public void OnPluginStart()
{
	RegAdminCmd("sm_showindexes", Command_ShowIndexes, ADMFLAG_GENERIC, "Shows client indexes and their names.");
}

public Action Command_ShowIndexes(int client, int args)
{
	for (int i = 1; i <= MaxClients; i++)
	{
		if (IsClientInGame(i))
		{
			PrintToChat(client, "#%i %N", i, i);
		}
	}
	
	return Plugin_Handled;
}
Drixevel is offline
PepeZukas
Member
Join Date: Oct 2015
Location: Banana Republic
Old 04-01-2017 , 20:41   Re: Plugin to show UserID
Reply With Quote #3

It worked, but the UserID shown by the plugin is different from that shown by the command "status" of the console.

Console "Status":
Code:
# userid name uniqueid connected ping loss state rate adr
# 2 1 "PepeZukas" STEAM_X:X:XXXXXXXXX 00:43 32 0 active 10000 XXX.X.X.X:XXXXX
# 3 "Louis" BOT active
# 4 "Francis" BOT active
# 5 "Bill" BOT active
#end
Your plugin:
Code:
#1 PepeZukas
#2 Louis
#3 Francis
#4 Bill
Anyway, thanks for helping out.
PepeZukas is offline
Franc1sco
Veteran Member
Join Date: Oct 2010
Location: Spain (Madrid)
Old 04-01-2017 , 20:44   Re: Plugin to show UserID
Reply With Quote #4

Change this:
PHP Code:
PrintToChat(client"#%i %N"ii); 
To this:
PHP Code:
PrintToChat(client"#%i %N"GetClientUserId(i), i); 
__________________
Veteran Coder -> Activity channel
Coding on CS2 and taking paid and free jobs.

Contact: Steam, Telegram or discord ( franug ).

You like my work? +Rep in my steam profile comments or donate.

Franc1sco is offline
Send a message via MSN to Franc1sco
Drixevel
AlliedModders Donor
Join Date: Sep 2009
Location: Somewhere headbangin'
Old 04-01-2017 , 21:07   Re: Plugin to show UserID
Reply With Quote #5

Quote:
Originally Posted by PepeZukas View Post
It worked, but the UserID shown by the plugin is different from that shown by the command "status" of the console.

Console "Status":
Code:
# userid name uniqueid connected ping loss state rate adr
# 2 1 "PepeZukas" STEAM_X:X:XXXXXXXXX 00:43 32 0 active 10000 XXX.X.X.X:XXXXX
# 3 "Louis" BOT active
# 4 "Francis" BOT active
# 5 "Bill" BOT active
#end
Your plugin:
Code:
#1 PepeZukas
#2 Louis
#3 Francis
#4 Bill
Anyway, thanks for helping out.
I figured you meant indexes, my bad.
Drixevel is offline
PepeZukas
Member
Join Date: Oct 2015
Location: Banana Republic
Old 04-01-2017 , 22:25   Re: Plugin to show UserID
Reply With Quote #6

Quote:
Originally Posted by Franc1sco View Post
Change this:
PHP Code:
PrintToChat(client"#%i %N"ii); 
To this:
PHP Code:
PrintToChat(client"#%i %N"GetClientUserId(i), i); 
Now it worked perfectly, thank you redwerewolf and Franc1sco for the help.
PepeZukas 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 05:13.


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