Jump to content

TriggerServerEvent Question


Et-win

Recommended Posts

Posted

I was wondering what the difference is between:

triggerClientEvent(source, "OnStuff", getRootElement(), arguments...) 

and:

triggerClientEvent(source, "OnStuff", source, arguments...) 

Posted

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

Posted
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 :P

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

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