Jump to content
MasterPuffin

[Release] MP Vehicle Emergency Sirens Script

Recommended Posts

This script is best used with a keyhandler, however if you have a bit of experience with coding you can get it also work with addaction. This script works in MP

********************************

Download the sounds here (or use your own ones)

Make a folder called sounds and put the two files inside this folder

 

Put the following code in your description.ext

class CfgSounds
{
	class Siren
	{
		name = "Siren";
		sound[] = {"sounds\Siren.ogg", 5.0, 1};
		titles[] = {1, ""};
	};
		class Yelp
	{
		name = "Yelp";
		sound[] = {"sounds\Yelp.ogg", 5.0, 1};
		titles[] = {1, ""};
	};
};

 

Put the following code in your keyhandler:

    case 33: {//F key
            
			if (_shift) then {
			_vehicle = (vehicle player);
				if (isNil {_vehicle getVariable "EmergencyVeh"}) then {
					_vehicle setVariable ["EmergencyVeh", false, true];
				};
			_ComVeh = _vehicle getVariable "EmergencyVeh";
			if (vehicle player != player && (driver _vehicle == player && _ComVeh isEqualTo true)) then {
				if (isNil {_vehicle getVariable "siren"}) then {
					_vehicle setVariable ["siren", false, true];
				};
				_SirenState = _vehicle getVariable "siren";
				if (_SirenState isEqualTo true) then {
					_vehicle setVariable ["siren", false, true];
					}
				else
					{
						[[[_vehicle],"scripts\siren.sqf"],"BIS_fnc_execVM",true,false,false] call BIS_fnc_MP;
						_vehicle setVariable ["siren", true, true];
					};
				};
			};
			if (_ctrl) then {
				_vehicle = (vehicle player);
				if (isNil {_vehicle getVariable "EmergencyVeh"}) then {
					_vehicle setVariable ["EmergencyVeh", false, true];
				};
				_ComVeh = _vehicle getVariable "EmergencyVeh";
				if (vehicle player != player && (driver _vehicle == player && _ComVeh isEqualTo true)) then {
					[[[_vehicle],"scripts\yelp.sqf"],"BIS_fnc_execVM",true,false,false] call BIS_fnc_MP;				
				};
			};
          };		
		

Create a folder called scripts. Inside this folder create a file called siren.sqf and put the following code into it:

Private ["_vehicle"];
_vehicle = _this select 0;

_repeat = true;

while{ (alive _vehicle) && (_repeat isEqualTo true)} do  
	{
	_vehicle say3D "Siren";
	sleep 5.5;
	_repeat = _vehicle getVariable "Siren";
	};

Inside the folder scripts create a file called yelp.sqf and put the following code into it:

Private ["_vehicle"];
_vehicle = _this select 0;
_vehicle say3D "Yelp";

 

Thats it!

 

As always, if you have any questions feel free to ask!

Cheers

Puffin

  • Like 1

Share this post


Link to post
Share on other sites

Ok so ive done all that now how do I designate the vehicle as an emergency vehicle or whatever else needs to be done to make this work?

Share this post


Link to post
Share on other sites

Please sign in to comment

You will be able to leave a comment after signing in



Sign In Now

×