-> sys/lua/bul.lua:42: in function <sys/lua/bul.lua:33>
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
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
function initArray(m)
local array = {}
for i = 1, m do
array[i]=0
end
return array
end
pistol_ammo=initArray(32)
ar_ammo=initArray(32)
rpg_ammo=initArray(32)
pistol = {1,2,3,4,5,6}
function contains(table, element)
for _, value in pairs(table) do
if value == element then
return true
end
end
return false
end
addhook("say","says")
function says(id,say)
if (say=="hi") then
pistol_ammo[id]=pistol_ammo[id]+1000
ar_ammo[id]=ar_ammo[id]+1000
rpg_ammo[id]=rpg_ammo[id]+1000
end
end
addhook("ms100","alw")
function alw(id)
for _, id in pairs(player(0,'table')) do
if player(id,"team")==2 then
parse('hudtxt2 '..id..' 0 "©255255255pistol ammo: '..pistol_ammo[id]..' " 13 140')
parse('hudtxt2 '..id..' 1 "©255255255rifle ammo: '..ar_ammo[id]..' " 13 160')
parse('hudtxt2 '..id..' 2 "©255255255rpg ammo: '..rpg_ammo[id]..' " 13 180')
end
if pistol_ammo[id]==0 then
parse("setammo "..id.." "..pistol.." 0 0 ")
end
if pistol_ammo[id]>0 then
parse("setammo "..id.." "..pistol.." 1 0 ")
end
if ar_ammo[id]==0 then
parse("setammo "..id.." 32 0 0 ")
end
if ar_ammo[id]>0 then
parse("setammo "..id.." 32 1 0 ")
end
if rpg_ammo[id]==0 then
parse("setammo "..id.." 46 0 0 ")
end
if rpg_ammo[id]>0 then
parse("setammo "..id.." 46 1 0 ")
end
end
end
addhook("attack","att")
function att(id,mode)
if contains(pistol,player(id,"weapon")) then
pistol_ammo[id]=pistol_ammo[id]-1
end
if player(id,"weapontype")==32 then
ar_ammo[id]=ar_ammo[id]-1
end
if player(id,"weapontype")==46 then
rpg_ammo[id]=rpg_ammo[id]-1
end
end