Hero192 Posted February 9, 2016 Posted February 9, 2016 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.
tosfera Posted February 10, 2016 Posted February 10, 2016 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.
Hero192 Posted February 10, 2016 Author Posted February 10, 2016 I mean is rootElement / resourceRoot needed? if so in which case I have to use it ?
tosfera Posted February 10, 2016 Posted February 10, 2016 For a trigger, no. You can always take a random player with getRandomPlayer and not add a check to see if the source or given player equals to getLocalPlayer.
Moderators IIYAMA Posted February 10, 2016 Moderators Posted February 10, 2016 In my opinion, resourceRoot is the best solution when you send a trigger to all players.
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now