I can't seem to figure it out. This is what I tried:
function pickupobject_quest1_init(e)
end
function pickupobject_quest1_main(e)
local PlayerDist = GetPlayerDistance(e)
if PlayerDist < 100 and g_PlayerHealth > 0 then
Prompt("Press E to pick up hammer")
if g_KeyPressE == 1 then
Spawn(g_Entity[e]['Pistol'] == 1)
PerformLogicConnections(e)
Destroy('Quest1Trigger')
ActivateIfUsed('Pistol')
Show('Pistol')
Destroy(e)
end
end
end