'LinKin Posted December 4, 2014 Share Posted December 4, 2014 Hello, I've some script that mutes a player in main chat or globally; So inside of those, in order to prevent a player talking in the chatbox, I use cancelEvent() inside onPlayerChat. I want to make another script that does something each time any message is output in the chatBox (by using onChatMessage) But I've one issue, this event will be triggered even if a muted player tries to chat, how could I prevent this without touching the other scripts that mute the player? I tried using wasEventCancelled() inside onChatMessage but it won't work. Thanks for your time. Link to comment
novo Posted December 8, 2014 Share Posted December 8, 2014 I'd use setPlayerMuted and isPlayerMuted instead, either way I don't see why wasEventCancelled would return false since the event itself is being cancelled. Although, "cancelEvent does not have an effect on all events, see the individual event's pages for information on what happens when the event is canceled. cancelEvent does not stop further event handlers from being called, as the order of event handlers being called is undefined in many cases. Instead, you can see if the currently active event has been cancelled using wasEventCancelled.". So basically, you could do it way easier by using the functions I stated above and therefore avoid having further issues. Link to comment
Moderators IIYAMA Posted December 8, 2014 Moderators Share Posted December 8, 2014 What about making them cooperate? 1 script checks if the other is running. (the one who doesn't mute, checks the one who mutes) If it is running, you start using export functions or a custom event. If not running, use the normal event. Link to comment
Sasu Posted December 8, 2014 Share Posted December 8, 2014 You could use getElementData too. 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