Jump to content

Ajuda ai familia


Recommended Posts

Boa Noite rapaziada, to com esse script de musica no painel de login, porem quando eu logo a musica continua tocando, alguem poderia ajuda? 

-- by dzek, dzek.metal.info/mta/

addEventHandler("onClientResourceStart", getResourceRootElement(getThisResource()), function()
	-- little interval, music is getting laggy when all resources are starting..
	setTimer(function()
		playSound("joinsound.mp3")
	end, 2000, 1)
end
)

 

Link to comment
client.Lua

function playmusic()
	sound = playSound("joinsound.mp3")
end

function stopmusic()
	stopSound(sound)
end

addEventHandler("onClientResourceStart", getResourceRootElement(getThisResource()), function()
	-- little interval, music is getting laggy when all resources are starting..
	setTimer(function()
	playmusic()
	end, 2000, 1)
end
)


function pararsom()
	stopmusic()
end
addEvent("pararsom", true)
addEventHandler("pararsom", root, pararsom)
server.Lua
-- root = getElementRoot()
addEventHandler("onPlayerLogin", root,
  function()
    triggerClientEvent ( source,"pararsom",source)
  end
)

 

Link to comment
1 hour ago, SetMarcos said:

client.Lua

function playmusic()
	sound = playSound("joinsound.mp3")
end

function stopmusic()
	stopSound(sound)
end

addEventHandler("onClientResourceStart", getResourceRootElement(getThisResource()), function()
	-- little interval, music is getting laggy when all resources are starting..
	setTimer(function()
	playmusic()
	end, 2000, 1)
end
)


function pararsom()
	stopmusic()
end
addEvent("pararsom", true)
addEventHandler("pararsom", root, pararsom)

server.Lua
-- root = getElementRoot()
addEventHandler("onPlayerLogin", root,
  function()
    triggerClientEvent ( source,"pararsom",source)
  end
)

 

Testei aqui, e nao funcionou :/

Link to comment
  • Other Languages Moderators

Client

function stopmusic()
	if (isElement (sound)) then
		stopSound(sound)
	end
end
addEvent ("pararsom", true)
addEventHandler ("pararsom", root, stopmusic)

addEventHandler ("onClientResourceStart", resourceRoot, function()
	setTimer (function()
		sound = playSound ("joinsound.mp3")
	end, 2000, 1)
end)

Server

addEventHandler ("onPlayerLogin", root, function()
	triggerClientEvent (source, "pararsom", source)
end)

 

  • Thanks 1
Link to comment
1 hour ago, Lord Henry said:

Client


function stopmusic()
	if (isElement (sound)) then
		stopSound(sound)
	end
end
addEvent ("pararsom", true)
addEventHandler ("pararsom", root, stopmusic)

addEventHandler ("onClientResourceStart", resourceRoot, function()
	setTimer (function()
		sound = playSound ("joinsound.mp3")
	end, 2000, 1)
end)

Server


addEventHandler ("onPlayerLogin", root, function()
	triggerClientEvent (source, "pararsom", source)
end)

 

Testei aqui, não funcionou tambem :(

 

Link to comment
13 hours ago, DNL291 said:

Vê se no debug mostra algum erro e você pode testar se o evento onPlayerChat desse resource está sendo chamado colocando alguma output no código, faça o mesmo no lado cliente.

Se não conseguir fazer funcionar mostre aqui o arquivo meta.

Vou testar pelo debugscript

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