xtron
Senior Member
Posts: 402
Threads: 37
Joined: May 2011
Reputation:
2
|
Stop music
What's the code, when the player reaches a specific area the music stops.
I can't get the:
void StopMusic(float afFadeTime, int alPrio);
To work... :/
EDIT: This doesn't seems to work :O. any ideas?
void func_piano1_disapear(string &in asEntity, int alState)
{
StartPlayerLookAt("piano1_disapear", 10, 50, "");
AddTimer("", 0.5f, "TimerDestroyPiano1");
}
void TimerDestoryPiano1(string &in asTimer)
{
SetPropHealth("piano1_disapear", -100);
PlayMusic("05_event_steps.ogg", false, 80, 0, 10, false);
GiveSanityDamage(4.0f, true);
PlaySoundAtEntity("", "react_scare.snt", "Player", 0, false);
AddTimer("", 1.0f, "TimerStopLook1");
}
void TimerStopLook1(string &in asTimer)
{
StopPlayerLookAt();
}
Dubstep <3
(This post was last modified: 06-06-2011, 11:49 AM by xtron.)
|
|
06-06-2011, 11:43 AM |
|
Tanshaydar
From Beyond
Posts: 3,085
Threads: 17
Joined: Mar 2009
Reputation:
67
|
RE: Stop music
alPrio should be same.
|
|
06-06-2011, 11:52 AM |
|
xtron
Senior Member
Posts: 402
Threads: 37
Joined: May 2011
Reputation:
2
|
RE: Stop music
(06-06-2011, 11:52 AM)Tanshaydar Wrote: alPrio should be same.
"should be same", what do you mean, should it stay like "int alPrio"?
Dubstep <3
|
|
06-06-2011, 11:53 AM |
|
Tanshaydar
From Beyond
Posts: 3,085
Threads: 17
Joined: Mar 2009
Reputation:
67
|
RE: Stop music
You wrote:
PlayMusic("05_event_steps.ogg", false, 80, 0, 10, false);
Here, alPrio is 10.
When you use StopMusic, you should write like this:
StopMusic( 0, 10);
|
|
06-06-2011, 12:04 PM |
|
xtron
Senior Member
Posts: 402
Threads: 37
Joined: May 2011
Reputation:
2
|
RE: Stop music
Ok thanks ^^.
Btw, can you check why my second script aint working?.
I edited my first post.
Dubstep <3
|
|
06-06-2011, 12:06 PM |
|
Tanshaydar
From Beyond
Posts: 3,085
Threads: 17
Joined: Mar 2009
Reputation:
67
|
RE: Stop music
TimerDestroyPiano1
TimerDestoryPiano1
Function and timer names are not same. Destroy - Destory
|
|
06-06-2011, 12:14 PM |
|
xtron
Senior Member
Posts: 402
Threads: 37
Joined: May 2011
Reputation:
2
|
RE: Stop music
(06-06-2011, 12:14 PM)Tanshaydar Wrote: TimerDestroyPiano1
TimerDestoryPiano1
Function and timer names are not same. Destroy - Destory
Oh. I'm so stupid xD
Thanks ! <3
It doesn't work...is the function right? the "(string &in asEntity, int alState)"
EDIT!: I got it working (solution: (string &in asParent, string &in asChild, int alState) as function)
But now when I enter the script the piano doesn't explode :S.
SetPropHealth("piano1", -100);
Dubstep <3
(This post was last modified: 06-06-2011, 12:50 PM by xtron.)
|
|
06-06-2011, 12:24 PM |
|
Tanshaydar
From Beyond
Posts: 3,085
Threads: 17
Joined: Mar 2009
Reputation:
67
|
RE: Stop music
void func_piano1_disapear(string &in asEntity, int alState)
I don't know where or why you call it. This phrase: "(string &in asEntity, int alState)" is used for state changes, like wheels or levers.
|
|
06-06-2011, 12:49 PM |
|
xtron
Senior Member
Posts: 402
Threads: 37
Joined: May 2011
Reputation:
2
|
RE: Stop music
Oh thanks.
asEntity is the if there's an entity involved?
and what is "string &in asParent, string &in asChild"?
Dubstep <3
|
|
06-06-2011, 12:53 PM |
|
Tanshaydar
From Beyond
Posts: 3,085
Threads: 17
Joined: Mar 2009
Reputation:
67
|
RE: Stop music
"string &in asParent, string &in asChild, int alState" is for collide callbacks. Parent is the entity to collide, like player or a grunt; Child is entity or area or whatever to be collided. State, 1 for entering -1 for exiting.
|
|
06-06-2011, 01:03 PM |
|
|