GrainHHH Posted July 14, 2019 Share Posted July 14, 2019 For example: 1. addCommandhandler("test", function(player, command, something ) 2. triggerClientEvent(source, "event", source) Why the hell in first case i have to use player while in the second place, source? Thank you in advance Link to comment
HassoN Posted July 14, 2019 Share Posted July 14, 2019 For first case, you are not forced to use 'player' you may use any variable you wish. 2nd case, you are forced to use 'source' only in case if you are using an event (for example 'onPlayerJoin') so the player is the source of that event. Link to comment
Investor Posted July 14, 2019 Share Posted July 14, 2019 (edited) The difference is that only a player can issue a command, though an event's source could be any element type. This is why the wiki uses 'player' for command source variable, but you're free to use whatever name you want. Edited July 14, 2019 by Investor Link to comment
savour Posted July 14, 2019 Share Posted July 14, 2019 (edited) In the first case, the first argument is the player who typed the command, and it's up to you to call it whatever you want. in the second case the source gotta be defined in the parent event/function, also it refers for "which element (player) am i going to trigger this event for?" also, the source is most likely to be hidden, you will find what it refers to when you search about the parent event in the wiki (would be like "The source of this event is ...") Edited July 14, 2019 by savour 1 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