1. Iv Misticos

    Iv Misticos Scavenger

    Hi! How to deny or allow player connection? OnPlayerConnected or.. maybe CanClientLogin? What to use? I need to send a message such as "Ur banned on this server".. help plz
     
  2. Ryan

    Ryan Master Researcher Plugin Developer

    Ban them
     
  3. Wulf

    Wulf Community Admin Community Admin Oxide Developer

    You can use Rust's built-in banning to send them a message already as suggested above.

    If you really need to make a custom plugin, you can return a string in the CanClientLogin hook.
     
  4. Iv Misticos

    Iv Misticos Scavenger

    so i can use something like
    bool CanClientLogin(Network.Connection conn)
    {
    if 1=true {
    Puts("Success");
    return true;
    }
    if 1=false {
    Puts("NO");
    return "No. No and no.";
    }
    }
    ?? or how can i return message OR boolean?
    --- Double Post Merged, Oct 12, 2017 ---
    just in bool return string, yep?
     
  5. Wulf

    Wulf Community Admin Community Admin Oxide Developer

    Code (C#):
    object CanClientLogin(Network.Connection conn)
    {
        if (conn.username == "Bob") return "You're banned";
        return null;
    }
    or
    Code (C#):
    object CanClientLogin(Network.Connection conn)
    {
        return conn.userid == 700000000000000 ? "Go away" : (object)null;
    }
     
  6. Iv Misticos

    Iv Misticos Scavenger

    okay, thx. Say something about ? "Go away" : (object)null, i dont understand this :) plz, can u help me? And conn.authLevel returns 0 1 or 2, yeah? 1 is moderatorid and 2 is ownerid? Or no?
     
  7. Wulf

    Wulf Community Admin Community Admin Oxide Developer

    That's a shorthand if statement in C# in the 2nd example, which is essentially the same as the first example. You can use whatever method you are most familiar with.
     
  8. Ryan

    Ryan Master Researcher Plugin Developer

  9. Iv Misticos

    Iv Misticos Scavenger

    what about conn.authLevel? It will return 1 2 and 0? 1 is moderatorid and 2 is ownerid? Yes? No? Thx :)
     
  10. Wulf

    Wulf Community Admin Community Admin Oxide Developer

    I don't know if that is there off hand, but those are the correct auth levels.
     
    Iv Misticos likes this.
  11. Ryan

    Ryan Master Researcher Plugin Developer

    Yea that's right
     
    Iv Misticos likes this.
  12. Iv Misticos

    Iv Misticos Scavenger

    thx :) im trying to write my own plugin))
    --- Double Post Merged, Oct 12, 2017 ---
    ohh.. im using VS and when i use 4 example return "Bye"; it writes anonymous function, converted to a delegate, returning void, can't return any values