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
function initArray2(f,v)
local cmd={}
for c=1,f do
cmd[c]=v
end
return cmd
end
upgraded=initArray2(32,false)
upgradedw=initArray2(32,0)
addhook("usebutton","packapunchp")
function packapunchp(id,x,y)
	if (x==BUTTONX and y==BUTTONY) then
		if (player(id,"money")>=5000) then
			parse("setmoney "..id.." "..(player(id,"money")-5000))
			upgradedw[id]=player(id,"weapon")
			upgraded[id]=true
			msg2(id,"You have upgraded your "..itemtype(upgradedw[id],"name")..".")
		end
	end
end
addhook("hit","packapunchh")
function packapunchh(id,src,w,hp,ap)
	if (upgraded[src]) then
		if (w==upgradedw[src]) then
			parse("sethealth "..id.." "..(player(id,"health")-(hp*2)))
			if (ap>0) then
				parse("setarmor "..id.." "..(player(id,"armor")-(ap*2)))
			end
		end
	end
end
addhook("die","packapunchf")
function packapunchf(id)
	if (upgraded[id]) then
		upgraded[id]=false
		upgradedw[id]=0
	end
end