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
local items = {
	-- {[item-type], [price]}
	{51, 50},
	{52, 25}
}
function serveractionhook(id, action)
	if (action == 2) then
		local content = ""
		
		for index, item in ipairs(items) do
			content = content .. itemtype(item[1], "name") .. "|$" .. item[2] .. (index == #items and "" or ",")
		end
		
		menu(id, "Shop Menu," .. content)
	end
end
function menuhook(id, title, button)
	if (title == "Shop Menu") then
		if (button >= 1 and button <= 9) then
			local item = items[button]
			
			if (player(id, "money") >= item[2]) then
				parse("equip " .. id .. " " .. item[1] .. "; setmoney " .. id .. " " .. (player(id, "money") - item[2]), 0)
			else
				msg2(id, "\169255000000You have insufficient funds!")
			end
		end
	end
end
addhook("serveraction", "serveractionhook")
addhook("menu", "menuhook")