AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   Scripting Help (https://forums.alliedmods.net/forumdisplay.php?f=11)
-   -   End of sound (https://forums.alliedmods.net/showthread.php?t=326711)

amirwolf 08-13-2020 08:12

End of sound
 
Hello
I want to play sound at the beginning and end of the round
PHP Code:

#include <amxmodx>

new sound_start[][] =
{
    
"start/1.wav",
    
"start/2.wav",
    
"start/3.wav"
}

new 
sound_end[][] =
{
    
"end/1.wav",
    
"end/2.wav",
    
"end/3.wav"
}

public 
plugin_precache()
{
    new 
i
    
for (i=0i<sizeof sound_start;i++)     precache_sound(sound_start[i])
    for (
i=0i<sizeof sound_end;i++)     precache_sound(sound_end[i])
}

public 
plugin_init( )
{
    
register_logevent("round_start",2,     "1=Round_Start")
    
register_logevent("round_end",2,     "1=Round_End")
}

public 
round_start()
{
    
client_cmd(0"spk %s"sound_start[random(sizeof sound_start)])
}

public 
round_end()
{
    
client_cmd(0"spk %s"sound_end[random(sizeof sound_end)])


But when the round starts
The sound of the end of the round is played together with the sound of the beginning of the round
PHP Code:

client_cmd(0"stopsound; mp3 stop"

But I can cut off the sound of the end of the round
But I want the start sound of the round to be played after the end of the round sound
That is, the previous sound ends and then the start sound of the round is played
I can not tell when the sound ends

Natsheh 08-13-2020 08:21

Re: End of sound
 
As far as I know you can't detect when a sound is being played for a client nor when it ends.

But as a tip make sure your end sounds are 5 seconds max in length

amirwolf 08-13-2020 08:23

Re: End of sound
 
The sound I use is more than 5 seconds

Natsheh 08-13-2020 08:26

Re: End of sound
 
Nvm I was mistaken about getting the sound duration, if you have searched you won't be asking.


Anyway here is a link to an include file you can use for such things

https://forums.alliedmods.net/showth...76259?t=176259

amirwolf 08-13-2020 08:28

Re: End of sound
 
Quote:

Originally Posted by Natsheh (Post 2714078)
Nvm I was mistaken about getting the sound duration, if you have searched you won't be asking.


Anyway here is a link to an include file you can use for such things

https://forums.alliedmods.net/showth...76259?t=176259

I'm checking it
thank you


All times are GMT -4. The time now is 13:49.

Powered by vBulletin®
Copyright ©2000 - 2024, vBulletin Solutions, Inc.