Forum

> > CS2D > Scripts > maximum size of the team
ForenübersichtCS2D-Übersicht Scripts-ÜbersichtEinloggen, um zu antworten

Englisch maximum size of the team

14 Antworten
Zum Anfang Vorherige 1 Nächste Zum Anfang

alt Re: maximum size of the team

miere
User Off Offline

Zitieren
1
2
3
4
5
6
7
8
9
max = 5

addhook("team", "teamchange")
function teamchange(id, team, look)
	if #player(0, "team1") >= max
		msg2(id, "Too many terrorists!@C")
		return 1
	end
end

alt Re: maximum size of the team

DC
Admin Off Offline

Zitieren
The code of user miere always checks if there are too many Ts. Even if you try to switch to CT or Spectator. An additional condition is required.
1
2
3
4
5
6
7
8
9
10
11
maxTs = 5

addhook("team", "teamchange")
function teamchange(id, team, look)
	if team == 1
		if #player(0, "team1") >= maxTs
			msg2(id, "Too many terrorists!@C")
			return 1
		end
	end
end

alt Re: maximum size of the team

Soja1997
User Off Offline

Zitieren
Either you did not understand me or scripts do not work. want a script that allows you to only one terrorist in the team need this script to Predator Mod

alt Re: maximum size of the team

Happy eyes
User Off Offline

Zitieren
user Soja1997 hat geschrieben
Either you did not understand me or scripts do not work. want a script that allows you to only one terrorist in the team need this script to Predator Mod


just change max terrorists number from 5 to 1

alt Re: maximum size of the team

DC
Admin Off Offline

Zitieren
Well then take a look at the console and you quickly find the problem.
Zitat
LUA ERROR: sys/lua/autorun/myass.lua:6: 'then' expected near 'if'

We simply forgot to add "then".

Fixed version:
1
2
3
4
5
6
7
8
9
addhook("team", "teamchange")
function teamchange(id, team, look)
     if team == 1 then
          if #player(0, "team1") >= 1 then
               msg2(id, "Too many terrorists!@C")
               return 1
          end
     end
end

For the next time: Check the console output and tell us what it says instead of just saying "Dont work". It would help a lot.

alt Re: maximum size of the team

DC
Admin Off Offline

Zitieren
I tested it and it works for everyone. No matter if bot or human. Only one player can be T. Change >= 1 to >= 0 if you want nobody to be T. Bots that are made T will automatically become spec with this script because joining T will fail. You could refine this by using cs2d cmd makect
Also consider to disable cs2d cmd mp_autoteambalance - it might ignore the script but I'm not sure about that.

alt Re: maximum size of the team

Soja1997
User Off Offline

Zitieren
How to equip gasmask?
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
ERROR: equip - cannot equip 60 - Gas Mask (this would lead to problems)!
		parse ("equip "..id.." 31")
		parse ("equip "..id.." 60")
		parse ("equip "..id.." 72")
		parse ("equip "..id.." 49")
		parse ("equip "..id.." 4")
		parse ("equip "..id.." 51")
		parse ("equip "..id.." 73")
		parse ("equip "..id.." 89")
		parse ("equip "..id.." 89")
		parse ("equip "..id.." 89")													    parse ("equip "..id.." 76")
 		parse ("setmaxhealth "..id.." 180")
		parse ("setarmor "..id.." 200")
		parse ("speedmod "..id.." 5")
		return "31,60,72,49,4,51,73,89";
EDIT
I can join to bot when he is in terro
1
2
3
4
5
6
7
8
9
10
addhook("team", "teamchange")
function teamchange(id, team, look)
     if team == 1 then
          if #player(0, "team1") >= 1 then
               msg2(id, "Too many terrorists!@C")
               return 1
          end
     end

end

alt Re: maximum size of the team

Soja1997
User Off Offline

Zitieren
Ok Gasmask script works correctly but still 1 terrorist in team does not work
@EDIT
I if i change from ct to tt only show communicate you cant join terrorist team.
Zum Anfang Vorherige 1 Nächste Zum Anfang
Einloggen, um zu antworten Scripts-ÜbersichtCS2D-ÜbersichtForenübersicht