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
dofile("sys/lua/wrapper.lua")
if script==nil then script={} end
script.jail={}
function initArray(m)
	local array = {}
	for i = 1, m do
		array[i]=0
	end
	return array
end
script.jail.prisonerstat=initArray(32)
script.jail.lkills=initArray(32)
script.jail.rank=initArray(32)
script.jail.guardstat=initArray(32)
script.jail.headguard=initArray(32)
parse("mp_unbuildable turret")
addhook("collect","script.jail.collect")
function script.jail.collect(id,type)
	if type==3 then
		msg2(id, "You have picked up a medgun, shots will heal enemies")
	end
end
addhook("spawn","script.jail.spawn")
function script.jail.spawn(id)
	if script.rp.headguard(id)==1 then
		return 32,4,59,80
	end
	if player(id,"team")==2 then	
		if script.jail.rank[id]=1 then
			image("gfx/Snowy Prison/private.bmp",0,0,200+id)	-- Create image @ Player
			imagecolor(id,0,0,0)						-- Make stripe black
			imageblend(id,1)								-- Make image glow
			imagealpha(id,0.5)	
		end
		if script.jail.rank[id]=2 then
		--Image Code goes here
		end
		if script.jail.rank[id]=3 then
		--Image Code goes here
		end
		if script.jail.rank[id]=4 then
		--Image Code goes here
		end
		if script.jail.rank[id]=5 then
		--Image Code goes here
		end
	end
end
addhook("kill","script.jail.frag")
function script.jail.frag(killer,victim,type)
	if player(killer, "team")==2 and player(victim, "team")==1 then
		if script.jail.prisonerstat[victim]==0 then
			msg2(killer,"O.o A bit trigger happy, no?")
		end
		if script.jail.prisonerstat[victim]==1 then
			msg2(killer,"Good Job!")
			script.jail.lkills[killer]=script.jail.lkills[killer]+1
			if script.jail.lkills[killer]<=3 then
				
		end
	end
	if player(killer, "team")==1 and player(victim, "team")==2 then
		script.jail.prisonerstat[killer]=1
		msg2(killer, "Quick, escape... they'll hunt you now")
	end
end
	
addhook("hit","script.jail.hit")
function script.jail.hit(id,source,weapon,hpdmg,apdmg)
	if player(id, "team")==1 and player(source, "team")==2 and script.jail.prisonerstat[id]==0 then
		script.jail.guardstat[source]=1
	end
	if player(source, "team")==1 and player(id, "team")==2 then
		script.jail.prisonerstat[source]==1
	end
	if weapon==3 then
		--Deagle medgun
		hithp=player(id, "health")
		--heals for 30 HP
		sethealth(id,hithp+30)
		return 1
	end
	if weapon==50 and player(id, "team")==2 and player (source, "team")==2 then
	--CTs can knife each other to heal
		hithp=player(id, "health")
		sethealth(id,hithp+10)
		return 1
	end
end
addhook("join","script.jail.join")
function script.jail.join(p)
	msg2(p,"Welcome to the [CC] RP Server, "..player(p,"name").."!")
	msg2(p,"Please send any feedback to trotskygrad@gmail.com")
	script.jail.rank[p]=1
end
addhook("say","script.jail.say")
function script.jail.say(p,txt)
	-- Time e.g.: 04:36 pm
	if (txt=="time") then msg(os.date("Time: %I:%M %p")); end
	-- Date e.g.: Wednesday, 25 Feb 2009
	if (txt=="date") then msg(os.date("Date: %A, %d %b %Y")); end
	-- Slap me
	if (txt=="slap me") then parse("slap "..p); end
	-- Show idlers (idle for 10 secs or longer)
	if (txt=="idlers") then
		idlers=0
		for i=1,32 do
			if (player(i,"exists")) then
				if (player(i,"idle")>9) then
					idlers=idlers+1
					msg(player(i,"name").." is idle for "..player(i,"idle").." secs!")
				end
			end
		end
		if (idlers==0) then msg("Nobody idles!") end
	end
	
	-- SOUND: That's the way I like it
	if (txt=="the way") then parse("sv_sound \"fun/thats_the_way.wav\""); end
	-- SOUND: Okay let's go
	if (txt=="lets go") then parse("sv_sound \"hostage/hos2.wav\""); end
	-- SOUND: Buaraarahahrahrrrr harr!
	if (txt=="zombies!") then parse("sv_sound \"player/zm_spray.wav\""); end
	-- SOUND: Mystery
	if (txt=="mystery") then parse("sv_sound \"env/mystery.wav\""); end
	
	--Headguard enabler
	if (txt=="!headguard") then
		if player(p, "team")==2 then
			headguard=0
			for i=1,32 do
				if (player(i,"exists")) then
					if script.jail.headguard[i]==1 then
						headguard=1
					end
				end
			end
			if headguard==0 then
				script.jail.headguard[p]=1
				msg2(p,"You are now the Head Guard! Give orders to the guards to properly manage the prisoners")
			end
		end
	end
	--Rules
	if (txt=="!rules") then
		msg2(p,"Rules: 1. Do not freekill. Freekilling is defined as killing a prisoner who has not attacked a guard. Disobeying orders is a reason to kill a prisoner, but do not kill prisoners after thay disobey once.")
	end
end
--Armor stripper
addhook("startround","rstart")
function rstart()
for i = 1,32 do
if (player(i,"exists")) then
parse("strip "..i.." 0")
end
end
end
--reset parameters on leave
addhook("leave","script.jail.leave")
function script.jail.leave(id, reason)	
	script.jail.headguard[id]=0
	script.jail.lkills[id]=0
	script.jail.rank[id]=0
end