Jump to content
  • Sign Up

Leaderboard


Popular Content

Showing content with the highest reputation on 05/03/2024 in all areas

  1. 1 point
    Yes. Using the server property "agree-to-rules-on-entry = true", you can prevent players from building or using commands before they agree to the rules. Then you can use a plugin to override the normal /rules agree behavior to require a password based on your specifications. Here is an example plugin. You would place this inside a file called forumpass.cs in your plugins folder, then use /pcompile forumpass , /pload forumpass using System; using MCGalaxy; using MCGalaxy.Events.PlayerEvents; using MCGalaxy.Commands; namespace Lol { public sealed class ForumPass : Plugin { public override string creator { get { return "Goodly"; } } public override string name { get { return "forumpass"; } } public override string MCGalaxy_Version { get { return "1.9.3.6"; } } public override void Load(bool startup) { OnPlayerCommandEvent.Register(OnPlayerCommand, Priority.Low); OnPlayerChatEvent.Register(OnPlayerChat, Priority.High); } public override void Unload(bool shutdown) { OnPlayerCommandEvent.Unregister(OnPlayerCommand); OnPlayerChatEvent.Unregister(OnPlayerChat); } static void OnPlayerCommand(Player p, string cmd, string args, CommandData data) { if (cmd.CaselessEq("rules")) { p.cancelcommand = true; if (args.CaselessEq("agree")) { if (!p.hasreadrules) { p.Message("You must read the rules before agreeing to them. Dimb ass."); return; } if (p.agreed) { p.Message("You already agreed to the rules."); return; } p.Message("To agree to the rules, you must enter /pass [pass] from your forum account."); return; } p.hasreadrules = true; //Since we are overriding the normal rules command, you must display the rules here via p.Message p.Message("Rules:"); p.Message("0. Make a forum account to play here."); p.Message("1. Don't make your level too difficult to join"); p.Message("2. TODO"); return; } if (cmd.CaselessEq("pass")) { p.cancelcommand = true; //the command /pass actually exists and does something else but we're going to hijack it because it is //one of the few commands that actually invokes OnPlayerCommand before the user has agreed to the rules if (p.agreed) { p.Message("You already correctly entered the password."); return; } if (!p.hasreadrules) { p.Message("&9You must read &T/Rules &9before entering the password."); return; } if (args.Length == 0) { p.Message("Please enter a password."); return; } if (args != GetPassword(p)) { p.Message("Incorrect password."); return; } p.Message("&6You've succesfully entered the password. Welcome!"); Command.Find("rules").Use(p, "agree"); return; //this return is only here in case you add other command cases below this if statement } } static string GetPassword(Player p) { //Modify this method for your requirements return p.name + "waow"; } static void OnPlayerChat(Player p, string message) { // Optionally mute players who haven't entered pass yet //if (!p.agreed) { p.Message("&cBefore speaking, you must read /rules then agree to them with /agree."); p.cancelchat = true; } } } } If you modify the file and want to reload the plugin, use /punload forumpass , then /pcompile forumpass, then /pload forumpass
  2. -1 points
    I stumbled upon this thread and couldn't resist chiming in! As a fellow gamer, I've always been intrigued by the allure of shooter games. They're like a rollercoaster ride of adrenaline and strategy, keeping you on the edge of your seat with every twist and turn.
×
×
  • Create New...