Forum

> > CS2D > Maps/Editor > Costume Classes
Forums overviewCS2D overview Maps/Editor overviewLog in to reply

English Costume Classes

4 replies
To the start Previous 1 Next To the start

old Costume Classes

DragonoidKiks
User Off Offline

Quote
Hi i was playing with some other people and realized that they had costume classes but i cant find how to make my own on my server

old Re: Costume Classes

Avo
User Off Offline

Quote
Costume classes script recipe:
Ingredients:
• classes script
• hats script
Write a script with classes or use DC's sample. Then write your own or download from the file archive - hats script. Mix them together and boil for 10 minutes. After 10 minutes it's ready. Bon apetit.


Or ask those people for a script they were using. Even simpler will be searching the f.a. There are thousands scripts like that which you need. Just try to edit one of them.

old Re: Costume Classes

M0BSTAZ
User Off Offline

Quote
It's easy like this..

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
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
--             Classes Script by MOBSTAZ         --
      --                  2014 / 18 / 2                        --
--                            129012                                   --
-----------------------------------------------------------------



admin = {XXXXXX} <-- Put USGN here

addhook("say","txt")
function txt(id,txt)
for _, usgn in ipairs(admin) do
if player(id,'usgn') == usgn then
msg("©255000000[Admin] "..player(id,"name")..": "..txt)
return 1
end
end
end

parse('mp_building_limit "dispenser" 0')
parse('mp_building_limit "turret" 100')
parse('mp_building_limit "supply" 0')
parse('mp_building_limit "gate field" 100')
parse('mp_building_limit "wall I" 100')
parse('mp_building_limit "wall II" 100')
parse('mp_building_limit "wall III" 100')
parse('mp_building_limit "barbed wire" 100')
parse('mp_building_limit "Barricade" 100')
parse('mp_building_limit "teleporter exit" 1')
parse('mp_building_limit "teleporter entrance" 1')
parse('mp_building_price "turret" 0')
parse('mp_building_price "gate field" 0')
parse('mp_building_price "wall I" 0')
parse('mp_building_price "wall II" 0')
parse('mp_building_price "wall III" 0')
parse('mp_building_price "barbed wire" 0')
parse('mp_building_price "Barricade" 0')
parse('mp_building_price "teleporter exit" 0')
parse('mp_building_price "teleporter entrance" 0')
parse("mp_infammo 1")


plsinf = {}
plsinf.class = { 0 }
plsinf.power = { 0 }
----------------------
for inx = 1,33 do
	plsinf.class[inx] = 0
	plsinf.power[inx] = 0
end
----------------------
plclss =
{
	{ "Soldier",		100,	0,		79, 2, 0	},
	{ "Hard soldier",	150,	-10,	80, 4, 0	},
	{ "Defender",		120,	-10,	81, 3, 41	},
	{ "Engineer",		120,	0,		79, 2, 74	},
	{ "Medic",			150,	-5,		82, 2, 0	},
	{ "Hunter",			100,	30,		84, 1, 0	},
	{ "Pyromaniac",		100,	5,		79, 0, 0	},
	{ "Tank",			250,	-18,	83, 0, 0	}
}
----------------------
clsitm =
{
	{ 51, 51, 51 },
	{ 0, 0, 0  },
	{ 76, 89, 53  },
	{ 77, 87, 0  },
	{ 86, 86, 86  },
	{ 53, 53, 0  },
	{ 73, 0, 0  },
	{ 0, 0, 0  }
}
----------------------
clswnp = 
{
	{ [0]=9, 10, 11, 20, 22, 38, 30, 31, 32, 33  },
	{ [0]=5, 40, 48, 49, 90, 91  },
	{ [0]=2, 69, 85 },
	{ [0]=6, 1, 2, 3, 4, 5, 6 },
	{ [0]=3, 21, 23, 24 },
	{ [0]=4, 34, 35, 36, 37 },
	{ [0]=1, 46 },
	{ [0]=2, 47, 90 }
}
----------------------
-- main hooks --
----------------------
addhook("team","pclsw_team")
function pclsw_team(id,team)
	if(team > 0) then
		menu(id, "Select class,Soldier,Hard soldier,Defender,Engineer,Medic,Hunter,Pyromaniac,Tank")
	end
end
----------------------
function pclsw_givitms(id, class)

	if(clsitm[class][1] ~= 0) then parse("equip "..id.." "..clsitm[class][1]) end
	if(clsitm[class][2] ~= 0) then parse("equip "..id.." "..clsitm[class][2]) end
	if(clsitm[class][3] ~= 0) then parse("equip "..id.." "..clsitm[class][3]) end

end
----------------------
addhook("spawn","pclsw_spawn")
function pclsw_spawn(id)

	pclass = plsinf.class[id]
	if(pclass ~= 0) then
		parse("strip "..id.." all")
		parse("setmaxhealth "..id.." "..plclss[pclass][2])
		parse("speedmod "..id.." "..plclss[pclass][3]) 
		if(plclss[pclass][4] ~= 0) then parse("equip "..id.." "..plclss[pclass][4]) end
		if(plclss[pclass][5] ~= 0) then parse("equip "..id.." "..plclss[pclass][5]) end
		if(plclss[pclass][6] ~= 0) then parse("equip "..id.." "..plclss[pclass][6]) end	
		
		pclsw_givitms(id, pclass)
		
		-- menu weapon --
		mnstr = "Select weapon"
		for id = 1,clswnp[pclass][0] do
			mnstr = mnstr ..","..itemtype(clswnp[pclass][id], "name")
		end
		menu(id,mnstr)
				
		if(pclass == 3 or pclass == 5) then msg2(id, "©255255255 PRESS 'E' TO DROP MEDKIT OR AMMO") end
	end

end
----------------------
addhook("menu","pclsw_menu")
function pclsw_menu(id,mn,sel)

	-- sel class --
	if(mn == "Select class") then
		if(sel > 0 and sel < 9) then
			plsinf.class[id] = sel
		else
			menu(id, "Select class,Soldier,Hard soldier,Defender,Engineer,Medic,Hunter,Pyromaniac,Tank")
		end
		parse("killplayer "..id) 
	elseif(mn == "Select weapon") then
		if(sel > 0) then
			parse("equip "..id.." "..clswnp[plsinf.class[id]][sel])
		else
			parse("equip "..id.." "..clswnp[plsinf.class[id]][1])
		end
		plsinf.power[id] = 100
	end
	
end
----------------------
--- util hooks ---
----------------------
addhook("drop","pclsw_drop") 
function pclsw_drop(id, iid)
	timer(0,"parse","removeitem "..iid)
end
----------------------
addhook("die","pclsw_die") 
function pclsw_die(victim)
	plsinf.power[victim] = 0
	return 1
end
----------------------
addhook("buy","pclsw_buy")
function pclsw_buy()
	return 1
end
----------------------
addhook("walkover","pclsw_walkover")
function pclsw_walkover(id,iid,type)
	if(type > 60 and type < 72) then
		if(type == 61) then	
			pclsw_givitms(id, plsinf.class[id])
			parse("setmoney "..id.." "..player(id,"money")+1000)
			parse("removeitem "..iid)
		end
		return 0
	end
	return 1
end
----------------------
addhook("use","pclsw_use")
function pclsw_use(id, event)
	
	if(event == 0) then
		if(plsinf.class[id] == 3 and pclsw_strippow(id, 30) == true ) then
			parse("spawnitem 61 "..player(id, "tilex").." "..player(id, "tiley"))
		elseif(plsinf.class[id] == 5 and pclsw_strippow(id, 20) == true ) then
			parse("spawnitem 65 "..player(id, "tilex").." "..player(id, "tiley"))
		end
	end

end
----------------------
addhook("second","pclsw_second")
function pclsw_second()

	for pid = 1,32 do
		if(plsinf.power[pid] < 100) then 
			plsinf.power[pid] = plsinf.power[pid] + 2
			if(plsinf.power[pid] > 100) then plsinf.power[pid] = 100 end
		end
	end
	
end
----------------------
function pclsw_strippow(id, pow)

	if(plsinf.power[id] >= pow) then
		plsinf.power[id] = plsinf.power[id] - pow
		msg2(id, "©255255255 YOUR POWER: "..plsinf.power[id])
		return true
	end
	msg2(id, "©255255255 YOUR POWER: "..plsinf.power[id])
	
return false
end
----------------------
addhook("build","pclsw_build")
function pclsw_build(id, type, x, y)

	if(plsinf.class[id] == 4 ) then
		if(type > 0 and type < 15) then
			if(pclsw_strippow(id, (5+type)) == true) then
				parse("spawnobject "..type.." "..x.." "..y.." 0 0 "..player(id,"team").." "..id)
			end
		elseif(type == 20 or type == 21) then
			return 0
		end
	end
	
return 1
end

old Re: Costume Classes

Dousea
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
99
100
101
102
103
104
function initarray (value)
	local array = {}
	for id = 1, 32 do
		array[id] = value
	end
	return array
end

selection = initarray(0)

classes = {
	{
		name = "Assault";
		description = "Normal Soldier";
		health = 250;
		armor = 100;
		speed = 0;
		weapon = {6; 32};
	};
	{
		name = "Engineer";
		description = "Build Stuff";
		health = 200;
		armor = 150;
		speed = 0;
		weapon = {4; 22; 74};
	};
	{
		name = "Medic";
		description = "Heal Yourself";
		health = 150;
		armor = 200;
		speed = 0;
		weapon = {6; 24; 82};
	};
	{
		name = "Support";
		description = "Heavy Gun";
		health = 100;
		armor = 200;
		speed = 0;
		weapon = {5; 40};
	};
}

function classmenu (id)
	local str = ""
	for key = 1, #classes do
		str = str .. classes[key].name .. "|" .. classes[key].description .. ","
	end
	menu(id, "Select Your Class@b," .. str)
end

local hooks = {"join"; "serveraction"; "menu"; "spawn"}
for _, hook in pairs(hooks) do
	addhook(hook, hook .. "hook")
end

function joinhook (id)
	classmenu(id)
end

function serveractionhook (id, action)
	if (action == 1) then
		classmenu(id)
	end
end

function menuhook (id, title, button)
	if (title == "Select Your Class") then
		if (button ~= 0) then
			selection[id] = button
			local char = string.char(169)
			local function message(id, msg)
				msg2(id, char .. "255255255" .. msg)
			end
			message(id, "You chose " .. char .. "255000000" .. classes[button].name .. " " .. char .. "255255255class@C")
			timer(2000, "noticemessage")
			function noticemessage ()
				message(id, "Your class will be changed after spawn@C")
			end
		end
	end
end

function spawnhook (id)
	local s = selection[id]
	if (s > 0) then
		parse("sethealth " .. id .. " " .. classes[s].health)
		parse("setmaxhealth " .. id .. " " .. classes[s].health)
		parse("setarmor " .. id .. " " .. classes[s].armor)
		parse("speedmod " .. id .. " " .. classes[s].speed)
		parse("strip " .. id .. " 0")
		if (type(classes[s].weapon) == "table") then
			for _, item in pairs(classes[s].weapon) do
				parse("equip " .. id .. " " .. item)
				parse("setweapon " .. id .. " " .. item)
			end
		else
			parse("equip " .. id .. " " .. classes[s].weapon)
			parse("setweapon " .. id .. " " .. classes[s].weapon)
		end
	end
end
I am trying to make this script readable as possible. You can add a new class. In game you can change your class by pressing Server Action 1 (F2 by default). This script have limitations of course, you can't add over 9 classes. I want to add it but I only give you the simple script.

old Re: Costume Classes

N13-SHADOW
User Off Offline

Quote
why not this?
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
----------------------------
-- Fast & Unlimited Build --
-- By SHADOW ----
----------------------------
addhook("buildattempt","FUBuild")
addhook("objectupgrade","FUpgrade")

function FUBuild(p,t,x,y,i)
 if t==20 or t==21 then
  return 0 
 end
 parse('spawnobject '..t..' '..x..' '..y..' 0 0 '..player(p,"team")..' '..p)
 return 1
end

function FUpgrade(i,p,g,t)
 t=object(i,"type")

 if t==1 then t=3
 elseif t==3 then t=4
 elseif t==4 then t=5
 elseif t==8 then t=11
 elseif t==11 then t=12
 elseif t==9 then t=15 end
 
 n=player(p,"team")
 x=object(i,"tilex")
 y=object(i,"tiley")
 r=object(i,"rot")
 m=object(i,"mode")
 d=object(i,"player")
 
 parse("killobject "..i)
 parse("spawnobject "..t.." "..x.." "..y.." "..r.." "..m.." "..n.." "..p)
 return 1
end




why not this?
To the start Previous 1 Next To the start
Log in to reply Maps/Editor overviewCS2D overviewForums overview