Jump to content

Event is not added to clientside


Lendiz

Recommended Posts

Hello there!

Serverside

addEvent("onRaceStateChanging", true) 
  
addEventHandler("onRaceStateChanging", getRootElement(), 
function(newStateName) 
if(newStateName == "Running") then 
triggerClientEvent(source,"mapRunningServer",source) 
end 
end) 
  

Clientside

addEvent("mapRunningServer",true) 
  
function musicStart() 
        if isTransferBoxActive() == false then 
            sound = playSound("sound.mp3") 
            else setTimer(musicStart,500,0) end 
end 
addEventHandler("mapRunningServer",root,musicStart) 
  

Getting error Server trigger event mapRunningServer but event not added to clientside

What wrong can be here?

Link to comment
  • 2 years later...
  • Moderators
On 20/08/2016 at 13:43, Lendiz said:

I think, i wrong understand you. You mean not use onRaceStateChanging?

And why u write about onResourceStart, if dont have it in script.

He is talking about the solution for this situation:

The server sending a triggerClientEvent. But unfortunately the client is still downloading/loading the scripts. So the message isn't delivered and will give you that error that you are having.

onClientResourceStart can be used as indication that the client is loaded and ready to receive triggerClientEvent's.

(For that specific resource atleast)

 

Edited by IIYAMA
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...