1. This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn More.
  2. Please provide some basic details that briefly describes the plugin you are requesting when making a request for a private/custom plugin, or any plugin. Plugin requests with no details will be removed at our discretion.

Solved Play sound on admin join

Discussion in 'Plugin Requests' started by Macthelost, Jun 19, 2016.

  1. Macthelost

    Macthelost Naked Wanderer

    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!
    Last edited: Jun 19, 2016
  2. LaserHydra

    LaserHydra Plugin Developer

    You will need to run the Effect prefab using Rust's Effect.Run method.
    You can get all Prefabs using the Pool.
  3. Macthelost

    Macthelost Naked Wanderer

    What does that mean? I'm sorry, I'm more of an amateur programmer.
  4. sami37

    sami37 Plugin Developer

    something like that

    Code (Text):
    Effect.server.Run("assets/prefabs/npc/patrol helicopter/effects/rocket_fire.prefab", player.transform.position);
    LaserHydra likes this.
  5. Macthelost

    Macthelost Naked Wanderer

    I tried that, but it didn't work. Here is the code I used it in:
    Code (Text):
            void OnPlayerInit(BasePlayer player)
                if (!showConnections)

                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: Jun 20, 2016
  6. serezhadelaet

    serezhadelaet Plugin Developer

    try it
    Code (Text):
    void OnPlayerInit(BasePlayer player)
            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);
    Findles and LaserHydra like this.
  7. Macthelost

    Macthelost Naked Wanderer

    It worked, but I want it to play a custom sound effect, like when an infamous player joins a heist in PayDay 2.
  8. Wulf

    Wulf Community Admin Community Admin Oxide Developer

    You can't use custom sounds, you can only use the effects that in the game.
  9. Macthelost

    Macthelost Naked Wanderer

    Oh, okay. Thanks anyway!
  10. horstmann2901

    horstmann2901 Naked Wanderer

    Where must i write this code to Play the Sound?
  11. Lomarine

    Lomarine Scavenger

    What i must use in plugin?
    Code (Text):
    using System;
  12. Wulf

    Wulf Community Admin Community Admin Oxide Developer

    Use Visual Studio and setup a project with references to the Rust and Oxide DLLs, it will generally tell you.
  13. Findles

    Findles Shack Builder

    if you use brackets you get error that non-invocable member cannot be used like a method

    confirmed works
  14. Kappasaurus

    Kappasaurus Plugin Developer

    At the time that was posted that was correct. What's the point of correcting somebody in a dead thread anyway?
  15. Findles

    Findles Shack Builder

    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.
  16. Wulf

    Wulf Community Admin Community Admin Oxide Developer

    The () in IsAdmin is what the method used to have, the code is from over a year ago where that was valid.
  17. Findles

    Findles Shack Builder

    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
  18. Wulf

    Wulf Community Admin Community Admin Oxide Developer

    No worries. :)