initial commit
This commit is contained in:
54
functions/Radio/fn_carRadio.sqf
Normal file
54
functions/Radio/fn_carRadio.sqf
Normal file
@@ -0,0 +1,54 @@
|
||||
/*
|
||||
Author: Djeeberjr
|
||||
|
||||
Description:
|
||||
Installs a very simple radio in the vehicle
|
||||
|
||||
Parameter(s):
|
||||
0: OBJECT - the vehicle
|
||||
1: STRING or ARRAY - song or array of songs
|
||||
*/
|
||||
|
||||
params ["_veh","_songs",["_offset",[0,0,0]]];
|
||||
|
||||
if((typeName _songs) == "STRING")then{
|
||||
_songs = [_songs];
|
||||
};
|
||||
|
||||
_veh addEventHandler ["Killed", {
|
||||
params ["_unit"];
|
||||
if(not isNull (_unit getVariable ["DLib_radio_source",objNull]))then{
|
||||
deleteVehicle (_unit getVariable "DLib_radio_source");
|
||||
};
|
||||
}];
|
||||
|
||||
_startId = _veh addAction ["Press play",{
|
||||
params ["_target", "_caller", "_actionId", "_arguments"];
|
||||
_song = selectRandom (_arguments#0);
|
||||
_offset = _arguments#1;
|
||||
if(not isNull (_target getVariable ["DLib_radio_source",objNull]))then{
|
||||
deleteVehicle (_target getVariable "DLib_radio_source");
|
||||
};
|
||||
|
||||
_source = "Land_Can_V1_F" createVehicle [0,0,0];
|
||||
_target setVariable ["DLib_radio_source",_source,true];
|
||||
_source hideObjectGlobal true;
|
||||
|
||||
if((typeName _offset) == "STRING")then{
|
||||
_source attachTo [_target,[0,0,0],_offset];
|
||||
}else{
|
||||
_source attachTo [_target,_offset];
|
||||
};
|
||||
|
||||
[_source,[_song,120]] remoteExec ["say3D"];
|
||||
|
||||
},[_songs,_offset],1.5,false,true,"","driver _target == _this"];
|
||||
|
||||
_stopId = _veh addAction ["Press Stop",{
|
||||
params ["_target", "_caller", "_actionId", "_arguments"];
|
||||
|
||||
deleteVehicle (_target getVariable ["DLib_radio_source",objNull]);
|
||||
|
||||
},[],1.5,false,true,"","driver _target == _this"];
|
||||
|
||||
_veh setVariable ["DLib_radio_actions",[_startId,_stopId],true];
|
||||
16
functions/Radio/fn_removeCarRadio.sqf
Normal file
16
functions/Radio/fn_removeCarRadio.sqf
Normal file
@@ -0,0 +1,16 @@
|
||||
/*
|
||||
Author: Djeeberjr
|
||||
|
||||
Description:
|
||||
Removes the car radio
|
||||
|
||||
Parameter(s):
|
||||
0: OBJECT - the vehicle
|
||||
*/
|
||||
|
||||
params ["_veh"];
|
||||
|
||||
_actions = _veh getVariable "DLib_radio_actions";
|
||||
deleteVehicle (_veh getVariable ["DLib_radio_source",objNull]);
|
||||
[_veh,_actions select 0] remoteExec ["removeAction"];
|
||||
[_veh,_actions select 1] remoteExec ["removeAction"];
|
||||
Reference in New Issue
Block a user