I'm gonna add more, but this isn't working.
When I try to spawn, it bugs, and it doesn't add you to a team like it's supposed to. No syntax errors.
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
----------------
--Wall defense--
--Version 0.1 --
-- by boX --
----------------
--[[Changelog:
[Added]
A spawn script (Spawns players in their appropriate positions)
A team distributor (distributes players evenly between the four teams)
]]
--SETTINGS
parse('sv_gamemode 1')
parse('mp_building_health "Wall III" 2000')
--ARRAYS,TABLES AND VARIABLES
team = {}
team1 = 0
team2 = 0
team3 = 0
team4 = 0
--HOOKS
addhook('join','teamDivision')
addhook('spawn','baseSpawn')
--FUNCTIONS
function teamDivision(id)
if math.min(team1,team2,team3,team4)==team1 then
team[id] = 1
team1 = team1+1
elseif math.min(team1,team2,team3,team4)==team2 then
team[id] = 2
team2 = team2+1
elseif math.min(team1,team2,team3,team4)==team3 then
team[id] = 3
team3 = team3+1
elseif math.min(team1,team2,team3,team4)==team4 then
team[id] = 4
team4 = team4+1
msg(player(id,"name")..' is on Team '..team[id])
end
end
function baseSpawn(id)
if team[id]==1 then
x = 11 ; y = 40
elseif team[id]==2 then
x = 11 ; y = 10
elseif team[id]==3 then
x = 41 ; y = 10
elseif team[id]==4 then
x = 41 ; y = 40
end
parse('spawnplayer '..id..' '..x..' '..y)
end