In an old thread (https://oxidemod.org/threads/play-a-sound-client-side.10518/) Wulf and another user talk about playing custom sounds. In this thread, the other user talks about using voice chat to play sounds, but back then, vc was p2p. This has since been changed. How would I go about using this hook to send custom bytes instead of what a player actually said, and more importantly, how would I send these kind of sounds on command and not wait for the hook to have to trigger?
Modifying/sending custom voice in OnPlayerVoice?
In response to Hunt3r101 ():In an old thread (https://oxidemod.org/threads/play-a-sound-client-side.10518/) Wulf and another use...
This part is very complicated and I'm not sure, but (just maybe):
- Create a bot which fakes another player
- Make him invisible (see plugins such as vanish)
- Play sound through him (need further research)
I think I have the major parts of this done. I already have some code to send a voice packet across the network but I haven't done the fake player thing yet and the packet requires a player ID. Once I get some friends on I will see if it works but the fact that plugins can't acess the filesystem makes it really hard to actually load sound files to play as a test. Is there any fast ways to get around that and load wav files? Or am I forced to convert to an extension/build a custom oxide branch?
Merged post
Once I get home (assuming it works) I will drop the code here for any people passing by looking to do the same.
Merged post
Once I get home (assuming it works) I will drop the code here for any people passing by looking to do the same.
In response to Hunt3r101 ():I think I have the major parts of this done. I already have some code to send a voice packet across...
Plugins are sandboxed for security. You'd need an extension for filesystem access outside of what plugins are allowed.
If posting code, please only post the relevant snippet, not an entire plugin as the forums are not for releases.
If posting code, please only post the relevant snippet, not an entire plugin as the forums are not for releases.
byte[] bytes = new byte[] { data };
Net.sv.write.PacketID(Message.Type.VoiceData);
Net.sv.write.UInt32(player.net.ID);
Net.sv.write.BytesWithSize(bytes);
Is there any sort of documentation for packets? I couldn't find any. Anyways, this is what I came up with. Haven't actually tested it with two people yet.
Net.sv.write.PacketID(Message.Type.VoiceData);
Net.sv.write.UInt32(player.net.ID);
Net.sv.write.BytesWithSize(bytes);
Is there any sort of documentation for packets? I couldn't find any. Anyways, this is what I came up with. Haven't actually tested it with two people yet.