Jump to content
  • 0

Make car play a song?


FragZ

Question

Ok, so I got to add in my action menu an option so when you are in X vehicle (which is listed in a variable) you can make it play a sound that other people can also hear.

I however have trouble making this work.

So far, its in the action menu, all good. Thing is, when I click it, it does not do anything.


Here is what I got so far:


 

private ["_car"];
_vehicle = vehicle player;
_inVehicle = (_vehicle != player);
//List of cars
if (_inVehicle) then {
_PlayerInSwagCar = typeOf _vehicle in ["SUV_PINK_DZE4","SUV_TK_CIV_EP1_DZE4","SUV_Charcoal_DZE4","SUV_Camo_DZE4","SUV_Blue_DZE4"];
//This is the swag car nigga
if (_PlayerInSwagCar) then {
if (driver _vehicle == player) then {
	_nul = [objNull, _vehicle, rSAY, "Swag", 100] call RE;
	[_vehicle, 200, true, (getPosATL _vehicle)] spawn player_alertZombies;
	titleText [format ["%1, you are entering a level of SWAG never seen before.", name player], "PLAIN DOWN"];
	systemChat "Start rollin'! ;)";
};
};
};

This is the part of my action menu which is relevant:

 

_pathtoswag = "addons\";
_pathtoscripts = "actions\";
_EXECscript1 = 'player execVM "'+_pathtoscripts+'%1"';
_EXECscript2 = '["%1"] execVM "actions\FunMenu\morph.sqf"';
_EXECscript3 = '["%1"] execVM "actions\FunMenu\movements.sqf"';
_EXECscript4 = 'player execVM "'+_pathtoswag+'%1"';

if((getPlayerUID player) in FZ_Admins) then {

	
	ActionMenu =
	[
		["",true],
		["Action Menu >>", [], "#USER:ActionsMenu", -5, [["expression", ""]], "1", "1"],
		["Knockout (cursor target)", [],  "", -5, [["expression", format[_EXECscript1,"knockout.sqf"]]], "1", "1"],
		["Deploy Menu >>", [], "#USER:VehicleMenu", -5, [["expression", ""]], "1", "1"],
		["Fun Menu >>", [], "#USER:FunMenu", -5, [["expression", ""]], "1", "1"],
		["Swag Car", [],  "", -5, [["expression", format[_EXECscript4,"swagcar.sqf"]]], "1", "1"],
		["Swag Life Music", [],  "", -5, [["expression", format[_EXECscript4,"swagcarmusic.sqf"]]], "1", "1"],
		["Server Rules", [], "", -5, [["expression", format[_EXECscript1,"server_rules.sqf"]]], "1", "1"],
			["", [], "", -5, [["expression", ""]], "1", "0"],
			["Exit", [20], "", -5, [["expression", ""]], "1", "1"]		
	];
};

The swagcar file does not work either. It should be making it go rainbow I think....


swagcar.sqf
 

private ["_car"];
_vehicle = vehicle player;
_inVehicle = (_vehicle != player);
//_swagcars = ["SUV_PINK_DZE4","SUV_TK_CIV_EP1_DZE4","SUV_Charcoal_DZE4","SUV_Camo_DZE4","SUV_Blue_DZE4"]; 
_PlayerInSwagCar = typeOf _vehicle in ["SUV_PINK_DZE4","SUV_TK_CIV_EP1_DZE4","SUV_Charcoal_DZE4","SUV_Camo_DZE4","SUV_Blue_DZE4"]; //Using some not-in-game vehicles
//List of cars
if (_inVehicle) then {
//This is the swag car nigga
if (_PlayerInSwagCar) then
{
Swagrainbow = vehicle player;
publicVariable "Swagrainbow";
_swag = "
[] spawn
{
	while {true} do
	{
		Swagrainbow setObjectTexture [0,'#(argb,8,8,3)color(0,1,0,1)'];
		sleep 0.2;
		Swagrainbow setObjectTexture [0,'#(argb,8,8,3)color(0,1,1,1)'];
		sleep 0.2;
		Swagrainbow setObjectTexture [0,'#(argb,8,8,3)color(1,0,0,1)'];
		sleep 0.2;
		Swagrainbow setObjectTexture [0,'#(argb,8,8,3)color(0,0,1,1)'];
		sleep 0.2;
		Swagrainbow setObjectTexture [0,'#(argb,8,8,3)color(1,1,0,1)'];
		sleep 0.2;
		Swagrainbow setObjectTexture [0,'#(argb,8,8,3)color(1,0,1,1)'];
		sleep 0.2;
		Swagrainbow setObjectTexture [0,'#(argb,8,8,3)color(1,1,1,1)'];
		sleep 0.2;
		Swagrainbow setObjectTexture [0,'#(argb,8,8,3)color(0.5,1,0,1)'];
		sleep 0.2;
		Swagrainbow setObjectTexture [0,'#(argb,8,8,3)color(0.2,1,0.5,1)'];
		sleep 0.2;
		Swagrainbow setObjectTexture [0,'#(argb,8,8,3)color(0.3,0.4,1,1)'];
		sleep 0.2;
		Swagrainbow setObjectTexture [0,'#(argb,8,8,3)color(0.5,1,1,1)'];
		sleep 0.2;
		Swagrainbow setObjectTexture [0,'#(argb,8,8,3)color(1,1,0.5,1)'];
		sleep 0.2;
		Swagrainbow setObjectTexture [0,'#(argb,8,8,3)color(1,0.5,1,1)'];
		sleep 0.2;
	};
};";

player setVehicleInit _swag;
processInitCommands;
};
};

Any help, like always, is highly appreciated!

Link to comment
Share on other sites

5 answers to this question

Recommended Posts

  • 0
_swag = "
this spawn
{
	while {true} do
	{
		_this setObjectTexture [0,'#(argb,8,8,3)color(0,1,0,1)'];
		sleep 0.2;
		_this setObjectTexture [0,'#(argb,8,8,3)color(0,1,1,1)'];
		sleep 0.2;
		_this setObjectTexture [0,'#(argb,8,8,3)color(1,0,0,1)'];
		sleep 0.2;
		_this setObjectTexture [0,'#(argb,8,8,3)color(0,0,1,1)'];
		sleep 0.2;
		_this setObjectTexture [0,'#(argb,8,8,3)color(1,1,0,1)'];
		sleep 0.2;
		_this setObjectTexture [0,'#(argb,8,8,3)color(1,0,1,1)'];
		sleep 0.2;
		_this setObjectTexture [0,'#(argb,8,8,3)color(1,1,1,1)'];
		sleep 0.2;
		_this setObjectTexture [0,'#(argb,8,8,3)color(0.5,1,0,1)'];
		sleep 0.2;
		_this setObjectTexture [0,'#(argb,8,8,3)color(0.2,1,0.5,1)'];
		sleep 0.2;
		_this setObjectTexture [0,'#(argb,8,8,3)color(0.3,0.4,1,1)'];
		sleep 0.2;
		_this setObjectTexture [0,'#(argb,8,8,3)color(0.5,1,1,1)'];
		sleep 0.2;
		_this setObjectTexture [0,'#(argb,8,8,3)color(1,1,0.5,1)'];
		sleep 0.2;
		_this setObjectTexture [0,'#(argb,8,8,3)color(1,0.5,1,1)'];
		sleep 0.2;
	};
};"; 

This should work for your flashing car but I couldn't be bothered to go through the rest of the code to find the problem :P

Link to comment
Share on other sites

  • 0
_swag = "
this spawn
{
	while {true} do
	{
		_this setObjectTexture [0,'#(argb,8,8,3)color(0,1,0,1)'];
		sleep 0.2;
		_this setObjectTexture [0,'#(argb,8,8,3)color(0,1,1,1)'];
		sleep 0.2;
		_this setObjectTexture [0,'#(argb,8,8,3)color(1,0,0,1)'];
		sleep 0.2;
		_this setObjectTexture [0,'#(argb,8,8,3)color(0,0,1,1)'];
		sleep 0.2;
		_this setObjectTexture [0,'#(argb,8,8,3)color(1,1,0,1)'];
		sleep 0.2;
		_this setObjectTexture [0,'#(argb,8,8,3)color(1,0,1,1)'];
		sleep 0.2;
		_this setObjectTexture [0,'#(argb,8,8,3)color(1,1,1,1)'];
		sleep 0.2;
		_this setObjectTexture [0,'#(argb,8,8,3)color(0.5,1,0,1)'];
		sleep 0.2;
		_this setObjectTexture [0,'#(argb,8,8,3)color(0.2,1,0.5,1)'];
		sleep 0.2;
		_this setObjectTexture [0,'#(argb,8,8,3)color(0.3,0.4,1,1)'];
		sleep 0.2;
		_this setObjectTexture [0,'#(argb,8,8,3)color(0.5,1,1,1)'];
		sleep 0.2;
		_this setObjectTexture [0,'#(argb,8,8,3)color(1,1,0.5,1)'];
		sleep 0.2;
		_this setObjectTexture [0,'#(argb,8,8,3)color(1,0.5,1,1)'];
		sleep 0.2;
	};
};"; 

This should work for your flashing car but I couldn't be bothered to go through the rest of the code to find the problem :P

 

I tried, and it does not work...

 

I also tried the music one, and it posted messages but no sound.

Link to comment
Share on other sites

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
  • Advertisement
  • Discord

×
×
  • Create New...