Jump to content

problems with events..


MIKI785

Recommended Posts

Posted

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) 

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

Posted

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.

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

Posted
What? It still says that the event is not added client side...

it's working

try

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

Posted

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  

Posted
No, it's exported function, at it is called...

Yes, I refreshed it, i'm not that stupid...

man code is working

you're doing something wrong,you need restart resource on the publick server

search your error

Posted
OMG, I did it like 20 times? It still says that the event is not added client side, there are no other errors or anything,...

LoL,

The same code works on my local server... WTF?!

Posted

It works now...

The problem was in the protected argument in meta... it works on windows server, on linux server, the script won't work O_o.

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