GZRep

Play sound on server before server restart.

11 posts in this topic

Hello! :)

Im thinking about a script that plays a certain sound 3 min before server restart.
Anyone could help me with this?

 

Share this post


Link to post
Share on other sites
Advertisement

Define the sound in description.ext

https://community.bistudio.com/wiki/Description.ext

// Example definition of a sound in missions description.ext
class CfgSounds
{
	sounds[] = {};
	class addonsound1
	{
		name = "sound from addon";
		// start path to sound file in AddOn with @
		sound[] = {"@a3\Ui_F_Curator\Data\Sound\CfgSound\visionMode", 0.8, 1};
		titles[] = {0,""};
	};
};

create a script checking the serverTime with your restart timer minus the seconds you want to notify add use `execVM yourscript.sqf` in your initPlayerLocal.sqf

// yourscript.sqf - NOT TESTED

// adding this to initPlayerLocal.sqf should be ok
[] spawn {
	// restart time in seconds (14400sec = 4h)
	_myRestartTime = 14400;
	// notify X seconds before restart (60sec = 1min)
	_myNotfiyTime = _myRestartTime - 60;
	// wait unti server time reached the notification time
	waitUntil { serverTime > _myNotifyTime };

	// play the sound configured in CfgSounds
	playSound "addonsound1";
};

 

Edited by ole
2 people like this

Share this post


Link to post
Share on other sites

Thank you so much man! Will test it now...

Recommended sound files for arma is ogg right?

Share this post


Link to post
Share on other sites
On 2/1/2016 at 0:31 PM, ole said:

Define the sound in description.ext

https://community.bistudio.com/wiki/Description.ext


// Example definition of a sound in missions description.ext
class CfgSounds
{
	sounds[] = {};
	class addonsound1
	{
		name = "sound from addon";
		// start path to sound file in AddOn with @
		sound[] = {"@a3\Ui_F_Curator\Data\Sound\CfgSound\visionMode", 0.8, 1};
		titles[] = {0,""};
	};
};

create a script checking the serverTime with your restart timer minus the seconds you want to notify add use `execVM yourscript.sqf` in your initPlayerLocal.sqf


// yourscript.sqf - NOT TESTED

// adding this to initPlayerLocal.sqf should be ok
[] spawn {
	// restart time in seconds (14400sec = 4h)
	_myRestartTime = 14400;
	// notify X seconds before restart (60sec = 1min)
	_myNotfiyTime = _myRestartTime - 60;
	// wait unti server time reached the notification time
	waitUntil { serverTime > _myNotifyTime };

	// play the sound configured in CfgSounds
	playSound "addonsound1";
};

 

can the sound be from mission file?

Share this post


Link to post
Share on other sites
1 hour ago, iCraftKSA said:

can the sound be from mission file?

The way he stated is the only way to get sounds to work. Obviously how and when you want it to work is a different story.

Share this post


Link to post
Share on other sites
12 minutes ago, Steelius said:

The way he stated is the only way to get sounds to work. Obviously how and when you want it to work is a different story.

can you explain?

lets say if i want to play like warning that the server will be shutdown in 3mins..

where i put the sound file

i'm not using custom mods or something like that

Share this post


Link to post
Share on other sites

Why don't you just use the function in bec to just display a message instead of playing a sound? Less of an annoyance

Share this post


Link to post
Share on other sites
47 minutes ago, Steelius said:

Why don't you just use the function in bec to just display a message instead of playing a sound? Less of an annoyance

i really want a sound

Share this post


Link to post
Share on other sites
Advertisement

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!


Register a new account

Sign in

Already have an account? Sign in here.


Sign In Now

  • Recently Browsing   0 members

    No registered users viewing this page.