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
dropped_magazine = {}
weapon_type_name = {"pistols", "shotguns", "smgs", "rifles", "mguns", "flames", "rockets"}
weapon_type_id = {
pistols = {1, 2, 3, 4, 5, 6},
shotguns = {10, 11},
smgs = {20, 21, 22, 23, 24},
rifles = {30, 31, 32, 33, 34, 34, 36, 37, 38, 39, 91},
mguns = {40, 90},
flames = {46},
rockets = {48, 49}
}
mag_type_param = {
[1] = {"gfx/weapons/pistolmag.png", "items/magdrop.wav"},
[2] = {"gfx/weapons/shotgunmag.png", "items/magdrop.wav"},
[3] = {"gfx/weapons/smgmag.png", "items/magdrop.wav"},
[4] = {"gfx/weapons/riflemag.png", "items/magdrop.wav"},
[5] = {"gfx/weapons/mgunmag.png", "items/magdrop.wav"},
[6] = {"gfx/weapons/flamemag.png", "items/magdrop.wav"},
[7] = {"gfx/weapons/rocketmag.png", "items/magdrop.wav"},
}
function drop_magazine(x, y, rot, magtype)
local I = 0
for I = 1, table.maxn(dropped_magazine) + 1, 1 do
if (dropped_magazine[I] == nil) then
dropped_magazine[I] = image(mag_type_param[magtype][1], x, y, 0)
tween_rotate(dropped_magazine[I],0,x,y,rot)
timer(1000, "parse", 'lua tween_alpha('..dropped_magazine[I]..',3000,0)')
timer(8000, "parse", 'lua freeimage('..dropped_magazine[I]..')')
timer(9000, "parse", 'lua dropped_magazine['..I..']=nil')
parse("sv_sound \""..mag_type_param[magtype][2].."\"")
return nil
end
end
end
addhook("reload","reload_finished")
function reload_finished(id,mode)
local weap_table = nil
local pl_weap_type = player(id,"weapontype")
local I = 0
local J = 0
if (mode == 2) then
for I = 1, table.maxn(weapon_type_name), 1 do
weap_table = weapon_type_id[weapon_type_name[I]]
for J = 1, table.maxn(weap_table), 1 do
if (pl_weap_type == weap_table[J]) then
drop_magazine(player(id,"x"), player(id,"y"), player(id,"rot"), I)
return nil
end
end
end
end
end