Jump to content
Guest francismori7

Air horn script

Recommended Posts

Guest francismori7

How can I play an air horn sound when I press on a command button? I tried to mess with LASiren but no success. I just want to press the button and play airhorn.wav. That's all. Any help?

Link to comment
Share on other sites

Guest francismori7
well as far as I know, it would be make a new script for the button, then put one in to activate airhorn.wav And Francis, If you do that, I want a copy, and I'm pretty sure alot of people will want one too!

I will post the code here too :P

Link to comment
Share on other sites

Guest francismori7
Lol i did that script yesterday! :grinsevil: it works, but i have some problems with the icon.Look the screen :(

qsirenat3.jpg

Would you mind posting the code? Thanks.

Link to comment
Share on other sites

Guest francismori7

What I want is not really like that. I want this:

Click > Beep

Not

Click > Beeeeeeeeeeeeeeeeeeeeeeeeeep(until Click)

See?

Link to comment
Share on other sites

Guest francismori7
you talk about the siren? just beep instead a long sound?

(sorry for my bad english)

The horn: Yes, not sirens, if I click once, it does "beep". If I click twice(2 times), it does this: "beep beep". Understand?

Link to comment
Share on other sites

Guest francismori7
It shouldn't be much harder than what you have, I'll take a look at the script, and for the button, I can't really help you

I just want it to be played once.

What params this uses?

Audio::PlaySample3D(*,*,*);

Sirens: Audio::PlaySample3D("mod:Audio/FX/Sirens/Siren06.wav", CarPos, true);

Repeating? ------------------------------------------------------------------------------------------------^

I uploaded my airhorn.wav:

Link to comment
Share on other sites

Guest lord_bonev
I just want it to be played once.

What params this uses?

Audio::PlaySample3D(*,*,*);

Sirens: Audio::PlaySample3D("mod:Audio/FX/Sirens/Siren06.wav", CarPos, true);

Repeating? ------------------------------------------------------------------------------------------------^

I uploaded my airhorn.wav:

Good job! This sound ("beep") is the most used in my country from police cars and other special vehicles. The sound is cool :1046275747_biggthumpup: But only for police cars in the mod, is have a way to used and for other vehicles? Or i try to rename tha all files?

Link to comment
Share on other sites

Guest francismori7

Alright, works almost perfect now. Only one problem. The sound keeps playing. With something other, it does start but, is instantly stopped. Here is the second script:

const char CMD_AUTOSIREN_OFF[]		= "VcmdAutoSirenOff";
const char EACTION_FINDPATH[] = "EActionFindPath";
const char EACTION_EXTINGUISH[] = "EActionExtinguish";
const char DUMMY_HASSIREN[] = "DummyHasSiren";
const char DUMMY_UPDATEPOS[] = "DummyUpdatePos";
const char DUMMY_FINDPATH[] = "DummyFindPath";
const char NAME_DUMMYOBJECT[] = "HelpingObjekt_Hoppah";

const char PROTO_ENGINE01[] = "mod:Prototypes/Vehicles/02 LA Fire Department/fire_engine1.e4p";
const char PROTO_ENGINE02[] = "mod:Prototypes/Vehicles/02 LA Fire Department/fire_engine2.e4p";
const char PROTO_WATERTENDER01[] = "mod:Prototypes/Vehicles/02 LA Fire Department/water_tender.e4p";
const char PROTO_WATERTENDER02[] = "mod:Prototypes/Vehicles/02 LA Fire Department/water_tender_hose_connections.e4p";
const char PROTO_LADDER[] = "mod:Prototypes/Vehicles/02 LA Fire Department/aerial_ladder.e4p";
const char PROTO_HAZMAT[] = "mod:Prototypes/Vehicles/02 LA Fire Department/hazmat_squad.e4p";
const char PROTO_MOTORBOAT[] = "mod:Prototypes/Vehicles/02 LA Fire Department/motorboat_transporter.e4p";
const char PROTO_CRASHTENDER[] = "mod:Prototypes/Vehicles/02 LA Fire Department/crashtender.e4p";
const char PROTO_USAR[] = "mod:Prototypes/Vehicles/02 LA Fire Department/usar_squad.e4p";
const char PROTO_MCU01[] = "mod:Prototypes/Vehicles/01 LA Ambulance/mass_casualty_unit.e4p";
const char PROTO_MCU02[] = "mod:Prototypes/Vehicles/01 LA Ambulance/mass_casualty_unit2.e4p";
const char PROTO_BCV[] = "mod:Prototypes/Vehicles/02 LA Fire Department/battalion_chief_vehicle.e4p";
const char PROTO_HES[] = "mod:Prototypes/Vehicles/02 LA Fire Department/heavy_equipment_squad.e4p";
const char PROTO_BRUSH[] = "mod:Prototypes/Vehicles/02 LA Fire Department/brush_truck.e4p";
const char PROTO_USFS01[] = "mod:Prototypes/Vehicles/02 LA Fire Department/usfs_utility.e4p";
const char PROTO_USFS02[] = "mod:Prototypes/Vehicles/02 LA Fire Department/usfs_engine.e4p";
const char PROTO_EMS[] = "mod:Prototypes/Vehicles/01 LA Ambulance/cv_ems.e4p";
const char PROTO_AMBULANCE01[] = "mod:Prototypes/Vehicles/01 LA Ambulance/ambulance01.e4p";
const char PROTO_AMBULANCE02[] = "mod:Prototypes/Vehicles/01 LA Ambulance/ambulance02.e4p";
const char PROTO_AMBULANCE03[] = "mod:Prototypes/Vehicles/01 LA Ambulance/ambulance03.e4p";
const char PROTO_AMBULANCE04[] = "mod:Prototypes/Vehicles/01 LA Ambulance/ambulance04.e4p";
const char PROTO_CORONERS[] = "mod:Prototypes/Vehicles/01 LA Ambulance/coroners_van.e4p";
const char PROTO_DOGTRUCK[] = "mod:Prototypes/Vehicles/01 LA Ambulance/suv_rescue_dog.e4p";
const char PROTO_MOTORCYCLE[] = "mod:Prototypes/Vehicles/03 LA Police/motorcycle_lapd.e4p";
const char PROTO_CV_LAPD[] = "mod:Prototypes/Vehicles/03 LA Police/cv_lapd.e4p";
const char PROTO_CV_LAPD_ST[] = "mod:Prototypes/Vehicles/03 LA Police/cv_lapd_slicktop.e4p";
const char PROTO_CV_LAAP[] = "mod:Prototypes/Vehicles/03 LA Police/cv_laap.e4p";
const char PROTO_CV_LAPP[] = "mod:Prototypes/Vehicles/03 LA Police/cv_lapp.e4p";
const char PROTO_CV_UMPC[] = "mod:Prototypes/Vehicles/03 LA Police/cv_umpc.e4p";
const char PROTO_CV_CHP[] = "mod:Prototypes/Vehicles/03 LA Police/cv_chp.e4p";
const char PROTO_CV_LASD[] = "mod:Prototypes/Vehicles/03 LA Police/cv_lasd.e4p";
const char PROTO_CAMARO[] = "mod:Prototypes/Vehicles/03 LA Police/camaro_chp.e4p";
const char PROTO_CHARGER[] = "mod:Prototypes/Vehicles/03 LA Police/dodge_charger.e4p";
const char PROTO_SUV_LAPD[] = "mod:Prototypes/Vehicles/03 LA Police/suv_lapd.e4p";
const char PROTO_RESCUE01[] = "mod:Prototypes/Vehicles/03 LA Police/rescue_truck01_lapd.e4p";
const char PROTO_RESCUE02[] = "mod:Prototypes/Vehicles/03 LA Police/rescue_truck02_lapd.e4p";
const char PROTO_SWAT_TRUCK[] = "mod:Prototypes/Vehicles/03 LA Police/swat_truck.e4p";
const char PROTO_WATERCANNON[] = "mod:Prototypes/Vehicles/03 LA Police/swat_armoured_vehicle.e4p";
const char PROTO_HUMMERH2_LASD[] = "mod:Prototypes/Vehicles/03 LA Police/hummerh2_lasd.e4p";
const char PROTO_BOMB_SQUAD[] = "mod:Prototypes/Vehicles/03 LA Police/suv_bomb_squad.e4p";

int DummyGroup = 22;

object VcmdHorn : CommandScript
{
VcmdHorn()
{
SetIcon("sirens");
SetCursor("sirens");
SetRestrictions(RESTRICT_SELFEXECUTE);
SetPossibleCallers(ACTOR_VEHICLE);
}

bool CheckPossible(GameObject *Caller)
{
if (!Caller->IsValid())
return false;

return true;
}

bool CheckTarget(GameObject *Caller, Actor *Target, int childID)
{
if (!Target->IsValid() || Target->GetID() != Caller->GetID())
return false;

return true;
}

void PushActions(GameObject *Caller, Actor *Target, int childID)
{
Vehicle v(Caller);
if (!v.HasCommand(DUMMY_HASSIREN))
{
int soundID;
Vector CarPos = v.GetPosition();
soundID = Audio::PlaySample3D("mod:Audio/FX/Sirens/airhorn.wav", CarPos, false);
Audio::StopSample(soundID);
}
}
};

object DummyHasSiren : CommandScript
{
DummyHasSiren()
{
SetGroupID(DummyGroup);
}

bool CheckTarget(GameObject *Caller, Actor *Target, int childID)
{
return false;
}

void PushActions(GameObject *Caller, Actor *Target, int childID)
{
}
};

The best way would be by setting a timer to "Audio::StopSample(soundID);". But how? :P

Link to comment
Share on other sites

Guest
This topic is now closed to further replies.



×
×
  • Create New...