English Only one person can join ct.

6 replies
Goto Page
To the start Previous 1 Next To the start
24.03.12 01:49:18 pm
Up
Computerguy419
User
Offline Off
I was given this script:

<code>
adminlist = {86418,86597}

addhook("team","checker")
function checker(id,team)
if team==2 then
for _, hasil in ipairs(adminlist) do
if player(id,"usgn")==hasil then
return 0
else
parse("maket "..id)
return 1
end
end
end
end
<code/>

It only lets on person join the ct at a time but I want everyone in the adminlist to join ct. Can I have some help?

√ Computerguy419
-=8BA=- Computerguy419
24.03.12 03:07:50 pm
Up
PyKemis
User
Offline Off
Like this?

Code:
1
2
3
4
5
6
7
8
9
10
11
12
13
14
adminlist = {86418,86597}

addhook("team","checker")
function checker(id,team)
     if team==2 then
          for _, hasil in ipairs(adminlist) do
               if player(id,"usgn")==hasil then
                    return 0
               end
          end
          parse("maket "..id)
          return 1
     end
end
24.03.12 06:22:09 pm
Up
VADemon
User
Offline Off
Code:
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
adminlist = {86418,86597}

addhook("team","checker")
function checker(id,team)
     if team==2 then
          local move_back = true
          for _, hasil in ipairs(adminlist) do
               if player(id,"usgn")==hasil then
                    move_back = false
                    break
               end
          end
          if move_back then
               return 1
          end
     end
end

Should work.
@user PyKemis:
Two returns? I don't like it
24.03.12 06:24:06 pm
Up
PyKemis
User
Offline Off
I don't see what's wrong with 2 returns, besides; lua is a language that has goto
24.03.12 07:37:30 pm
Up
EngiN33R
Moderator
Offline Off
Two returns are just fine; the way user PyKemis uses them is actually a bit better.
I code, therefore I exist. | Visit my blog for Lua tips and other interesting info
27.03.12 03:43:48 pm
Up
Computerguy419
User
Offline Off
Thanks guys it works
-=8BA=- Computerguy419
To the start Previous 1 Next To the start