View Single Post
Old 02-11-2007, 01:37 AM   #7
ensiform
The Stig
 
ensiform's Avatar
 
Join Date: Nov 2004
Location: Sawtooth Cauldron
Posts: 1,241
Current Game: Borderlands 2
This should allow you to mimic the functionality of the JA+ client-side command to show real player IDs of clients:

Code:
cg.CS_SERVERINFO = 0
cg.CS_PLAYERS = 1131
cg.AddCommand("showPlayerID")

function showPlayerID()
	svinfo = cg.GetConfigString(cg.CS_SERVERINFO)
	sv_maxclients = tonumber(cg.Info_ValueForKey(svinfo, "sv_maxclients"))
	cg.Print(" ID Name\n")
	local count = 0
	local n = 0
	for n = 0, sv_maxclients-1 do
		info = cg.GetConfigString(cg.CS_PLAYERS + n)
		if info ~= "" then
			name = cg.Info_ValueForKey(info, "n")
			cg.Print(string.format(" %2i %s^7\n", n, name))
			count = count + 1;
		end
	end
	cg.Print(string.format("%2i totalplayers\n", count))
end

-- return 1 to intercept
-- return 0 to pass through to client module
function cg_ConsoleCommand(cmd)
	if cmd == "showPlayerID" then
		showPlayerID()
		return 1
	end
	return 0
end

function cg_Shutdown()
	cg.RemoveCommand("showPlayerID")
end


iojamp project lead / coder

Last edited by ensiform; 02-15-2007 at 10:26 PM.
ensiform is offline   you may: quote & reply,