Jump to content

won't work


Desaster

Recommended Posts

Posted

I cant find the problem

addEventHandler("onPlayerLogin", root, 
function() 
JoinMusic = playSound("music/join.mp3") 
end) 
  

ERROR : attemp to call global playSound ( a nil value )

Posted (edited)
'onPlayerLogin' 

is server side and

playSound 

is client side

Use the

triggerClientEvent 

from server side to client side.

Edited by Guest
Posted
--client side -- 
JoinMusic = playSound("music/join.mp3") 
  
addEvent("onPlayerLogin", true) 
addEventHandler("onClientPlayerSpawn", root, 
function() 
    if isElement(JoinMusic) then 
        destroyElement(JoinMusic) 
    end 
end) 
  

-- Server Side -- 
  
addEventHandler("onPlayerLogin", root, 
function() 
    triggerClientEvent(source, "onClientPlayerSpawn", source) 
end) 
  
  

Posted
--client side -- 
JoinMusic = playSound("music/join.mp3") 
  
addEvent("onPlayerLogin", true) 
addEventHandler("onClientPlayerSpawn", root, 
function() 
    if isElement(JoinMusic) then 
        destroyElement(JoinMusic) 
    end 
end) 
  

-- Server Side -- 
  
addEventHandler("onPlayerLogin", root, 
function() 
    triggerClientEvent(source, "onClientPlayerSpawn", source) 
end) 
  
  

You have a problem in the client side, you put "onPlayerLogin" on addEvent, and "onClientPlayerSpawn" on addEventHandler.

Posted

client :

addEvent("onPlayerPlayMusic", true) 
addEventHandler("onPlayerPlayMusic", root, 
function() 
JoinMusic = playSound("music/join.mp3") 
end) 

server :

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

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