- Feb 11, 2018
- 32
- 0
Hello everyone. So I was building my CTF map, which has an ambient_generic entity to play an alarm sound when the intel gets taken (also thanks to Startacker for helping me in the alarm file name issue). It runs perfectally well when you take the intel, the sound starts playing and looping, but it was supposed to stop when the intel returns to the base, which doesn't happen. I think I need to do something to check if the alarm is playing to stop or play it again. In Lua it would look like this:
Any help would be apreciated
Code:
function intel.OnPickup() --Same as the OnPickup output
if not sound.Playing then --"Playing" is a variable I created that sets to true when the sound is playing and false when it is not
sound.ToggleSound()
end
end
function intel.OnReturn()
if sound.Playing then
sound.ToggleSound() --This is supposed to untoggle the sound. Please correct me if I'm wrong
end
end
Any help would be apreciated