Quote
function Array(size,value)
local array = {}
for i = 1, size do
array[i] = value
end
return array
end
LS_att = Array(32, 0)
LS_lit = Array(32, 0)
LS_ht = Array(32, 0)
LS_mode = Array(32, 0)
StPth = 'gfx/LaserShockwave/45'
addhook('attack', 'LS_attack')
addhook('hit', 'LS_hit')
addhook('attack2', 'LS_attack2')
addhook('collect', 'LS_collect')
addhook('select', 'LS_select')
function LS_attack(id)
if player(id, 'weapontype') == 45 then
LS_att[id] = image(StPth..'.png', 0, 1, 1)
imagepos(LS_att[id], player(id, 'x'), player(id, 'y'), player(id, 'rot'))
LS_lit[id] = image(StPth..'f.png', 0, 1, 1)
imagepos(LS_lit[id], player(id, 'x'), player(id, 'y'), player(id, 'rot'))
if LS_mode[id] == 0 then
imagecolor(LS_att[id], 0, 255, 0)
imagecolor(LS_lit[id], 0, 255, 0)
elseif LS_mode[id] == 1 then
imagecolor(LS_att[id], 255, 0, 0)
imagecolor(LS_lit[id], 255, 0, 0)
elseif LS_mode[id] == 2 then
imagecolor(LS_att[id], 255, 255, 0)
imagecolor(LS_lit[id], 255, 255, 0)
elseif LS_mode[id] == 3 then
imagecolor(LS_att[id], 0, 0, 255)
imagecolor(LS_lit[id], 0, 0, 255)
end
tween_alpha(LS_att[id], 1000, 0.0)
tween_alpha(LS_lit[id], 200, 0.0)
timer(1000, 'freeimage', LS_att[id])
timer(200, 'freeimage', LS_lit[id])
end
end
function LS_hit(id, source, weapon)
if player(id, 'team') ~= player(source, 'team') then
if weapon == 45 then
LS_ht[id] = image(StPth..'h.png', 0, 1, 1)
imagepos(LS_ht[id], player(id, 'x'), player(id, 'y'), player(source, 'rot'))
if LS_mode[source] == 0 then
imagecolor(LS_ht[id], 0, 255, 0)
elseif LS_mode[source] == 1 then
imagecolor(LS_ht[id], 255, 0, 0)
elseif LS_mode[source] == 2 then
imagecolor(LS_ht[id], 255, 255, 0)
elseif LS_mode[source] == 3 then
imagecolor(LS_ht[id], 0, 0, 255)
end
tween_alpha(LS_ht[id], 1000, 0.0)
timer(1000, 'freeimage', LS_ht[id])
end
end
end
function LS_attack2(id, mode)
if player(id, 'weapontype') == 45 then
LS_mode[id] = mode
end
end
function LS_collect(id, iid, mode)
if iid == 45 then
LS_mode[id] = mode
end
end
function LS_select(id, type, mode)
if type == 45 then
LS_mode[id] = mode
end
end
local array = {}
for i = 1, size do
array[i] = value
end
return array
end
LS_att = Array(32, 0)
LS_lit = Array(32, 0)
LS_ht = Array(32, 0)
LS_mode = Array(32, 0)
StPth = 'gfx/LaserShockwave/45'
addhook('attack', 'LS_attack')
addhook('hit', 'LS_hit')
addhook('attack2', 'LS_attack2')
addhook('collect', 'LS_collect')
addhook('select', 'LS_select')
function LS_attack(id)
if player(id, 'weapontype') == 45 then
LS_att[id] = image(StPth..'.png', 0, 1, 1)
imagepos(LS_att[id], player(id, 'x'), player(id, 'y'), player(id, 'rot'))
LS_lit[id] = image(StPth..'f.png', 0, 1, 1)
imagepos(LS_lit[id], player(id, 'x'), player(id, 'y'), player(id, 'rot'))
if LS_mode[id] == 0 then
imagecolor(LS_att[id], 0, 255, 0)
imagecolor(LS_lit[id], 0, 255, 0)
elseif LS_mode[id] == 1 then
imagecolor(LS_att[id], 255, 0, 0)
imagecolor(LS_lit[id], 255, 0, 0)
elseif LS_mode[id] == 2 then
imagecolor(LS_att[id], 255, 255, 0)
imagecolor(LS_lit[id], 255, 255, 0)
elseif LS_mode[id] == 3 then
imagecolor(LS_att[id], 0, 0, 255)
imagecolor(LS_lit[id], 0, 0, 255)
end
tween_alpha(LS_att[id], 1000, 0.0)
tween_alpha(LS_lit[id], 200, 0.0)
timer(1000, 'freeimage', LS_att[id])
timer(200, 'freeimage', LS_lit[id])
end
end
function LS_hit(id, source, weapon)
if player(id, 'team') ~= player(source, 'team') then
if weapon == 45 then
LS_ht[id] = image(StPth..'h.png', 0, 1, 1)
imagepos(LS_ht[id], player(id, 'x'), player(id, 'y'), player(source, 'rot'))
if LS_mode[source] == 0 then
imagecolor(LS_ht[id], 0, 255, 0)
elseif LS_mode[source] == 1 then
imagecolor(LS_ht[id], 255, 0, 0)
elseif LS_mode[source] == 2 then
imagecolor(LS_ht[id], 255, 255, 0)
elseif LS_mode[source] == 3 then
imagecolor(LS_ht[id], 0, 0, 255)
end
tween_alpha(LS_ht[id], 1000, 0.0)
timer(1000, 'freeimage', LS_ht[id])
end
end
end
function LS_attack2(id, mode)
if player(id, 'weapontype') == 45 then
LS_mode[id] = mode
end
end
function LS_collect(id, iid, mode)
if iid == 45 then
LS_mode[id] = mode
end
end
function LS_select(id, type, mode)
if type == 45 then
LS_mode[id] = mode
end
end
current script only works for weapons with ID 45 or laser, and the question will refer to you asking how to make it work on more than one weapon or all ... please help