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
items = {
{title ="Medikit",price = 500,cmd = "equip",param=64},
{title ="Bandage",price = 100,cmd = "equip",param=65},
{title = "Vodka",price=100,cmd = "shake",param=20000},
{title = "PrimaryAmmo",price=300,cmd = "equip",param=61},
{title = "SecondaryAmmo",price=300,cmd = "equip",param=62},
{title = "Snowball",price=3000,cmd = "equip",param=75},
{title = "Armor100",price=1000,cmd = "setarmor",param=100},
{title = "Armor200",price=3000,cmd = "setarmor",param=200},
{title = "Speed x5",price=1000,cmd = "speedmod",param=25},
{title = "Speed x10",price=3000,cmd = "speedmod",param=50},
{title = "MAC10",price=16000,cmd = "equip",param=23}
}
function createMenu(header, matrix)
local menuString = header;
menuString = menuString..", "
for key, value in ipairs(matrix) do
menuString = menuString..value.title.." | $"..tostring(value.price).. ","
end
return menuString
end
addhook("serveraction","my_serveraction")
function my_serveraction(id,action)
if(action == 1) then
menu(id,createMenu("Items",items))
end
end
addhook("menu","my_menu")
function my_menu(id,title,button)
if(button == 0) then
return
end
if(title == "Items") then
if(player(id,"money") > items[button].price) then
parse("setmoney "..id.." "..(player(id,"money") - items[button].price))
cmd = string.format("%s %i %i",items[button].cmd,id,items[button].param)
parse(cmd)
else
msg2(id,"©255000000 You have insufficient funds!")
end
end
end
Hey can you make next page? only 9 items are located at this page