Forum Jump :

Author Message


Posts: 26
Rank:


Level: Member

Country: us
Location:
Occupation:
Age:
In-game name:

 
#1 Posted at 2009-02-11 17:58        
     
Does anyone know how to fix this script? I got this script from someone else in another forum and I'm clueless with scripting. I keep getting this error message at the beginning of the mission. Here is the link that will show the screenshot of the error message.

http://www.ofpec.com/forum/index.php?topic=32925.0


Init line for vehicle:
nil = [this,"","",-1] execVM "ROMM_carAudio.sqf"

ROMM_carAudio.sqf:
// 0 : Turn on Speakers
// -1 : Turn off Speakers

private["_car","_id","_arg","_var"];
_car = _this select 0;
_id = _this select 2;
_arg = _this select 3;

switch (_arg) do {
	case 0:	{
		_car removeAction _id;
		
		if (alive _car) then {
			call compile format["ROMM_%1AUDIO = true", _car];
			[_car] spawn {
				_car = _this select 0;
				_var = call compile format["ROMM_%1AUDIO", _car];
				while {_var AND alive _car} do {
					_car setvehicleinit "this say 'sample1'";
					processinitcommands;
					sleep 15;
				};
			};
			_car addaction ["Disable Audio","ROMM_carAudio.sqf",[1]];
		};
	};
	case -1: {
		if NOT(isnil format["ROMM_%1AUDIO", _car]) then {_car removeAction _id};
		if (alive _car) then {
			call compile format["ROMM_%1AUDIO = false", _car];
			_car addaction ["Enable Audio","ROMM_carAudio.sqf",[0]];
		};
	};
};

Basically the script makes it so that an action is added to the vehicle that will play a sound clip (from the vehicle) that everyone nearby can hear.