Hi,
Edited this, and it now seems to work. I hope this is what you wanted.
-- LUA Script - precede every function and global member with lowercase name of script + '_main'
-- Player Collects Item by pressing "E"
function pickupitem_main(e)
PlayerDX = g_Entity[e]['x'] - g_PlayerPosX;
PlayerDY = g_Entity[e]['y'] - g_PlayerPosY;
PlayerDZ = g_Entity[e]['z'] - g_PlayerPosZ;
PlayerDist = math.sqrt(math.abs(PlayerDX*PlayerDX)+math.abs(PlayerDY*PlayerDY)+math.abs(PlayerDZ*PlayerDZ));
-- Showing Text
if PlayerDist < 80 then
Prompt("Press E to pickup Item");
end
-- Player pickup some item through pressing "E"
if PlayerDist < 80 and g_KeyPressE == 1 then
PlaySound0(e);
Collected(e);
Destroy(e);
end
--End of function
end
i7-4770s 3.10ghz - Geforce GTX 650ti