Jump to content

Need help: cancel playsound and cameramatrix?


Cronoss

Recommended Posts

I made a login menu for my server, I wanted to put some buildings as a background so  I used setCameraMatrix, all works perfectly,  but when I try to cancel the camera position and the music (I added playSound too) it doesn't work and the camera keeps far from the player, and the music keeps playing

 

Client-Side

function fondoLogin(thePlayer)
	local cancion = playSound("loginSoundtrack.mp3")
	setSoundVolume(cancion, 0.5)
	setElementPosition(thePlayer, -1400.2099609375,106.88999938965,1032.2734375)
	setElementInterior(thePlayer, 1)
	setCameraMatrix ( 1709.7098388672,-1449.96484375,151.87727355957, 1537.9990234375,-1276.736328125,238.57434082031, 0, 100 )
	triggerServerEvent(source, "parartodo", source)
	end
	addEvent("posicionar", true)
	addEventHandler("posicionar", getLocalPlayer(), fondoLogin)

---------Suposed to stops the music and cameraMatrix----------------
	function parartodo(thePlayer, cancion)
	setCameraTarget (thePlayer)
	stopSound(cancion)
	end

	addEvent("pararmusicaycamara", true)
	addEventHandler("pararmusicaycamara", getLocalPlayer(), parartodo)

 Server-Side

function registroHRP(user, clavecreada)
	if(addAccount(user, clavecreada))then
		outputChatBox("Bienvenido")
		triggerClientEvent(source, "cerrar", source)
		logIn(source, getAccount(user, clavecreada), clavecreada)
		setElementPosition(source, 209.41818237305,-33.872188568115,1001.9296875)
 		setElementInterior(source, 1)
		setElementDimension(source, 1)
		setPedRotation(source, 180)
		triggerClientEvent(source, "pararmusicaycamara", source)

	else
		outputChatBox("La cuenta ya existe.")
	end
end
-----------"triggerClientEvent(source, "pararmusicaycamara", source)" doesn't work--------------

 

Link to comment
here you can call posicionar event with triggerClientEvent to trigger music and camera matrix
triggerClientEvent(source, "posicionar", source) -- trigger music and camera matrix
use triggerClientEvent again to end music and camera matrix when player login
triggerClientEvent(source, "pararmusicaycamara", source) -- stop music and camera matrix

 

local cancion = playSound("loginSoundtrack.mp3")
setSoundPaused(cancion, true) -- create but stop music when resource starts

function fondoLogin() -- no theplayer parameter needed here
    setSoundPaused(cancion, false) -- play music
    setSoundVolume(cancion, 0.5)
    setElementPosition(source, -1400.2099609375,106.88999938965,1032.2734375)
    setElementInterior(source, 1)
    setCameraMatrix ( 1709.7098388672,-1449.96484375,151.87727355957, 1537.9990234375,-1276.736328125,238.57434082031, 0, 100 )
end
addEvent("posicionar", true)
addEventHandler("posicionar", getLocalPlayer(), fondoLogin)

---------Suposed to stops the music and cameraMatrix----------------

function parartodo() -- no theplayer parameter needed here
   setCameraTarget(source) 
   stopSound(cancion)
end
addEvent("pararmusicaycamara", true)
addEventHandler("pararmusicaycamara", getLocalPlayer(), parartodo)
Edited by Burak5312
  • Like 1
  • Thanks 1
Link to comment

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...