Jump to content

Ajuda ai familia


Recommended Posts

Posted

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
)

 

Posted
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
)

 

Posted
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 :/

  • Moderators
Posted

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)

 

Eu te ajudei ou achou meu comentário útil? Não esqueça de deixar um Thanks! spacer.png

Minhas contribuições para a comunidade: LordHenry - MTA Wiki Profile
Inscreva-se no meu canal do YouTube: Lord Henry - Entertainment
Discord Oficial do MTA: https://mtasa.com/discord
Blacklist e Whitelist de Scripters: Planilha

Por favor, não me envie mensagens privadas solicitando suporte. Crie um tópico no fórum em vez disso.

Posted
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 :(

 

Posted
1 hour ago, Niick said:

Testei aqui, não funcionou tambem :(

 

Estranho não funcionar, fez tudo certo? Colocou no lado certo?

? DID I HELP YOU? 

Tsd6e1t.png

________________________________________________________________________

ム MY STEAM

76561198321211115.png

________________________________________________________________________

? MY SITE

cGejgxz.png

www.tommy.br.com

Posted

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.

Please do not PM me with scripting related question nor support, use the forums instead.

Posted
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

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