Jump to content

ColShape Problem


=RM=Mario

Recommended Posts

Posted

Alright,so i made this script to when you enter area in the desert for a DM map music would play,But when i start resource music plays no matter where on the map im at,i want the music to play when you Enter the col shape and, for it to turn off when you leave it,but isn't working,Thanks for help in Advance

DesertMusic = playSound("Music.ogg", true)
setSoundVolume(music,0)
 
col = createColRectangle  (-33.328407287598, 2004.6947021484, 17.640625,50)
 
function EnterDesert(theElement, matchingDimension )
if ( theElement == getLocalPlayer() ) then
	setSoundVolume(music,1)
end
end
addEventHandler ( "onClientColShapeHit", col, EnterDesert)
 
function LeaveDesert(theElement, matchingDimension)
if ( theElement == getLocalPlayer() ) then
	setSoundVolume(music,0)
end
end
addEventHandler("onClientColShapeLeave",col,LeaveDesert)

Posted

Must be some bug relating to a volume change before a single frame of sound has played - try either:

1. Using a Timer

setTimer(setSoundVolume,50,1,music,0)

2. Pausing the sound instead

setSoundPaused(DesertMusic,true)

Posted
Must be some bug relating to a volume change before a single frame of sound has played - try either:

1. Using a Timer

setTimer(setSoundVolume,50,1,music,0)

2. Pausing the sound instead

setSoundPaused(DesertMusic,true)

Didnt work :/

Posted

I'm assuming you tried the timer, and it just occurred to me what it'll be :P

DesertMusic = playSound("Music.ogg", true)
setSoundVolume(music,0)

See a problem there?

setSoundVolume(DesertMusic,0)

Posted

No,its doing same thing,music plays even tho im not inside col shape,if im outside it,its not sopose toplay music,but its playing the music anyways,i did what you told me

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...