Page 2 of 2 FirstFirst 12
Results 16 to 30 of 30
  1. #16
    Riigged's Avatar
    Join Date
    Jan 2013
    Gender
    male
    Location
    no
    Posts
    3,846
    Reputation
    401
    Thanks
    10,254
    My Mood
    Devilish
    lol at this conversation reading it baked af

     








  2. The Following User Says Thank You to Riigged For This Useful Post:

    dotskills (02-06-2017)

  3. #17
    sgrawsreghawrhgwrhgr's Avatar
    Join Date
    Oct 2014
    Gender
    male
    Location
    UK
    Posts
    516
    Reputation
    10
    Thanks
    727
    My Mood
    Angelic
    What Flutter posted is perfect for what you want. If you want Owner to be able to use it too, add a or ||.

  4. #18
    dotskills's Avatar
    Join Date
    Dec 2014
    Gender
    male
    Location
    Mpgh
    Posts
    21
    Reputation
    10
    Thanks
    3
    lmao im so weak!

  5. #19
    Riigged's Avatar
    Join Date
    Jan 2013
    Gender
    male
    Location
    no
    Posts
    3,846
    Reputation
    401
    Thanks
    10,254
    My Mood
    Devilish
    this is what flutter meant
    Code:
    internal class SetGoldCommand : Command
        {
            public SetGoldCommand() : base("setgold", 5) { }
            protected override bool Process(Player player, RealmTime time, string[] args)
            {
                if (string.IsNullOrEmpty(args[0]))
                {
                    player.SendHelp("Usage: /setgold <gold>");
                    return false;
                }
                if (player.Client.Account.Rank != 5) || (player.Client.Account.Rank != 9)
                {
                    player.SendError("This command is restricted to God rank only.");
                    return false;
                }
                player.Manager.Database.DoActionAsync(db =>
                {
                    var cmd = db.CreateQuery();
                    cmd.CommandText = "UPDATE `stats` SET `credits`=@cre WHERE accId=@accId";
                    cmd.Parameters.AddWithValue("@cre", args[0]);
                    cmd.Parameters.AddWithValue("@accId", player.AccountId);
                    if (cmd.ExecuteNonQuery() == 0)
                    {
                        player.SendError("Error setting gold!");
                    }
                    else
                    {
                        player.SendInfo("Success!");
                    }
                });
                return true;
            }
        }

     








  6. #20
    Jackaiken32's Avatar
    Join Date
    Jan 2017
    Gender
    male
    Posts
    65
    Reputation
    10
    Thanks
    0
    Problem still isnt fixed -_- I need rank 5 and rank 9 to be able to use it, no one else!

  7. #21
    Zolmex's Avatar
    Join Date
    Apr 2016
    Gender
    male
    Location
    on my chair
    Posts
    356
    Reputation
    94
    Thanks
    209
    Quote Originally Posted by Jackaiken32 View Post
    Problem still isnt fixed -_- I need rank 5 and rank 9 to be able to use it, no one else!
     
    Code:
    internal class SetGoldCommand : Command    {
            public SetGoldCommand() : base("setgold", 5) { }
            protected override bool Process(Player player, RealmTime time, string[] args)
            {
                if (string.IsNullOrEmpty(args[0]))
                {
                    player.SendHelp("Usage: /setgold <gold>");
                    return false;
                }
                if (player.Client.Account.Rank != 5) || (player.Client.Account.Rank != 9)
                {
                    player.SendError("This command is restricted to God rank only.");
                    return false;
                }
                else
                {
                 player.Manager.Database.DoActionAsync(db =>
                 {
                     var cmd = db.CreateQuery();
                     cmd.CommandText = "UPDATE `stats` SET `credits`=@cre WHERE accId=@accId";
                     cmd.Parameters.AddWithValue("@cre", args[0]);
                     cmd.Parameters.AddWithValue("@accId", player.AccountId);
                     if (cmd.ExecuteNonQuery() == 0)
                     {
                         player.SendError("Error setting gold!");
                     }
                     else
                     {
                         player.SendInfo("Success!");
                     }
                 });
                 return true;
                }
            }
        }
    Last edited by Zolmex; 02-06-2017 at 02:09 PM.
    hi

  8. #22
    Jackaiken32's Avatar
    Join Date
    Jan 2017
    Gender
    male
    Posts
    65
    Reputation
    10
    Thanks
    0
    I get an error at the II thing and the } else {

  9. #23
    FlutterM4rk's Avatar
    Join Date
    Aug 2012
    Gender
    male
    Posts
    365
    Reputation
    16
    Thanks
    228
    My Mood
    Sleepy
    if(x) || (y) doesn't work, if((x) || (y)) works, (autistic syntax, maybe some clarity i guess)
    if(x || y) works.
    please stop pasting the same solution (without clarifying it any further) if he said it didn't work.
    fixed code, for the final time:
    Code:
        internal class SetGoldCommand : Command
        {
            public SetGoldCommand() : base("setgold", 5) { }
            protected override bool Process(Player player, RealmTime time, string[] args)
            {
                if (string.IsNullOrEmpty(args[0]))
                {
                    player.SendHelp("Usage: /setgold <gold>");
                    return false;
                }
                if (player.Client.Account.Rank != 5 || player.Client.Account.Rank != 9)
                {
                    player.SendError("This command is restricted to God rank only.");
                    return false;
                }
                else
                {
                    player.Manager.Database.DoActionAsync(db =>
                    {
                        var cmd = db.CreateQuery();
                        cmd.CommandText = "UPDATE `stats` SET `credits`=@cre WHERE accId=@accId";
                        cmd.Parameters.AddWithValue("@cre", args[0]);
                        cmd.Parameters.AddWithValue("@accId", player.AccountId);
                        if (cmd.ExecuteNonQuery() == 0)
                        {
                            player.SendError("Error setting gold!");
                        }
                        else
                        {
                            player.SendInfo("Success!");
                        }
                    });
                    return true;
                }
            }
        }

  10. The Following User Says Thank You to FlutterM4rk For This Useful Post:

    Jackaiken32 (02-06-2017)

  11. #24
    Jackaiken32's Avatar
    Join Date
    Jan 2017
    Gender
    male
    Posts
    65
    Reputation
    10
    Thanks
    0
    Solved but can you do the same thing with a setFame command please

    - - - Updated - - -

    Solved but can you do the same thing with a setFame command please
    Code:
        internal class SetFameCommand : Command
        {
            public SetFameCommand() : base("fame", Ranks.Owner) { }
            protected override bool Process(Player player, RealmTime time, string[] args)
            {
                if (string.IsNullOrEmpty(args[0]))
                {
                    player.SendHelp("Usage: /fame <fame ammount>");
                    return false;
                }
                player.Manager.Database.DoActionAsync(db =>
                {
                    var cmd = db.CreateQuery();
                    cmd.CommandText = "UPDATE `stats` SET `fame`=@cre WHERE accId=@accId";
                    cmd.Parameters.AddWithValue("@cre", args[0]);
                    cmd.Parameters.AddWithValue("@accId", player.AccountId);
                    if (cmd.ExecuteNonQuery() == 0)
                    {
                        player.SendError("Error setting fame!");
                    }
                    else
                    {
                        player.SendInfo("Success!");
                    }
                });
                return true;
            }
        }

  12. #25
    FlutterM4rk's Avatar
    Join Date
    Aug 2012
    Gender
    male
    Posts
    365
    Reputation
    16
    Thanks
    228
    My Mood
    Sleepy
    Quote Originally Posted by Jackaiken32 View Post
    Solved but can you do the same thing with a setFame command please
    Code:
    internal class SetFameCommand : Command
        {
            public SetFameCommand() : base("setfame", 5) { }
            protected override bool Process(Player player, RealmTime time, string[] args)
            {
                if (string.IsNullOrEmpty(args[0]))
                {
                    player.SendHelp("Usage: /setfame <fame>");
                    return false;
                }
                if (player.Client.Account.Rank != 5 || player.Client.Account.Rank != 9)
                {
                    player.SendError("This command is restricted to God rank only.");
                    return false;
                }
                else
                {
                    player.Manager.Database.DoActionAsync(db =>
                    {
                        var cmd = db.CreateQuery();
                        cmd.CommandText = "UPDATE `stats` SET `fame`=@fame WHERE accId=@accId";
                        cmd.Parameters.AddWithValue("@fame", args[0]);
                        cmd.Parameters.AddWithValue("@accId", player.AccountId);
                        if (cmd.ExecuteNonQuery() == 0)
                        {
                            player.SendError("Error setting fame!");
                        }
                        else
                        {
                            player.SendInfo("Success!");
                        }
                    });
                    return true;
                }
            }
        }

  13. The Following User Says Thank You to FlutterM4rk For This Useful Post:

    Jackaiken32 (02-06-2017)

  14. #26
    Jackaiken32's Avatar
    Join Date
    Jan 2017
    Gender
    male
    Posts
    65
    Reputation
    10
    Thanks
    0
    Thanks, how did you learn to do all of this. Im new to the coding on rotmg but i absolutly LOVE coding.

  15. #27
    FlutterM4rk's Avatar
    Join Date
    Aug 2012
    Gender
    male
    Posts
    365
    Reputation
    16
    Thanks
    228
    My Mood
    Sleepy
    Quote Originally Posted by Jackaiken32 View Post
    Thanks, how did you learn to do all of this. Im new to the coding on rotmg but i absolutly LOVE coding.
    this is just knowing what an if statement does and an or operator does, and knowing how to call the player's rank. however nilly elaborated on it quite well in a previous post, you either learn things as you move along (essentially wanting to code something, then google) or you just go down the route where you just flat out buy a book and learn it the normal way.

  16. #28
    Jackaiken32's Avatar
    Join Date
    Jan 2017
    Gender
    male
    Posts
    65
    Reputation
    10
    Thanks
    0
    Quote Originally Posted by FlutterM4rk View Post
    this is just knowing what an if statement does and an or operator does, and knowing how to call the player's rank. however nilly elaborated on it quite well in a previous post, you either learn things as you move along (essentially wanting to code something, then google) or you just go down the route where you just flat out buy a book and learn it the normal way.
    Can you get me a link to nillys post please

  17. #29
    FlutterM4rk's Avatar
    Join Date
    Aug 2012
    Gender
    male
    Posts
    365
    Reputation
    16
    Thanks
    228
    My Mood
    Sleepy
    Quote Originally Posted by Jackaiken32 View Post
    Can you get me a link to nillys post please
    https://www.mpgh.net/forum/showthread...6#post11866646

  18. #30
    Jackaiken32's Avatar
    Join Date
    Jan 2017
    Gender
    male
    Posts
    65
    Reputation
    10
    Thanks
    0
    Quote Originally Posted by FlutterM4rk View Post
    this is just knowing what an if statement does and an or operator does, and knowing how to call the player's rank. however nilly elaborated on it quite well in a previous post, you either learn things as you move along (essentially wanting to code something, then google) or you just go down the route where you just flat out buy a book and learn it the normal way.
    Can you get me a link to nillys post please

Page 2 of 2 FirstFirst 12

Similar Threads

  1. [Solved] [Realms Resolution] How to disable trade?
    By Jackaiken32 in forum Realm of the Mad God Private Servers Help
    Replies: 10
    Last Post: 02-09-2017, 05:04 PM
  2. [Solved] [Realms Resolution] How to disable drop and trade
    By Jackaiken32 in forum Realm of the Mad God Private Servers Help
    Replies: 8
    Last Post: 02-06-2017, 02:21 PM
  3. How to fix Rogues cloak not working on Realms Resolution
    By Princeabubo1336 in forum Realm of the Mad God Private Servers Help
    Replies: 1
    Last Post: 09-29-2016, 01:56 AM
  4. [Solved] How to edit .ff files of Advanced Warfare folder?
    By g0die in forum Call of Duty Advanced Warfare Help
    Replies: 1
    Last Post: 07-15-2015, 01:15 PM
  5. How to edit .swf Files Advanced Style
    By Skullmaker90 in forum League of Legends Guides
    Replies: 5
    Last Post: 10-05-2012, 06:50 AM