Forum

> > CS2D > Scripts > How to know the player number?
Forums overviewCS2D overview Scripts overviewLog in to reply

English How to know the player number?

12 replies
To the start Previous 1 Next To the start

old Re: How to know the player number?

BlazingStan
User Off Offline

Quote
user 4729 has written
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.

old Re: How to know the player number?

Majatek
User Off Offline

Quote
user Obviously Exactly Myself has written
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.
edited 1×, last 20.07.12 10:55:29 am

old Re: How to know the player number?

Avo
User Off Offline

Quote
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
edited 1×, last 26.07.12 04:37:17 pm

old Re: How to know the player number?

DannyDeth
User Off Offline

Quote
user Majatek has written
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.

old Re: How to know the player number?

EngiN33R
Moderator Off Offline

Quote
@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
To the start Previous 1 Next To the start
Log in to reply Scripts overviewCS2D overviewForums overview