1. 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. Ban them
     
  3. Wulf

    Wulf Community Admin

    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. 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?
    [DOUBLEPOST=1507833935][/DOUBLEPOST]just in bool return string, yep?
     
  5. Wulf

    Wulf Community Admin

    Code:
    object CanClientLogin(Network.Connection conn)
    {
        if (conn.username == "Bob") return "You're banned";
        return null;
    }
    or
    Code:
    object CanClientLogin(Network.Connection conn)
    {
        return conn.userid == 700000000000000 ? "Go away" : (object)null;
    }
     
  6. 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

    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. what about conn.authLevel? It will return 1 2 and 0? 1 is moderatorid and 2 is ownerid? Yes? No? Thx :)
     
  9. Wulf

    Wulf Community Admin

    I don't know if that is there off hand, but those are the correct auth levels.
     
  10. Yea that's right
     
  11. thx :) im trying to write my own plugin))
    [DOUBLEPOST=1507834990][/DOUBLEPOST]
    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