Forum

> > CS2D > General > LUA: @listusers
ForenübersichtCS2D-ÜbersichtGeneral-ÜbersichtEinloggen, um zu antworten

Englisch LUA: @listusers

4 Antworten
Zum Anfang Vorherige 1 Nächste Zum Anfang

alt LUA: @listusers

inzec
User Off Offline

Zitieren
Hello. I wish to add the command @listusers to my server like the one found in TLex admin script, but I want it on it's own and not the whole admin system.

What it's suppose to do is list all the players USGN names and I think IP's who are in the server.

Does anyone know how to create it?

Thankyou.

alt Re: LUA: @listusers

Apache uwu
User Off Offline

Zitieren
1
2
3
4
5
6
7
8
9
10
11
12
13
addhook("say","_say")

function _say(id,message)
	if message=="@listusers" then
		msg2(id,string.char(169).."255255255List of Players ("..#player(0,"table")..")")
		msg2(id,string.char(169).."255255255-----")
		for _,pl in pairs(player(0,"table")) do
			msg2(id,string.char(169).."255255255"..player(pl,"name").." [#"..player(pl,"usgn").."]@"..player(pl,"ip"))
		end
		msg2(id,string.char(169).."255255255-----")
		return 1
	end
end

Like this?

alt Re: LUA: @listusers

inzec
User Off Offline

Zitieren
Yes that's almost perfect thankyou.

Is there anyway you can also get the users USGN Name as well as the ID. I would assume you would need the USGN info like this: https://gist.github.com/1130775

I'm not sure on how to code it in. ;s

alt Re: LUA: @listusers

Apache uwu
User Off Offline

Zitieren
Since that code is extremely large I will not post it.

Make sure that you copy this and place it before at the very top of the script.

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
--Remember to paste the usgn_names here
	
addhook("say","_say")

function _say(id,message)
	if message=="@listusers" then
		msg2(id,string.char(169).."255255255List of Players ("..#player(0,"table")..")")
		msg2(id,string.char(169).."255255255-----")
		for _,pl in pairs(player(0,"table")) do
			if usgn_name[player(pl,"usgn")]~=nil then
				msg2(id,string.char(169).."255255255"..player(pl,"name").." [#"..player(pl,"usgn").."/"..usgn_name[player(pl,"usgn")].."]@"..player(pl,"ip"))
			else
				msg2(id,string.char(169).."255255255"..player(pl,"name").." [#"..player(pl,"usgn").."]@"..player(pl,"ip"))
			end
		end
	msg2(id,string.char(169).."255255255-----")
	return 1
	end
end
Zum Anfang Vorherige 1 Nächste Zum Anfang
Einloggen, um zu antwortenGeneral-ÜbersichtCS2D-ÜbersichtForenübersicht