forked from TeamUlysses/ulx
ULX Who Addition
Added optional steamid parameter to ulx who. Including this will show you information about that steamid rather than all connected players. Useful for seeing info for unconnected players.
This commit is contained in:
parent
2dfe9c41b0
commit
9d64fddea1
@ -1,20 +1,35 @@
|
||||
local CATEGORY_NAME = "Utility"
|
||||
|
||||
function ulx.who( calling_ply )
|
||||
ULib.console( calling_ply, "ID Name Group" )
|
||||
function ulx.who( calling_ply, steamid )
|
||||
if not steamid or steamid == "" then
|
||||
ULib.console( calling_ply, "ID Name Group" )
|
||||
|
||||
local players = player.GetAll()
|
||||
for _, player in ipairs( players ) do
|
||||
local id = tostring( player:UserID() )
|
||||
local nick = player:Nick()
|
||||
local text = string.format( "%i%s %s%s ", id, string.rep( " ", 2 - id:len() ), nick, string.rep( " ", 31 - nick:len() ) )
|
||||
local players = player.GetAll()
|
||||
for _, player in ipairs( players ) do
|
||||
local id = tostring( player:UserID() )
|
||||
local nick = player:Nick()
|
||||
local text = string.format( "%i%s %s%s ", id, string.rep( " ", 2 - id:len() ), nick, string.rep( " ", 31 - nick:len() ) )
|
||||
|
||||
text = text .. player:GetUserGroup()
|
||||
text = text .. player:GetUserGroup()
|
||||
|
||||
ULib.console( calling_ply, text )
|
||||
ULib.console( calling_ply, text )
|
||||
end
|
||||
else
|
||||
data = ULib.ucl.getUserInfoFromID( steamid )
|
||||
|
||||
if not data then
|
||||
ULib.console( calling_ply, "No information for provided id exists" )
|
||||
else
|
||||
ULib.console( calling_ply, " ID: " .. steamid )
|
||||
ULib.console( calling_ply, " Name: " .. data.name )
|
||||
ULib.console( calling_ply, "Group: " .. data.group )
|
||||
end
|
||||
|
||||
|
||||
end
|
||||
end
|
||||
local who = ulx.command( CATEGORY_NAME, "ulx who", ulx.who )
|
||||
who:addParam{ type=ULib.cmds.StringArg, hint="steamid", ULib.cmds.optional }
|
||||
who:defaultAccess( ULib.ACCESS_ALL )
|
||||
who:help( "See information about currently online users." )
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user