ok. overlay, works. overlay from URL, works. effects buildin the prefabs, works.
but the sound would be hard / not possible . would have to think to get that on a diff. way...
is it possible to "open" the container where the effects etc are in , adding something and pack that all together again ? or... adding my own audio clips to the game// clients somehow else ? maybe someone has some idea
Solved Play a sound client-side?
Discussion in 'Rust Development' started by Deicide666ra, Jul 25, 2015.
-
Wulf Community Admin
-
Got today another thought...
i already did it , with Virtual audio cable + Ingame voice chat to play sounds/music that others can hear.
i kinda recall that in legacy there was methods for voice sent etc , dont know if it was accessible or not.
Is there maybe something like that to be able to play something on that way? -
Wulf Community Admin
-
can i somehow access the method with that the player receives the sent voice , as server with BasePlayer `?
-
Wulf Community Admin
-
Wouldnt be able at all as a server to get to somewhere near that Method to change for example the Radius of a specific player?
Code:public void P2PBroadcast(float radius, P2PMessages.Type type, byte[] data, bool includeSelf = true) { if ((data != null) && (data.Length > 0)) { Vector3 position = base.transform.position; using (MemoryStream stream = new MemoryStream(data.Length + 1)) { using (BinaryWriter writer = new BinaryWriter(stream)) { writer.Write((byte) type); writer.Write(data); foreach (BasePlayer player in visiblePlayerList) { if (((((player != this) && (player != null)) && ((Vector3.Distance(position, player.transform.position) <= radius) && (player.userID != 0))) && player.isConnected) && !SteamNetworking.SendP2PPacket(new CSteamID(player.userID), stream.GetBuffer(), (uint) (data.Length + 1), EP2PSend.k_EP2PSendUnreliableNoDelay, 0)) { } } if (includeSelf) { stream.Position = 0L; SingletonComponent<SteamClient>.Instance.ProcessSteamNetworkingPacket(stream, new CSteamID(this.userID)); } } } } }0 0x0public void P2PBroadcast(float radius, P2PMessages.Type type, byte[] data, bool includeSelf = true) { if ((data != null) && (data.Length > 0)) { Vector3 position = base.transform.position; using (MemoryStream stream = new MemoryStream(data.Length + 1)) { using (BinaryWriter writer = new BinaryWriter(stream)) { writer.Write((byte) type); writer.Write(data); foreach (BasePlayer player in visiblePlayerList) { if (((((player != this) && (player != null)) && ((Vector3.Distance(position, player.transform.position) <= radius) && (player.userID != 0))) && player.isConnected) && !SteamNetworking.SendP2PPacket(new CSteamID(player.userID), stream.GetBuffer(), (uint) (data.Length + 1), EP2PSend.k_EP2PSendUnreliableNoDelay, 0)) { } } if (includeSelf) { stream.Position = 0L; SingletonComponent<SteamClient>.Instance.ProcessSteamNetworkingPacket(stream, new CSteamID(this.userID)); } } } } }
-
Wulf Community Admin
-
argh shit xd ... sry that im still debating that . just thought i found something .
Little question besides that - some fields or methods are marked as public, but it seems that i cannot do anything with them.
Like a bit time ago that question if i can get the Current bullet position ....
Dunno why then they public. -
Sry to catch up on this again, but got a little thought.
As far as i know, the HumanNPC's that can be created with the Plugin from Nogrod, can be counted as Players that also
have an actual ID.
Wouldnt it be possible to use the Npc to "Speak" ( or play a sound with Virtual audio cable) ? -
-
how would you send effect to all players online?
-
Wulf Community Admin
-
i tried
Code:foreach (var player in BasePlayer.activePlayerList) Effect.server.Run("assets/bundled/prefabs/fx/survey_explosion.prefab", player.transform.position, Vector3.zero, null, false);
error CS0103: The name `player' does not exist in the current contextLast edited by a moderator: Jan 22, 2017 -
Wulf Community Admin
-
Code:Effect.server.Run("assets/bundled/prefabs/fx/survey_explosion.prefab", player.transform.position, Vector3.zero, null, false);
[DOUBLEPOST=1485061610][/DOUBLEPOST]This line is giving that error foreach (BasePlayer player in BasePlayer.activePlayerList)
[DOUBLEPOST=1485062200][/DOUBLEPOST]Code:private void StartRadTimers() { int ontime = configData.Timers.Static_On; int offtime = configData.Timers.Static_Off; if (configData.Options.Use_RandomTimers) { ontime = GetRandom(configData.Timers.Random_OnMin, configData.Timers.Random_OnMax); offtime = GetRandom(configData.Timers.Random_OffMin, configData.Timers.Random_OffMax); } OnTimer = ontime * 60; timer.Repeat(1, OnTimer, () => { OnTimer--; if (OnTimer == 0) { foreach (var zone in RadiationZones) zone.Deactivate(); if (configData.Options.Using_InfoPanel) timer.Once(5, ()=> ConVar.Server.radiation = false); if (configData.Options.Broadcast_Timers) rust.RunServerCommand($"weather.rain 1"); timer.In(20, () => rust.RunServerCommand($"weather.rain 0")); MessageAllPlayers(lang.GetMessage("RadsOffMsg", this), offtime); OffTimer = offtime * 60; timer.Repeat(1, OffTimer, () => { OffTimer--; if (OffTimer == 0) { foreach (var zone in RadiationZones) zone.Reactivate(); if (configData.Options.Using_InfoPanel) ConVar.Server.radiation = true; if (configData.Options.Broadcast_Timers) MessageAllPlayers(lang.GetMessage("RadsOnMsg", this), ontime); StartRadTimers(); foreach (var player in BasePlayer.activePlayerList) Effect.server.Run("assets/bundled/prefabs/fx/survey_explosion.prefab", player.transform.position, Vector3.zero, null, false); { ForcePlayerPosition(player, "-590.5, 2.3, 51.6".ToVector3()); player.Respawn(); } } }); } }); }
Last edited by a moderator: Jan 22, 2017 -
public BasePlayer player; -
Wulf Community Admin
-
Idn then i been looking at examples all day cant seem to get rid of CS0103: The name `player' does not exist in the current context not sure what im missing for line foreach (BasePlayer player in BasePlayer.activePlayerList)
-
Wulf Community Admin