save it as weapon_range.lua
pressed = 0
function weapon_range_init_name(e,name)
weapon_name[e] = name
end
function weapon_range_main(e)
if GetPlayerDistance(e) < 80 and g_PlayerHealth > 0 and g_PlayerThirdPerson == 0 then
PromptLocal(e,"Press E to collect the "..weapon_name[e])
if g_KeyPressE == 1 and pressed == 0 then
pressed = 1
PromptDuration("Collected "..weapon_name[e],3000)
PlaySound(e,0)
AddPlayerWeapon(e)
Destroy(e)
ActivateIfUsed(e)
end
if g_KeyPressE == 0 then
pressed = 0
end
end
end