English maximum size of the team

14 replies
Goto Page
To the start Previous 1 Next To the start
03.09.12 10:10:02 am
Up
Soja1997
User
Offline Off
Hi I need your help, Can someone write a script in which the maximum number of terrorists.
03.09.12 10:20:25 am
Up
miere
User
Offline Off
Code:
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
03.09.12 10:41:42 am
Up
Soja1997
User
Offline Off
Thanks you!
@user miere: I just checked the script and it does not work
03.09.12 11:16:33 am
Up
DC
Admin
Offline Off
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.
Code:
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
www.UnrealSoftware.de | www.CS2D.com | www.CarnageContest.com | Use the forum & avoid PMs!
03.09.12 11:58:52 am
Up
Soja1997
User
Offline Off
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
03.09.12 12:51:25 pm
Up
Happy eyes
User
Offline Off
user Soja1997 has written:
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
03.09.12 01:11:39 pm
Up
Soja1997
User
Offline Off
Dont work . ;< if you dont trust me please check this script
03.09.12 01:26:46 pm
Up
DC
Admin
Offline Off
Well then take a look at the console and you quickly find the problem.
Quote:
LUA ERROR: sys/lua/autorun/myass.lua:6: 'then' expected near 'if'

We simply forgot to add "then".

Fixed version:
Code:
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.
www.UnrealSoftware.de | www.CS2D.com | www.CarnageContest.com | Use the forum & avoid PMs!
03.09.12 02:41:23 pm
Up
Soja1997
User
Offline Off
sorry for problems i forgot to copy and paste error on forum
edit
Can I still join a team of terrorists when one person
03.09.12 02:46:33 pm
Up
escarabajo
User
Offline Off
Lol ploblem of bot xd
edited 1×, last 03.09.12 02:48:12 pm
03.09.12 02:47:33 pm
Up
Soja1997
User
Offline Off
so with bots does not work ? if yes sorry for problems
03.09.12 03:00:50 pm
Up
DC
Admin
Offline Off
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.
www.UnrealSoftware.de | www.CS2D.com | www.CarnageContest.com | Use the forum & avoid PMs!
03.09.12 03:11:26 pm
Up
Soja1997
User
Offline Off
How to equip gasmask?
Code:
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
Code:
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
03.09.12 06:36:12 pm
Up
VADemon
User
Offline Off
@user Soja1997:
DO NOT USE cs2d cmd equip IN A cs2d lua hook spawn HOOK!
It was said hundeds of times! Use return values instead (as you did below)

2) The script works perfectly.

PS: Better you show us the whole function next time
04.09.12 10:22:25 pm
Up
Soja1997
User
Offline Off
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.
To the start Previous 1 Next To the start