Forum

> > CS2D > Scripts > How to know the player number?
ForenübersichtCS2D-Übersicht Scripts-ÜbersichtEinloggen, um zu antworten

Englisch How to know the player number?

12 Antworten
Zum Anfang Vorherige 1 Nächste Zum Anfang

alt Re: How to know the player number?

BlazingStan
User Off Offline

Zitieren
user 4729 hat geschrieben
Pleas hlep me !!!
Give me code pleas! very thenk!!!


Of cours my frend!!!
Hre you re!
No prblem!!!

Just joking. Press "Tab" and move your cursor to the player you want.

alt Re: How to know the player number?

Majatek
User Off Offline

Zitieren
user Obviously Exactly Myself hat geschrieben
Just kidding, heres the code...
Spoiler >

That's probably the most childish and retarded thing I've seen on this failing community yet. I remembered about a year ago when it wasn't filled with complete incompetent fuckwits who think that cracking jokes at the expense of others was funny.
Now we're getting comedians like you who think you're the funniest shit ever. I've seen better comedy come from the arse end of Nicolas Cage when he's been on the sets of a Z-grade movie.
1× editiert, zuletzt 20.07.12 10:55:29

alt Re: How to know the player number?

Avo
User Off Offline

Zitieren
Idiots...
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
function PlayersCount(mode)
	if not mode then mode=3 end
	if mode==0 then
		return (#player(0,"table")-#player(0,"team1")-#player(0,"team2"))
	elseif mode==1 then
		return #player(0,"team1")
	elseif mode==2 then
		return #player(0,"team2")
	elseif mode==3 then
		return #player(0,"table")
	elseif mode==4 then
		return #player(0,"team1living")
	elseif mode==5 then
		return #player(0,"team2living")
	end
end

Example of use:
PlayersCount(0) <-- return number of spectators
PlayersCount(1) <-- return number of all Terrorists
PlayersCount(2) <-- return number of all Counter-Terrorists
PlayersCount(3) <-- return number of all players
PlayersCount() <-- return number of all players
PlayersCount(4) <-- return number of living Terrorists
PlayersCount(5) <-- return number of living Counter-Terrorists
1× editiert, zuletzt 26.07.12 16:37:17

alt Re: How to know the player number?

DannyDeth
User Off Offline

Zitieren
user Majatek hat geschrieben
That's probably the most childish and retarded thing I've seen on this failing community yet. I remembered about a year ago when it wasn't filled with complete incompetent fuckwits who think that cracking jokes at the expense of others was funny.

Unfortunately, it's been like this for a while now.

Anyway, a simple script to show you the ID of the players as well as the number of players:
1
2
3
4
5
6
7
8
9
10
addhook("say","list_players")
function list_players(id,txt)
	if(txt="!playerlist")
		local plist = player(0,"table")
		msg2(id,""..(#plist))
		for k,v in pairs(plist) do
			msg2(id,v.." | "..player(v,"name"))		
		end
	end
end
It's untested, but I believe it should work.

alt Re: How to know the player number?

EngiN33R
Moderator Off Offline

Zitieren
@user DannyDeth: You forgot a 'then' after your if clause.

1
2
3
4
5
6
7
8
9
10
addhook("say","list_players")
function list_players(id,txt)
     if(txt="!playerlist") then
          local plist = player(0,"table")
          msg2(id,#plist)
          for k,v in pairs(plist) do
               msg2(id,v.." | "..player(v,"name"))          
          end
     end
end
Zum Anfang Vorherige 1 Nächste Zum Anfang
Einloggen, um zu antworten Scripts-ÜbersichtCS2D-ÜbersichtForenübersicht