Jump to content


Air horn script


  • This topic is locked This topic is locked
126 replies to this topic

#1 Guest_francismori7_*

Guest_francismori7_*
  • Guests

Posted 09 July 2008 - 08:04 PM

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?

#2 Newfoundking

Newfoundking

    The Real Slim Shady

  • Moderator
  • 7,253 posts
  • Gender:Male
  • Location:Newfoundland

Posted 09 July 2008 - 08:19 PM

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!

Wanna play multiplayer without any of the commitment? Emergency Planet hosts casual multiplayer to all its members! Contact me for more information

 

Executive Director: EMP Gulag

 

Do you have a warning that you want to go away, or are you facing another punishment you don't want? Contact me for the NEW alternative!


#3 Guest_francismori7_*

Guest_francismori7_*
  • Guests

Posted 09 July 2008 - 08:31 PM

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

#4 Nyox

Nyox

    Firefighter

  • Members
  • 13 posts
  • Gender:Male
  • Location:Brescia,lombardia,Italy

Posted 09 July 2008 - 09:05 PM

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



Posted Image
Posted Image

#5 Guest_francismori7_*

Guest_francismori7_*
  • Guests

Posted 09 July 2008 - 09:06 PM

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



Posted Image

Would you mind posting the code? Thanks.

#6 Nyox

Nyox

    Firefighter

  • Members
  • 13 posts
  • Gender:Male
  • Location:Brescia,lombardia,Italy

Posted 09 July 2008 - 09:11 PM

ok :12:

file removed

Attached Files


Posted Image

#7 Guest_francismori7_*

Guest_francismori7_*
  • Guests

Posted 09 July 2008 - 09:12 PM

I will try to see if I can do something.

#8 Guest_francismori7_*

Guest_francismori7_*
  • Guests

Posted 09 July 2008 - 09:15 PM

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

Click > Beep
Not
Click > Beeeeeeeeeeeeeeeeeeeeeeeeeep(until Click)

See?

#9 Nyox

Nyox

    Firefighter

  • Members
  • 13 posts
  • Gender:Male
  • Location:Brescia,lombardia,Italy

Posted 09 July 2008 - 09:20 PM

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


(sorry for my bad english)
Posted Image

#10 Guest_francismori7_*

Guest_francismori7_*
  • Guests

Posted 09 July 2008 - 09:25 PM

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?

#11 Guest_lord_bonev_*

Guest_lord_bonev_*
  • Guests

Posted 09 July 2008 - 09:37 PM

Later a will pos my commentar for this "bee" (LAsiren.script)

#12 Nyox

Nyox

    Firefighter

  • Members
  • 13 posts
  • Gender:Male
  • Location:Brescia,lombardia,Italy

Posted 09 July 2008 - 09:38 PM

oh, you don't want that the sound is played continuously ?

i don't know how to make it, for now
Posted Image

#13 Newfoundking

Newfoundking

    The Real Slim Shady

  • Moderator
  • 7,253 posts
  • Gender:Male
  • Location:Newfoundland

Posted 09 July 2008 - 09:42 PM

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

Wanna play multiplayer without any of the commitment? Emergency Planet hosts casual multiplayer to all its members! Contact me for more information

 

Executive Director: EMP Gulag

 

Do you have a warning that you want to go away, or are you facing another punishment you don't want? Contact me for the NEW alternative!


#14 Guest_francismori7_*

Guest_francismori7_*
  • Guests

Posted 09 July 2008 - 09:49 PM

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:

#15 Guest_lord_bonev_*

Guest_lord_bonev_*
  • Guests

Posted 09 July 2008 - 10:25 PM

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?

#16 Guest_francismori7_*

Guest_francismori7_*
  • Guests

Posted 09 July 2008 - 10:54 PM

I just want a command script for it.

#17 Guest_francismori7_*

Guest_francismori7_*
  • Guests

Posted 10 July 2008 - 01:03 AM

New code bellow

#18 Guest_francismori7_*

Guest_francismori7_*
  • Guests

Posted 10 July 2008 - 01:35 AM

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

#19 Guest_francismori7_*

Guest_francismori7_*
  • Guests

Posted 10 July 2008 - 02:08 AM

ok :12:

LAsiren

I fixed your code so the icon will show up correctly:
LASiren.script

PS: Also need help for the post above.

EDIT: WOW. WTF. Quadruple post :s Sorry...

#20 Guest_firefighter116_*

Guest_firefighter116_*
  • Guests

Posted 10 July 2008 - 04:50 AM

maybe hoppah will give a word of advice