removing playsound(e) does not help. Here's the script. and thanks for your help.
-- LUA Script - precede every function and global member with lowercase name of script + '_main'
-- Player Collected cash system
-- Standard player distance math
function cash_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));
if PlayerDist < 80 then
--Display Text
Prompt("Press E to pickup cash, cash =" .. currentcash);
-- Detect if player push the E key
if g_KeyPressE == 1 then
-- makes the cash pickup a random number between 10 and 50 and then multiplies it by 10
currentcash = currentcash + (math.random(10,50) * 10);
PlaySound0(e);
Destroy(e);
end
end
end
The only script from the first post, I can get to work is the display cash. all the rest crash.