Et-win Posted June 29, 2014 Share Posted June 29, 2014 I was wondering what the difference is between: triggerClientEvent(source, "OnStuff", getRootElement(), arguments...) and: triggerClientEvent(source, "OnStuff", source, arguments...) Link to comment
xXMADEXx Posted June 29, 2014 Share Posted June 29, 2014 The 3rd argument is for the source. So, in the top code, the source on the client code will be getRootElement() and on the bottom code, the source on the client code will be whatever the source is on the server-side. https://wiki.multitheftauto.com/wiki/TriggerClientEvent Link to comment
codeluaeveryday Posted June 29, 2014 Share Posted June 29, 2014 No XxMadexX... You're stating the obvious. getRootElement() returns a lot of data and is not recommended to trigger the root element. Using source or something small is much better. Link to comment
Et-win Posted June 29, 2014 Author Share Posted June 29, 2014 So if I use the second one (Double source), then nothing important what has to happen will change in the function? Link to comment
Max+ Posted June 29, 2014 Share Posted June 29, 2014 well, i think the first one , trigger for all players , and second one , for 1 player witch is source , just like if you want to play sound for the killer only , triggerClientEvent ( killer, 'PlaySound', killer ) Link to comment
Et-win Posted June 29, 2014 Author Share Posted June 29, 2014 well, i think the first one , trigger for all players , and second one , for 1 player witch is source No, they are both for 1 person, because the 'sendTo' argument (Argument 1) is source. I'm just wondering what changes if I use source instead of getRootElement() on the third argument Link to comment
aintaro Posted June 29, 2014 Share Posted June 29, 2014 well, i think the first one , trigger for all players , and second one , for 1 player witch is source No, they are both for 1 person, because the 'sendTo' argument (Argument 1) is source. I'm just wondering what changes if I use source instead of getRootElement() on the third argument triggerClientEvent First argument is the root (to all the player) by default, if you set this to for example : source, then you will specify a single player to this event, thats why you should always use the sendTo argument if you can. third paramater = The element that is the source of the event. root = all players on the server source = a specific player on the server Link to comment
Max+ Posted June 30, 2014 Share Posted June 30, 2014 See, as i told you same as aintaro post , Link to comment
Et-win Posted June 30, 2014 Author Share Posted June 30, 2014 Well, I understood his explantion much better... Anyway, thanks all Link to comment
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