I working with pulling data from a game, head-shots for a particular round. Every time a head shot is performed on the currently observed player it should play a sound.
however it just plays endlessly, and I'm not quite sure on the logic to make it only play once when the action happens.
For example:
let roundHs = statistics.round_killhs; //gives me a value btw 1 and 5.
let playOnce = true;
if (roundHs && playOnce) {
$("audio#testsong")[0].play()
playOnce = false;
}
I have tried adding a boolean of some sort but it didn't seem to work. Any tips would be greatly appreciated!
Aucun commentaire:
Enregistrer un commentaire