script:world_event:stopsoundeffectonpos
stopSoundEffectOnPos
- Parameters and types:
- pos: tableposition
- soundId: numbersound effect ID
- Return value and type:
- code: numberSuccess (ErrorCode.OK) ErrorCode
- The main function of this method is to stop the specified sound effect at the specified position.
- The specific use cases are as follows:
--Play music 10713 at the height 7 position (0,0) World:playSoundEffectOnPos({x=0,y=7,z=0},10713,100,1,false) --Display prompt in chat box Chat:sendSystemMsg("(0,0) height 7 position is playing music, make an animated expression to stop playing") --Execute this function when the player makes an animated expression local function Player_PlayAction(event) --Stop playing music 10713 at the height 7 position (0,0) --The first parameter is a table of coordinates of the music to be stopped --The second parameter is the music ID to stop playing. You can check it in the "Sound Effect Table Data" of "Mini World ID Query" World:stopSoundEffectOnPos({x=0,y=7,z=0},10713) -Display in the chat box Chat:sendSystemMsg("Stop playing (0,0) height 7 music 10713") end --Register an animation expression listener and execute the above function when the event occurs ScriptSupportEvent:registerEvent([=[Player.PlayAction]=],Player_PlayAction)
script/world_event/stopsoundeffectonpos.txt · Last modified: 2024/06/10 14:24 by don