I am a C# programmer myself, but I couldn't find anything in the Oxide API that would allow me to play a sound to everyone on the server. I want to have a custom sound play when a server admin joins. Thank You!
Solved Play sound on admin join
Discussion in 'Plugin Requests' started by Macthelost, Jun 19, 2016.
-
You will need to run the Effect prefab using Rust's Effect.Run method.
You can get all Prefabs using the Pool. -
-
Code:Effect.server.Run("assets/prefabs/npc/patrol helicopter/effects/rocket_fire.prefab", player.transform.position);
-
I tried that, but it didn't work. Here is the code I used it in:
Code:void OnPlayerInit(BasePlayer player) { if (!showConnections) return; if (player.IsAdmin()) { rust.BroadcastChat(string.Format(joinFormat, player.displayName, adminColour), null, player.UserIDString); Effect.server.Run("assets/prefabs/weapons/f1 grenade/effects/f1grenade_explosion.prefab", player.transform.position); } else if (!onlyShowAdmins) rust.BroadcastChat(string.Format(joinFormat, player.displayName, userColour), null, player.UserIDString); }
Last edited by a moderator: Jun 20, 2016 -
try it
Code:void OnPlayerInit(BasePlayer player) { if(player.IsAdmin()) foreach(var active in BasePlayer.activePlayerList) Effect.server.Run("assets/prefabs/weapons/f1 grenade/effects/f1grenade_explosion.prefab", active.transform.position, Vector3.zero, null, false); }
-
It worked, but I want it to play a custom sound effect, like when an infamous player joins a heist in PayDay 2.
-
Wulf Community Admin
-
-
Where must i write this code to Play the Sound?
-
Code:
using System;
-
Wulf Community Admin
-
if you use brackets you get error that non-invocable member cannot be used like a method
confirmed works -
-
When I tried it I got an error. I removed () to fix and figured I'd share.
By the way I didn't revive this thread. Check the date stamps. Lomarine or future person might find the reply helpful. -
Wulf Community Admin
-
Ok, I recall that now. Yeah, I guess I could come across as a dick if it seems like I'm looking at old posts to correct them. I didn't look at the time stamps when I posted so lesson learned. Comment was more for stranger and horst's benefit even though I was replying to serez. Sorry
-
Wulf Community Admin