/google

/google

Postby Breakdown901 » 27 Jul 2013, 17:00

Google search something! Very easy command. Not very useful that you cant click the links in-game, but never the less, here it is!

Code: Select all
//Made by Breakdown901
using System;
namespace MCDzienny
{
   public class CmdGoogle : Command
   {
      public override string name { get { return "google"; } }
      public override string shortcut { get { return "goo"; } }
      public override string type { get { return "other"; } }
      public override bool museumUsable { get { return false; } }
      public override LevelPermission defaultRank { get { return LevelPermission.Banned; } }
      public override void Use(Player p, string message)
      {
         {
            if (message == "")
            {
                Help(p);
                return;
            }
      }
      {
         Player.GlobalMessage("Search results for " + message + " can be found at this link: https://www.google.co.uk/search?q=" + message);
      }
   }   
      public override void Help(Player p)
      {
         Player.SendMessage(p, "/google [search] - Google search something and it will give you the link!(Remember, no spaces!)");
      }
   }
}
Owner of:
Breakdown901 Lava Survival/Zombie Survival/Freebuild
Host of NeonGaming Lava Survival.
Breakdown901
 
Posts: 320
Joined: 24 May 2013, 12:54

Re: /google

Postby Breakdown901 » 27 Jul 2013, 17:03

I'm not sure how to do it, maybe some of the good coders can, make it read out the search results too!

For example: Player A uses /google google.

Search Results for Google are: Google is the most popular search engine in the world etc...

Not sure if its possible, but I dont know :)
Owner of:
Breakdown901 Lava Survival/Zombie Survival/Freebuild
Host of NeonGaming Lava Survival.
Breakdown901
 
Posts: 320
Joined: 24 May 2013, 12:54

Re: /google

Postby Leeizazombie » 28 Jul 2013, 01:57

One thing is missing in the message part, you should have it that a space is replace by a "%20" so that HTML reads it as a space.
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: /google

Postby Clowny » 28 Jul 2013, 02:21

Hmm this would be a nice to command to keep expanding on if possible :!:
Founder Of MC Classic Hosting Community http://mcclassichosting.webs.com
Founder of MC Classic Software MCReborn http://mcreborn.tk
Professional Hoster and Basic C# Coder
Image
User avatar
Clowny
 
Posts: 112
Joined: 14 Jul 2013, 03:53

Re: /google

Postby Breakdown901 » 28 Jul 2013, 10:20

I'm not sure how I'd do that Lee, but maybe something like

Code: Select all
if (message == "message ")
Player.GlobalMessage("Search results for " + message + " can be found at this link: https://www.google.co.uk/search?q=" + %20message%20);


Idk really, that was just a guess but I doubt that would work.
Owner of:
Breakdown901 Lava Survival/Zombie Survival/Freebuild
Host of NeonGaming Lava Survival.
Breakdown901
 
Posts: 320
Joined: 24 May 2013, 12:54

Re: /google

Postby joppiesaus » 28 Jul 2013, 12:18

Breakdown901 wrote:I'm not sure how I'd do that Lee, but maybe something like

Code: Select all
if (message == "message ")
Player.GlobalMessage("Search results for " + message + " can be found at this link: https://www.google.co.uk/search?q=" + %20message%20);


Idk really, that was just a guess but I doubt that would work.

This wont work correctly.
In the following code message.Replace replaces all spaces with %20.
Code: Select all
Player.GlobalMessage("Search results for " + message + " can be found at this link: https://www.google.co.uk/search?q=" + message.Replace(" ", "%20"));
joppiesaus
 
Posts: 379
Joined: 20 Aug 2012, 07:28
Location: in a obsedian house, with glass in it so i can see the lava!

Re: /google

Postby Breakdown901 » 28 Jul 2013, 18:06

Thank you joppie :) I'll update this in a sec, doubt I need to put it in Notepad++.
Owner of:
Breakdown901 Lava Survival/Zombie Survival/Freebuild
Host of NeonGaming Lava Survival.
Breakdown901
 
Posts: 320
Joined: 24 May 2013, 12:54

Re: /google

Postby Breakdown901 » 28 Jul 2013, 18:07

v2, thanks to joppiesaus :D

Code: Select all
//Made by Breakdown901
using System;
namespace MCDzienny
{
   public class CmdGoogle : Command
   {
      public override string name { get { return "google"; } }
      public override string shortcut { get { return "goo"; } }
      public override string type { get { return "other"; } }
      public override bool museumUsable { get { return false; } }
      public override LevelPermission defaultRank { get { return LevelPermission.Banned; } }
      public override void Use(Player p, string message)
      {
         {
            if (message == "")
            {
                Help(p);
                return;
            }
      }
      {
       Player.GlobalMessage("Search results for " + message + " can be found at this link: https://www.google.co.uk/search?q=" + message.Replace(" ", "%20"));
      }
   }   
      public override void Help(Player p)
      {
         Player.SendMessage(p, "/google [search] - Google search something and it will give you the link!");
      }
   }
}
Owner of:
Breakdown901 Lava Survival/Zombie Survival/Freebuild
Host of NeonGaming Lava Survival.
Breakdown901
 
Posts: 320
Joined: 24 May 2013, 12:54

Re: /google

Postby ane200055 » 30 Jul 2013, 13:31

Leeizazombie wrote:One thing is missing in the message part, you should have it that a space is replace by a "%20" so that HTML reads it as a space.

joppiesaus wrote:This wont work correctly.
In the following code message.Replace replaces all spaces with %20.

Well, I tried this with spaces without using the command and it worked fine.
Website: http://ane200055.co.vu
The Developer of The XtraIRC IRC Client: http://xtrairc.tk
C# coder.
User avatar
ane200055
 
Posts: 98
Joined: 30 Jun 2013, 09:07
Location: United Kingdom

Re: /google

Postby Ultima » 30 Jul 2013, 18:04

User avatar
Ultima
 
Posts: 953
Joined: 19 Aug 2011, 23:45


Return to Custom Commands

Who is online

Users browsing this forum: No registered users and 5 guests

cron