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
----------------------
-- op4-cs2d-lua --
----------------------
--damage changes
parse("mp_wpndmg machete 47")
parse("mp_wpndmg glock 12")
parse("mp_wpndmg elite 12")
parse("mp_wpndmg knife 10")
parse("mp_wpndmg m249 15")
parse("mp_wpndmg mp5 12")
parse("mp_wpndmg m4a1 12")
parse("mp_wpndmg deagle 34")
parse("mp_wpndmg \"Grenade launcher\" 93")
parse("mp_wpndmg awp 80")
parse("mp_wpndmg scout 10")
parse("mp_wpndmg_z1 awp 115")
parse("mp_wpndmg_z2 awp 150")
parse("mp_wpndmg_z1 scout 100")
parse("mp_wpndmg_z2 scout 115")
--0
xbow_zoom={}
for i = 1, 32 do
	xbow_zoom[i]=0
end
--hooks
addhook("reload","op4_rw")
addhook("select","op4_sel")
addhook("attack2","op4_rf2")
addhook("hit","op4_hit")
--funcs
function op4_rw(id,mode)
	if (mode==1) then
		if (player(id,"weapontype")==2) then
			parse("sv_sound2 "..id.." \"op4_reload/glock_reload1.wav\"")
		elseif (player(id,"weapontype")==3) then
			parse("sv_sound2 "..id.." \"op4_reload/deagle_reload1.wav\"")
		elseif (player(id,"weapontype")==5) then
			parse("sv_sound2 "..id.." \"op4_reload/glock_reload1.wav\"")
		elseif (player(id,"weapontype")==10) then
			parse("sv_sound2 "..id.." \"op4_reload/shotgun_reload.wav\"")
		elseif (player(id,"weapontype")==20) then
			parse("sv_sound2 "..id.." \"op4_reload/mp5_reload.wav\"")
		elseif (player(id,"weapontype")==32) then
			parse("sv_sound2 "..id.." \"op4_reload/mp5_reload.wav\"")
		elseif (player(id,"weapontype")==34) then
			parse("sv_sound2 "..id.." \"op4_reload/xbow_reload1.wav\"")
		elseif (player(id,"weapontype")==35) then
			parse("sv_sound2 "..id.." \"op4_reload/m40a1_reload.wav\"")
		elseif (player(id,"weapontype")==40) then
			parse("sv_sound2 "..id.." \"op4_reload/m249_reload.wav\"")
		elseif (player(id,"weapontype")==49) then
			parse("sv_sound2 "..id.." \"op4_reload/splauncher_reload.wav\"")
		end
	elseif (mode==2) then
		if (player(id,"weapontype")==2) then
			parse("sv_sound2 "..id.." \"op4_reload/glock_reload2.wav\"")
		elseif (player(id,"weapontype")==5) then
			parse("sv_sound2 "..id.." \"op4_reload/glock_reload2.wav\"")
		elseif (player(id,"weapontype")==10) then
			parse("sv_sound2 "..id.." \"op4_reload/shotgun_cock.wav\"")
		end
	end
end
function op4_sel(id,type)
	if(type==34) then
		xbow_zoom[id]=0
	end
end
function op4_rf2(id)
	if (player(id,"weapontype")==34) then
		if (xbow_zoom[id]<2) then
			xbow_zoom[id]=xbow_zoom[id]+1
		else
			xbow_zoom[id]=0
		end
	end
end
function op4_hit(id,source,weapon)
	if (weapon==34) then
		if (xbow_zoom[source]==0) then
			parse("explosion "..player(id,"x").." "..player(id,"y").." 64 35 "..source)
			return 0
		end
	end
end