#How to get an event when a player starts/finishes speaking
73 messages ยท Page 1 of 1 (latest)
Look at PlayerVoice , if the event isnt static youll have to get it from the player instance Player.voice
There is a method there, but it doesn't work.
And there is isTalking, but it is also not working.
Do you not know how events work?? @oblique arch
PlayerVoice.onRelayVoice += YourMethod;
Yes
Player.Player.Voice.onRelayVoice
I'm doing this in the UnturnedPlayerComponent, because in the event itself I can't get a player who does it.
In protected override void Load()
@languid crystal Do you have any ideas how to solve this?
๐ฆ
Its a static event
Move it to Load() in your plugin
How I can get UnturnedPlayer speaker?
From what other object?
There's only bool
Where??
in PlayerVoice.onRelayVoice
...
There are like 5 parameters
Set up your method correctly
Google how to use events in C#
The delegate that the event uses clearly has all the information that you need
Set up your subscribed method properly
This is a you issue
Do += methodthatdoesntexist and use visual studio "generate method", itl setup it correctly
Make sure to unsubscribe from the event on onUnload
I did
That's what I did
I'm so sorry, I mixed it up with another event.
But as far as I understand, he starts talking, or ends
Yes thats when that event triggers
And how do you know when he's done talking?
if it exists id be in the same file
try onTalkingChanged
Kind of like there's only a bool parameter, and it doesn't seem to work
doesnt seem to work
Wdym???
I'm using a translator, it's hard for me to convey something
What information do you need that you dont have?
the player who stopped/started talking?
its an instance event, youll have to keep track of that
Easiest way would be to do:
U.Events.OnPlayerConnected += OnPlayerConnected;
// ...
private void OnPlayerConnected(UnturnedPlayer player)
{
player.Player.voice.onTalkingChanged += (bool isTalking) => OnTalkingChanged(player, isTalking);
}
private void OnTalkingChanged(UnturnedPlayer player, bool isTalking)
{
Rocket.Core.Logging.Logger.Log($"{player.DisplayName} talking state updated to {isTalking}!");
}
ty sir
Do you know how to disable the standard microphone icon? (I canโt find WidgetFlag)
You cant
you could try emailing Nelson about it
Thats all client side
Plugins run server side
you cant modify the client using a plugin*
You cant overwrite that texture
its part of core.masterbundle
you can only ADD new stuff using workshop mods
The only way to disable it would be to make a client sided module that disables it
But that doesnt work for servers really
since that something youd have to install before hand
wdym?
or bother Nelson and get him to add a widget plugin flag to disable it, which is a lot more practical
You cant disable a texture
??
Like sure you can modify YOUR game files
but that will prevent you from joining multiplayer servers
But that wont modify anyone elses game files
Pretty sure Vanilla UI is rendered on top of Modded Workshop UI
hm or idk
unsure what elements are actually rendered on top
