Jump to content
Guest francismori7

Air horn script

Recommended Posts

Guest Caddi17
ok so does the air horn work now. does it just honk and go off or is it still continuious im confused

im prety sure its fixed, it just goes on and off

Link to comment
Share on other sites

Guest francismori7
Ok, ill take yours then, where do i put it?

airhorn.wav: Emergency 4\Mods\Los Angeles Mod v1.5\Audio\Fx\sirens

Create a new file in "Emergency 4\Mods\Los Angeles Mod v1.5\Scripts\Game\Command" named "LAHorn.script". Put this code in it:

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);
int hornsoundID;
Vector CarPos = v.GetPosition();
hornsoundID = Audio::PlaySample3D("mod:Audio/FX/Sirens/airhorn.wav", CarPos, false);
//Audio::StopSample(hornsoundID);
}
};

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

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

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

Add the command to all the cars you want it to in the editor. The command is "VcmdHorn".

PS: Everything is fixed and works perfectly.

Airhorn.wav uploaded:

Link to comment
Share on other sites

Or try this, a shorter version (not tested!). :)

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)
{
Audio::PlaySample3D("mod:Audio/FX/Sirens/airhorn.wav", Caller->GetPosition(), false);
}
};

Link to comment
Share on other sites

Hoppah, you should include this in 1.7 because LA uses many times the air horn.

No, it's not usefull. I would prefer a whole menu where you can between sirens (yelp, horn, wail etc..), but that's only possible in missionscripts.

Link to comment
Share on other sites

Guest cop ford

can i get help with this air horn. my problem is that i don't know how to add the horn and how to add it to the script and how to get the horn on police cars can i get some help please

Link to comment
Share on other sites

can i get help with this air horn. my problem is that i don't know how to add the horn and how to add it to the script and how to get the horn on police cars can i get some help please

Why did you make a NEW TOPIC for your question? Anways, I've merged your post with this topic.

Everything is explained here. It's not hard, just take your time.

Link to comment
Share on other sites

Guest
This topic is now closed to further replies.



×
×
  • Create New...