Jump to content

playSound for everybody


Normand

Recommended Posts

Ohh, :~, What?! I don't understand it, sorry. Please fix it for all player, please.

Code:

Client:

function szirenak()
	sound = playSound("szirena.mp3")
end

addEvent("SzirenaLejatszasa", true)
addEventHandler("SzirenaLejatszasa", root, szirenak)

 

Server:

function Szirena(player, command)
	triggerClientEvent(player, "SzirenaLejatszasa", player)
end

addCommandHandler("szirena", Szirena)
Edited by Normand
problem
Link to comment
function Szirena(player, command)
	triggerClientEvent(root, "SzirenaLejatszasa", player)
end

addCommandHandler("szirena", Szirena)

It should look like that, the first argument to triggerClientEvent is the players it's gonna trigger for, root is everyone.

Link to comment
--Client
function szirenak()

if isElement(sound) then stopSound(sound) end 
	
sound = playSound("szirena.mp3")

end

addEvent("SzirenaLejatszasa", true)

addEventHandler("SzirenaLejatszasa", root, szirenak)

-- Server

function Szirena(player, command)

	triggerClientEvent("SzirenaLejatszasa",root)

end
addCommandHandler("szirena", Szirena)

 

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