Jump to content

problems with events..


MIKI785

Recommended Posts

Hello,

I have problems with events... there are no errors or warning in the scripts but when I try to call client event "onPlayerWinTheRace" from server, it shows error that it;s not added client side. But i have this in client script:

addEvent("onPlayerWinTheRace",true) 
addEventHandler("onPlayerWinTheRace",getRootElement(),function) 

So, where is the problem?

Other events don't work as well in this script... from server > client.

The server side is this:

triggerClientEvent(getRootElement(), "onPlayerWinTheRace", player, player) 

Link to comment
triggerClientEvent(getRootElement(), "onPlayerWinTheRace", player, player) 

Why you need send two times 1 player?

function yourFunctionHere ( thePlayer,doublePlayer ) 
    --Your code Here 
end 
addEvent( "onPlayerWinTheRace", true ) 
addEventHandler( "onPlayerWinTheRace", getRootElement(), yourFunctionHere ) 

Link to comment
What did you change there? O_o

I send it twice, because the first one is source, and i don't use source, but first argument in the function.

try my code

you call trigger for ALL and send to client double players

example

player = MIKI785

so in client code will

outputChatBox ('guy '..getPlayerName(thePlayer)..' copy '..getPlayerName(doublePlayer),getRootElement(),255,255,255,true)  

Will guy MIKI785 copy MIKI785

why you need it?

Link to comment

I tested it on my local server and it worked, then I added it on public server and it doesn't work...

Client:

function showTheWinMessage(thePlayer) 
    --Code which is working.. 
end 
  
addEvent( "onPlayerWinTheRace", true ) 
addEventHandler( "onPlayerWinTheRace", getRootElement(), showTheWinMessage ) 
  

Server:

function playerWinTheRace(player) --This is called by the race..  
    triggerClientEvent("onPlayerWinTheRace", getRootElement(), player) 
end  

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