Attempt to index field "select" (a function value)
Error on line 12! Thanks in advance!
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
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
if usebutton==nil then usebutton={} end
usebutton.select={}
addhook("usebutton","usebutton.select")
function usebutton.select(id)
if (x==3)and(y==1) then
menu(id,"SelectEquipment,LightArmor|25%,MediumArmor|50%,M4A1|Rifle")
end
end
addhook("menu","usebutton.select.menu")
function usebutton.select.menu(id,menu,sel)
if (menu=="SelectEquipment") then
if (sel>=0 and sel<=3) then
usebutton.select[id]=sel
end
end
end
addhook("spawn","usebutton.select.equip")
function usebutton.select.equip(id)
if (usebutton.select.equip[id]==1) then
parse ("speedmod "..id.." 0")
parse ("equip "..id.." 79")
msg(player(id,"name").."LightArmor")
end
if (usebutton.select.equip[id]==2) then
parse ("speedmod "..id.." -5")
parse ("equip "..id.." 80")
msg(player(id,"name").."MediumArmor")
end
if (usebutton.select.equip[id]==3) then
parse ("equip "..id.." 32")
msg(player(id,"name").."M4A1")
end
end
edited 1×, last 22.02.20 03:31:58 pm