Try this code -
pressed = 0
timeleft = 60000
building = 0
local totaltime = 60000
gatheredparts = 6
started = 0
function crafter_init(e)
end
function crafter_main(e)
PlayerDist = GetPlayerDistance(e)
if PlayerDist < 200 then
if building == 1 and timeleft > 0 then
PromptLocal(e,"ECT: "..math.floor(timeleft/1000).." seconds")
end
if pressed == 0 and gatheredparts == 6 then
Prompt("Press E to extend the Base")
if g_KeyPressE == 1 then
pressed = 1
end
if g_KeyPressE == 0 then
pressed = 0
end
if pressed == 1 then
PlaySound(e, 0)
Prompt("Constuction work started")
StartTimer(e)
started = 1
building = 1
pressed = 3
gatheredparts = 0
end
end
end
timeleft = totaltime-GetTimer(e)
if started == 1 then
if timeleft < 0 then
Hide(e)
ActivateIfUsed(e)
PlaySound(e, 1)
Destroy(e)
end
end
end
I added a variable that determines whether or not the timer has been started, changed 'if timeleft == 0' to 'if timeleft < 0' (frame rate issues can cause GetTimer(e) to skip numbers), and capitalized Hide(e) and Destroy(e). I changed 'PromptLocal(e,"ECT: ".. g_timeleft.." milliseconds")' to 'PromptLocal(e,"ECT: "..math.floor(timeleft/1000).." seconds")' , because it looks neater (but that's just my opinion, so you can ignore it). Lastly, I had to remove the g_ prefix from your variables, because they were giving me error messages (I don't know why, because they were obviously working with you), so you can change them back if you want.