Mine here doesn't work for some reason. I use this Lives[] table.
And if the Lives get below 1 (0) then the player should not be
able to join a team.
In this case, he can.
Thanks!
- Anders4000
DC, please enable multiple spaces in the code tags.
My code below:
More 

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
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
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
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
--EDIT THESE SETTINGS FOR YOUR LIKING!
	--Settingname		 --Settings						--Standard settings
	StartingLives 		= 3								--3 (integer)
	StartingBullets		= 1								--1 (integer)
	NextMapType			= 1								--1 (1 = Restart map, 2 = Next map)
	Maps				= {"de_dust","de_dust2"}		--{"de_dust","de_dust2"}
	RandomSpawns		= 1								--1 (1 = Yes, 0 = No)
	LeftClickKnifeWorks	= 0								--0 (1 = Yes, 0 = No)
--END OF SETTINGS
function Array(m,v)
	local array = {}
	if v == nil then v = 0 end
	for i = 1,m do
		array[i] = v
	end
	return array
end
--Public Vars / Server initialization
if RandomSpawns == 0 then
	parse("mp_randomspawn 0")
else
	parse("mp_randomspawn 1")
end
if LeftClickKnifeWorks == 1 then
	parse("mp_wpndmg knife 100")
else
	parse("mp_wpndmg knife 0")
end
parse("sv_gamemode 1")
parse("mp_wpndmg_z1 knife 100")
parse("mp_wpndmg deagle 100")
TitlePos		= "260 40"
AuthorPos		= "270 55"
LivesPos		= "5 140"
BulletsPos		= "5 155"
KnifeWarning	= "5 170"
KnifeWarning2	= "5 185"
YouAreDeadPos	= "5 200"
Lives = Array(game("sv_maxplayers"),StartingLives)
Bullets = Array(game("sv_maxplayers"),StartingBullets)
function AutoSpec(id)
	Lives[id] = 0
	parse("makespec "..id)
	parse('hudtxt2 '..id..' 7 "©255000000You are dead."'..YouAreDeadPos)
end
addhook("spawn","OnSpawn")
function OnSpawn(id)
	if Lives[id] < 1 then
		AutoSpec(id)
	else
		Bullets[id] = 1
		parse("equip "..id.." 3")
		if player(id,"team") == 2 then		--2 = CT
			parse("strip "..id.." 1")			--1 = USP
		elseif player(id,"team") == 1 then	--1 = T
			parse("strip "..id.." 2")			--2 = Glock
		end
		parse("setweapon "..id.." 3")
	end
	parse('hudtxt2 '..id..' 3 "©000255000Lives: '..Lives[id]..'" '..LivesPos)
	parse('hudtxt2 '..id..' 4 "©000255000Bullets: '..Bullets[id]..'" '..BulletsPos)
end
addhook("die","OnDeath")
function OnDeath(victim)
	if Lives[victim] < 2 then
		parse("setdeaths "..victim.." 3")
		AutoSpec(victim)
	else
		Lives[victim] = Lives[victim] - 1
	end
	parse('hudtxt2 '..victim..' 3 "©000255000Lives: '..Lives[victim]..'" '..LivesPos)
end
addhook("team","OnTeam")
function OnTeam(id,team)
	if Lives[id] < 1 then
		return 1
	end
end
edited 2×, last 26.01.11 02:44:45 pm
AutoSpec Solution
1 
Offline