Bit of an unexpected problem.

Bit of an unexpected problem.

Postby Leeizazombie » 01 Dec 2013, 18:32

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?
Owner of:
LeeIzaZombie Freebuild and Lava Survival V2 (Shut Down and updated)
LeeIzaZombie Survival (Comming back soon)

Contact:
Skype: leeizazombie
IRC: irc.geekshed.net, #leeizazombie, #mcclassichosting
User avatar
Leeizazombie
 
Posts: 536
Joined: 10 Jun 2013, 17:45
Location: Ireland.

Re: Bit of an unexpected problem.

Postby Leeizazombie » 01 Dec 2013, 18:35

Aslo when it announces player@email.com when using GlobalMessage(p.name); How can I remove or replace the email part?
Owner of:
LeeIzaZombie Freebuild and Lava Survival V2 (Shut Down and updated)
LeeIzaZombie Survival (Comming back soon)

Contact:
Skype: leeizazombie
IRC: irc.geekshed.net, #leeizazombie, #mcclassichosting
User avatar
Leeizazombie
 
Posts: 536
Joined: 10 Jun 2013, 17:45
Location: Ireland.

Re: Bit of an unexpected problem.

Postby ismellike » 02 Dec 2013, 04:29

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
What a beast...
User avatar
ismellike
Coder
 
Posts: 731
Joined: 31 Oct 2012, 04:04
Location: Kansas

Re: Bit of an unexpected problem.

Postby Leeizazombie » 02 Dec 2013, 15:36

Okay I'll try that out later, thanks!
Owner of:
LeeIzaZombie Freebuild and Lava Survival V2 (Shut Down and updated)
LeeIzaZombie Survival (Comming back soon)

Contact:
Skype: leeizazombie
IRC: irc.geekshed.net, #leeizazombie, #mcclassichosting
User avatar
Leeizazombie
 
Posts: 536
Joined: 10 Jun 2013, 17:45
Location: Ireland.

Re: Bit of an unexpected problem.

Postby Leeizazombie » 02 Dec 2013, 17:54

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.
Owner of:
LeeIzaZombie Freebuild and Lava Survival V2 (Shut Down and updated)
LeeIzaZombie Survival (Comming back soon)

Contact:
Skype: leeizazombie
IRC: irc.geekshed.net, #leeizazombie, #mcclassichosting
User avatar
Leeizazombie
 
Posts: 536
Joined: 10 Jun 2013, 17:45
Location: Ireland.

Re: Bit of an unexpected problem.

Postby ismellike » 02 Dec 2013, 22:32

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")
What a beast...
User avatar
ismellike
Coder
 
Posts: 731
Joined: 31 Oct 2012, 04:04
Location: Kansas

Re: Bit of an unexpected problem.

Postby Leeizazombie » 03 Dec 2013, 00:29

Oh I see! Thanks again!
Owner of:
LeeIzaZombie Freebuild and Lava Survival V2 (Shut Down and updated)
LeeIzaZombie Survival (Comming back soon)

Contact:
Skype: leeizazombie
IRC: irc.geekshed.net, #leeizazombie, #mcclassichosting
User avatar
Leeizazombie
 
Posts: 536
Joined: 10 Jun 2013, 17:45
Location: Ireland.


Return to Help in Coding

Who is online

Users browsing this forum: No registered users and 1 guest

cron