Not sure if that title is the best but what ever.
package f18
{
function armor::onMount(%this,%obj,%col,%slot)
{
Parent::onMount(%this,%obj,%col,%slot);
if(%col.getDataBlock() == F18Vehicle.getId())
{
%Client = %Obj.Client;
%Client.Play2d(F18roosterpit);
%col.unmountimage(0);
%col.mountimage(F18EngineImage, 0);
}
}
function armor::onUnMount(%this, %obj, %slot, %col)
{
Parent::onUnMount(%this,%obj,%slot,%col);
if(%col.getDataBlock() == F18Vehicle.getId())
{
%Client = %Obj.Client;
%Client.stopAudio(1);
}
}
function servercmdLight(%client)
{
%p = %client.player;
if(!isobject(%p.getobjectmount()))
return Parent::servercmdLight(%client);
if(%p.getobjectmount().getdatablock() == F18vehicle.getid())
{
if($Sim::Time<%client.delay)
{
return;
}
%obj = %p.getobjectmount();
%client=%client;
switch (%obj.f18gear)
{
case 1:
for(%i = 0; %i < 3; %i++)
{
%obj.schedule(1400,setWheelTire,%i, F18tire);
%obj.schedule(1400,setWheelspring,%i, F18spring);
}
%obj.playThread(0,"geardown");
%obj.f18gear = 2;
case 2:
for(%i = 0; %i < 3; %i++)
{
%obj.setWheelTire(%i, F18faketire);
%obj.setWheelSpring(%i, F18fakespring);
}
%obj.playThread(0,"gearup");
%obj.f18gear = 1;
default:
for(%i = 0; %i < 3; %i++)
{
%obj.setWheelTire(%i, F18faketire);
%obj.setWheelSpring(%i, F18fakespring);
}
%obj.playThread(0,"gearup");
%obj.f18gear = 1;
}
%client.delay=$Sim::Time+2000/1000;
}
else
Parent::servercmdLight(%client);
}
};
activatePackage(f18);
Ignore the rest (Unless it does pertain to what im asking) But focus on OnMount and OnUnMount. What i want to do is when a player enters this vehicle, a Looped sound is played to their client. I have the audio datablock set up to where it loops, there is no problem with the loop. But what im having issues with is the loop stopping when you exit the vehicle.
As of right now, when you exit the vehicle the loop plays endlessly. If you need any more information let me know, other then that thanks for the help.