Forum

> > CS2D > Scripts > Class
Forums overviewCS2D overview Scripts overviewLog in to reply

English Class

6 replies
To the start Previous 1 Next To the start

old Class

Spook MQ Hacker
BANNED Off Offline

Quote
Hey EVERYONE How to MAKE a Class for Terrorist only?

Maybe this is RIGHT

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
85
86
87
88
89
90
91
92
93
94
95
96
addhook("serveraction","sample.classes.serveraction")
function sample.classes.serveraction(id)
	sample.classes.classmenu(id)
end



addhook("menu","sample.classes.menu")
function sample.classes.menu(id,menu,sel)
	if (menu=="Select your Class") then
		if (sel>=0 and sel<=6) then
			sample.classes.class[id]=sel
			if (player(id,"health")>0) then
				parse("killplayer "..id)
			end
		end
	end
end



addhook("spawn","sample.classes.spawn")
function sample.classes.spawn(id)
	-- SOLDIER
	if (sample.classes.class[id]<=1) then
		parse ("setmaxhealth "..id.." 150")
		parse ("setarmor "..id.." 202")
		parse ("speedmod "..id.." -5")
		return "40,4,51";
	end
	-- SPY
	if (sample.classes.class[id]==2) then
		parse ("setmaxhealth "..id.." 100")
		parse ("setarmor "..id.." 206")
		parse ("speedmod "..id.." 5")
		return "21,1";
	end
	-- ENGINEER
	if (sample.classes.class[id]==3) then
		parse ("setmaxhealth "..id.." 100")
		parse ("setarmor "..id.." 50")
		return "10,2,74";
	end
	-- PYRO
	if (sample.classes.class[id]==4) then
		parse ("setmaxhealth "..id.." 125")
		parse ("setarmor "..id.." 75")
		return "46,6,73";
	end
	-- SCOUT
	if (sample.classes.class[id]==5) then
		parse ("setmaxhealth "..id.." 75")
		parse ("setarmor "..id.." 0")
		parse ("speedmod "..id.." 15")
		return "5,69,54";
	end
	-- SNIPER
	if (sample.classes.class[id]==6) then
		parse ("setmaxhealth "..id.." 75")
		parse ("setarmor "..id.." 25")
		return "35,3,53";
	end
end



addhook("buy","sample.classes.buy")
function sample.classes.buy()
	return 1
end



addhook("walkover","sample.classes.walkover")
function sample.classes.walkover(id,iid,type)
	if (type>=61 and type<=68) then
		return 0
	end
	return 1
end


-----------------------
-- NO DROPPING       --
-----------------------
addhook("drop","sample.classes.drop")
function sample.classes.drop()
	return 1
end



addhook("die","sample.classes.die")
function sample.classes.die()
	return 1
end

Maybe this is RIGHT one

old Re: Class

Kel9290
User Off Offline

Quote
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
85
86
87
88
89
90
91
92
93
94
95
96
97
98
addhook("serveraction","sample.classes.serveraction")
function sample.classes.serveraction(id)
     sample.classes.classmenu(id)
end



addhook("menu","sample.classes.menu")
function sample.classes.menu(id,menu,sel)
     if (menu=="Select your Class") then
	  if player(id,"team")==1 then
            if (sel>=0 and sel<=6) then
               sample.classes.class[id]=sel
               if (player(id,"health")>0) then
                    parse("killplayer "..id)
                  end
               end
          end
     end
end



addhook("spawn","sample.classes.spawn")
function sample.classes.spawn(id)
     -- SOLDIER
     if (sample.classes.class[id]<=1) then
          parse ("setmaxhealth "..id.." 150")
          parse ("setarmor "..id.." 202")
          parse ("speedmod "..id.." -5")
          return "40,4,51";
     end
     -- SPY
     if (sample.classes.class[id]==2) then
          parse ("setmaxhealth "..id.." 100")
          parse ("setarmor "..id.." 206")
          parse ("speedmod "..id.." 5")
          return "21,1";
     end
     -- ENGINEER
     if (sample.classes.class[id]==3) then
          parse ("setmaxhealth "..id.." 100")
          parse ("setarmor "..id.." 50")
          return "10,2,74";
     end
     -- PYRO
     if (sample.classes.class[id]==4) then
          parse ("setmaxhealth "..id.." 125")
          parse ("setarmor "..id.." 75")
          return "46,6,73";
     end
     -- SCOUT
     if (sample.classes.class[id]==5) then
          parse ("setmaxhealth "..id.." 75")
          parse ("setarmor "..id.." 0")
          parse ("speedmod "..id.." 15")
          return "5,69,54";
     end
     -- SNIPER
     if (sample.classes.class[id]==6) then
          parse ("setmaxhealth "..id.." 75")
          parse ("setarmor "..id.." 25")
          return "35,3,53";
     end
end



addhook("buy","sample.classes.buy")
function sample.classes.buy()
     return 1
end



addhook("walkover","sample.classes.walkover")
function sample.classes.walkover(id,iid,type)
     if (type>=61 and type<=68) then
          return 0
     end
     return 1
end


-----------------------
-- NO DROPPING --
-----------------------
addhook("drop","sample.classes.drop")
function sample.classes.drop()
     return 1
end



addhook("die","sample.classes.die")
function sample.classes.die()
     return 1
end

old Re: Class

Apache uwu
User Off Offline

Quote
Use hax press f2 then switch teams then click on the class.

You should have that team check on menu as well.

old Re: Class

Spook MQ Hacker
BANNED Off Offline

Quote
i should agree with Kel9290

maybe not


1
2
3
LUA ERROR: sys/lua/testlua1.lua:41: attempt to index field 'class' (a nil value).
LUA ERROR: sys/lua/testlua1.lua:41: attempt to index field 'class' (a nil value).
LUA ERROR: sys/lua/testlua1.lua:14: attempt to call field 'classmenu' (a nil value).

cookies
edited 2×, last 05.08.11 02:37:57 pm

old Re: Class

Kel9290
User Off Offline

Quote
Spoiler >
edited 3×, last 05.08.11 02:50:06 pm

old Re: Class

DannyDeth
User Off Offline

Quote
Kel, remove 'function' form behind the function calls. 'function' is only needed when defining something:
1
2
3
4
5
6
7
-- define my_function
function my_function()
	print("LOL HAI!")
end

-- call my_function
my_function()
To the start Previous 1 Next To the start
Log in to reply Scripts overviewCS2D overviewForums overview