This is what I just tried (shortened form), and I'm about to try your code and post the results...
//////////////////////////////////////////////////////////////////////////////////
SOUND* tankidle = "tankidle.wav";
....
var epressed = 0;
var tank_handle;
....
function start_eng();
...
function start_eng()
{
if(epressed == 1)
{
tank_handle = ent_playloop (panzer,tankidle, 77,0);
epressed = 2;
}
if(epressed == 3)
{
snd_stop(tank_handle);
epressed = 0;
}
}
....
// This part is inside the tank's action, not main()...
if(key_e)
{
if(epressed == 0)
{
epressed = 1;
start_eng();
}
if(epressed == 2)
{
epressed = 3;
start_eng();
}
}
//////////////////////////////////////////////////////////////
It appears to me I did the if branching just fine, as each condition is met after pressing e multiple times, respectively. But for some reason, the snd_stop command just doesn't work in my code. I even tried writing it a few different ways (i.e., with "var tank_handle = ....", and without, plus several other ways). The loop starts, and there's nothing I can do to stop it, lol. This has made me waste almost a whole day.
Ok, well I'm going to try what you posted above, and tell you what happened...