Page 1 of 1

Bit of an unexpected problem.

PostPosted: 01 Dec 2013, 18:32
by Leeizazombie
I tried using:
Code: Select all
public override void Init()
        {
           
            Player.Joined += (object sender, PlayerEventArgs e) =>
            {
                if (e.Player.name = "leebyrne115@gmail.com")
                       Player.GlobalMessage("%f[%bLeeBot%f]: Haii Owner!");
                  else
                 {
                   Player.GlobalMessage("%f[%bLeeBot%f]: Hey %ap.name! %fWelcome to $server.:D");
                  }


            };


But it doesn't allow the .name part to be used, is there anyway I can add it in?

Re: Bit of an unexpected problem.

PostPosted: 01 Dec 2013, 18:35
by Leeizazombie
Aslo when it announces player@email.com when using GlobalMessage(p.name); How can I remove or replace the email part?

Re: Bit of an unexpected problem.

PostPosted: 02 Dec 2013, 04:29
by ismellike
In your if statement, you are missing an = sign; right now this is what it is "if(true){ e.Player.name = "string"; }, but .name cannot be set.

To answer your second question, use .PublicName or the following code:

Code: Select all

string name = e.Player.name.Substring(0,e.Player.name.IndexOf("@"));



on phone so it might have an error

Re: Bit of an unexpected problem.

PostPosted: 02 Dec 2013, 15:36
by Leeizazombie
Okay I'll try that out later, thanks!

Re: Bit of an unexpected problem.

PostPosted: 02 Dec 2013, 17:54
by Leeizazombie
So this works perfectly:
Code: Select all
if(true) { e.Player.name = "leebyrne115@gmail.com"; }


But I don't know how to add "else if", or just an "else" statement after if, I've tried different ways but it keeps showing errors.

Re: Bit of an unexpected problem.

PostPosted: 02 Dec 2013, 22:32
by ismellike
Oh, that's not actually what you were supposed to do.
That was just to show you what you were doing.

you need to change it to if(e.Player.name == "string")

Re: Bit of an unexpected problem.

PostPosted: 03 Dec 2013, 00:29
by Leeizazombie
Oh I see! Thanks again!