Jump to content

Question related to TriggerClient/Server(Event)


Hero192

Recommended Posts

Posted

Hello dear MTA Scripters,

Today I want to ask about trigger function,

I want to know in which case I have to set root and source/player to sourceElement arguments

Like ,

triggerClientEvent (getRootElement(), "eventName", getRootElement()) 

and in which case I have to use source or player

triggerClientEvent (source, "eventName" source ) 

and does that refer the same as triggerServerEvent ?

triggerServerEvent("eventName", getRootElement() ) 

I really need to understand that properly..

Thanks in advance.

Posted

I'm not sure about the source == getRootElement() but I can say that these two are the same;

triggerClientEvent ( source, "eventName", source ); 
triggerClientEvent ( "eventName", source, source );  

You might even be able to leave out the second source is the second line since that'll only push the playerElement in the parameters in your client.

logo-small.png?v=3 tiny-sapdfr.png

 

If you want to contact me directly concerning Advanced-Gaming, please contact me at [email protected]

  • Moderators
Posted

In my opinion, resourceRoot is the best solution when you send a trigger to all players.

Do you want to improve your Lua programming skills and make less mistakes?   Start with Lua Language Server!   🙀

 

  Useful functions  3x 

  Tutorials  4x 

 

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