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) 

Lua Scripter

?ucet=miki_cz

Owner of mshost.cz MTA portal.

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 ) 

357ac0078264.jpg

- Working on [php/HTML/Mysql/Lua/Java Scripts/Web Design/3D Modeling]

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.

Lua Scripter

?ucet=miki_cz

Owner of mshost.cz MTA portal.

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?

357ac0078264.jpg

- Working on [php/HTML/Mysql/Lua/Java Scripts/Web Design/3D Modeling]

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

it's working

try

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

357ac0078264.jpg

- Working on [php/HTML/Mysql/Lua/Java Scripts/Web Design/3D Modeling]

Posted
Still.. the event is not added client side.

show your all code, it's working on my server...

357ac0078264.jpg

- Working on [php/HTML/Mysql/Lua/Java Scripts/Web Design/3D Modeling]

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  

Lua Scripter

?ucet=miki_cz

Owner of mshost.cz MTA portal.

Posted

did you refresh the script on publick server?

and wait you trigger event from race to other resource?

357ac0078264.jpg

- Working on [php/HTML/Mysql/Lua/Java Scripts/Web Design/3D Modeling]

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

357ac0078264.jpg

- Working on [php/HTML/Mysql/Lua/Java Scripts/Web Design/3D Modeling]

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

Lua Scripter

?ucet=miki_cz

Owner of mshost.cz MTA portal.

Posted

15bce27d5441.jpg

man code is working

you're doing something wrong

search your error

Your error not in the CODE..

357ac0078264.jpg

- Working on [php/HTML/Mysql/Lua/Java Scripts/Web Design/3D Modeling]

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.

Lua Scripter

?ucet=miki_cz

Owner of mshost.cz MTA portal.

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