/ZombieNuke

/ZombieNuke

Postby Apocalypse_Demon » 16 Jul 2012, 00:24

using System;
using System.IO;
namespace MCDzienny
{
public class CmdZombieNuke : Command
{
public override string name { get { return "nuke"; } }
public override string shortcut { get { return "zn"; } }
public override string type { get { return "mod"; } }
public override bool museumUsable { get { return false; } }
public override LevelPermission defaultRank { get { return LevelPermission.Admin; } }
public override void Use(Player p, string message)
{
Player.GlobalMessage("%AA ZOMBIE NUKE HAS BEEN CALLED IN, ALL WILL DIE");
Player.GlobalMessage("%ANUKE WILL BE DROPPED IN 10 SECONDS!");
Player.GlobalMessage("%410");
Thread.Sleep(1000);
Player.GlobalMessage("%49");
Thread.Sleep(1000);
Player.GlobalMessage("%48");
Thread.Sleep(1000);
Player.GlobalMessage("%47");
Thread.Sleep(1000);
Player.GlobalMessage("%46");
Thread.Sleep(1000);
Player.GlobalMessage("%45");
Thread.Sleep(1000);
Player.GlobalMessage("%44");
Thread.Sleep(1000);
Player.GlobalMessage("%43");
Thread.Sleep(1000);
Player.GlobalMessage("%42");
Thread.Sleep(1000);
Player.GlobalMessage("%41");
Command.all.Find("kill").Use(p, who.name);
Player.GlobalMessage("%AThe Zombie Apocalypse is now over, Wolrd is destroyed, No human life forms left.");
}

public override void Help(Player p)
{
Player.SendMessage(p, "/nuke: A bomb that kills everyone, This command should only be used by admins.");
Player.SendMessage(p, "Created by Apocalypse_Demon.");
}
}
}
What is wrong with this command?
Custom Command Maker
Apocalypse_Demon
 
Posts: 65
Joined: 22 Jun 2012, 18:29

Re: /ZombieNuke

Postby Apocalypse_Demon » 16 Jul 2012, 01:40

ok here is the updated one using System;
//Dont forget System.Threading!
using System.Threading;
using System.IO;
namespace MCDzienny
{
public class CmdZombieNuke : Command
{
public override string name { get { return "zombienuke"; } }
public override string shortcut { get { return "zn"; } }
public override string type { get { return "other"; } }
public override bool museumUsable { get { return false; } }
public override LevelPermission defaultRank { get { return LevelPermission.Admin; } }
public override void Use(Player p, string message)
{
//Always need this when using string: "who"
//"Thread.Sleep(1000);" not "using System.Threading(1000);"
Player who = Player.Find(message);
Player.GlobalMessage("%AA ZOMBIE NUKE HAS BEEN CALLED IN, ALL WILL DIE");
Player.GlobalMessage("%AZOMBIE NUKE WILL BE DROPPED IN 10 SECONDS!");
Player.GlobalMessage("%410");
Thread.Sleep(1000);
Player.GlobalMessage("%49");
Thread.Sleep(1000);
Player.GlobalMessage("%48");
Thread.Sleep(1000);
Player.GlobalMessage("%47");
Thread.Sleep(1000);
Player.GlobalMessage("%46");
Thread.Sleep(1000);
Player.GlobalMessage("%45");
Thread.Sleep(1000);
Player.GlobalMessage("%44");
Thread.Sleep(1000);
Player.GlobalMessage("%43");
Thread.Sleep(1000);
Player.GlobalMessage("%42");
Thread.Sleep(1000);
Player.GlobalMessage("%41");
{

foreach (Player pl in Player.players)
{
pl.HandleDeath(Block.rock, " has died because of nuclear weapon. ");

}
}
}

public override void Help(Player p)
{
Player.SendMessage(p, "/ZombieNuke: A bomb that kills everyone, This command should only be used by admins.");
Player.SendMessage(p, "SHORTCUT: /zn");
Player.SendMessage(p, "Created by Apocalypse_Demon. (Edited by rockminer100).");
}
}
}
i only get one error when i compile it, i don't know whats wrong with it. here is the error. How do i fix this error?

-------------------------

Error CS1501
Message: No overload for method 'HandleDeath' takes '2' arguments
Line: 44
Custom Command Maker
Apocalypse_Demon
 
Posts: 65
Joined: 22 Jun 2012, 18:29

Re: /ZombieNuke

Postby Conor » 12 Jan 2013, 02:24

Hey :)

You are using the 'HandleDeath' method incorrectly. MCLawl/MCForge follow these arguments:

Code: Select all
public void HandleDeath(byte b, string customMessage = "", bool explode = false)


In which case, your line of code should work.

This leaves one conclusion, Dzienny has modified his HandleDeath method slightly, to have a different number of arguments.

You can guess some alternatives... e.g.

p.HandleDeath(Block.rock, "something", false); // In case he made 'explode' an argument that must be defined.
p.HandleDeath("something"); // In case he got rid of the byte for the block related to the death.
p.HandleDeath("something", false); // In case he only included these two arguments.

But, the best way to solve your problem, is to have Dzienny explain what the method truly looks like and what arguments you need to use. I'm sure he will have a good explanation soon about the method arguments :)
Conor (Conanza121)
User avatar
Conor
Coder
 
Posts: 390
Joined: 10 Oct 2012, 21:36
Location: @21Conor

Re: /ZombieNuke

Postby Conor » 12 Jan 2013, 02:28

Wow.. just realised how old your post was. I replied as there were no replies to the original problem, so I thought it was recent.

Well.. maybe this can still help Demon xD

Apologies for bumping the thread anyway .-.
Conor (Conanza121)
User avatar
Conor
Coder
 
Posts: 390
Joined: 10 Oct 2012, 21:36
Location: @21Conor


Return to Help in Coding

Who is online

Users browsing this forum: No registered users and 5 guests

cron