Jump to content
  • Sign Up

Archived

This topic is now archived and is closed to further replies.

  • 0
PoldiB

I'm having trouble with a Plugin

Question

I need help i'm tryning to learn MCGalaxy and tried and make a simple dice roll plugin.However when i try and load it it says line 39 and 40 i should use p.Message instead of Player.Message and I do that but then it says "Static Member "MCGalaxy.Player.Message(MCGalaxy.Player, string)" cannot be accessed with an instant reference, qualify it with a name type instead" i'm stuck.

Share this post


Link to post

4 answers to this question

Recommended Posts

You should post the source code when asking for help. Make sure when you change Player.Message to p.Message that you remove “p, “ from the first argument 

Share this post


Link to post

Here's the source code:

 

using System;
using MCGalaxy;
using MCGalaxy.Commands;
 
namespace Server {
public sealed class DiceGame : Plugin {
public override string name { get { return "The Dice Game"; } }
public override string creator { get { return "PoldiB"; } }
public override string MCGalaxy_Version { get { return "1.9.3.8"; } }
 
public override void Load(bool startup) {
Command.Register(new CmdDice());
Chat.MessageGlobal("&aDice plugin succesfully loaded!");
}
 
public override void Unload(bool shutdown){
Command.Unregister(Command.Find("dice"));
Chat.MessageGlobal("&cDice plugin succesfully unloaded");
}
 
public class CmdDice : Command {
public override string name { get { return "Dice"; } }
public override string shortcut { get { return "roll"; } }
public override string type { get { return "fun"; } }
 
public override LevelPermission defaultRank { get { return LevelPermission.Guest; } }
 
public override void Use(Player commandUser, string args) {
Random rnd = new Random();
int dice1 = rnd.Next(1, 6);
int dice2 = rnd.Next(1, 6);
int score = dice1 + dice2;
 
Chat.MessageGlobal(commandUser.name + "&fhas rolled &a" + dice1 + "&f and &a" + dice2 + "&f in Dice!");
Chat.MessageGlobal("&fThat's &a" + score + "&f points!");
}
 
public override void Help(Player p){
p.Message(player, "%T/dice");
p.Message(Player, "%HRoll dice.");
}
}
}
}

Share this post


Link to post

×
×
  • Create New...