当前位置: 首页>>代码示例>>C#>>正文


C# IRocketPlayer.HasPermission方法代码示例

本文整理汇总了C#中IRocketPlayer.HasPermission方法的典型用法代码示例。如果您正苦于以下问题:C# IRocketPlayer.HasPermission方法的具体用法?C# IRocketPlayer.HasPermission怎么用?C# IRocketPlayer.HasPermission使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在IRocketPlayer的用法示例。


在下文中一共展示了IRocketPlayer.HasPermission方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: Execute

 public void Execute(IRocketPlayer caller, string[] command)
 {
     // Get playername, if one was set in the command. Don't allow the command to be ran on self from the console.
     UnturnedPlayer target = command.GetUnturnedPlayerParameter(0);
     UnturnedPlayer untrunedCaller = null;
     if (!(caller is ConsolePlayer))
     {
         untrunedCaller = (UnturnedPlayer)caller;
     }
     if ((caller is ConsolePlayer && command.Length < 1) || command.Length > 1 || (target == null && command.Length == 1 && (caller.HasPermission("locate.other") || untrunedCaller.IsAdmin || caller is ConsolePlayer)))
     {
         UnturnedChat.Say(caller, TeleportUtil.Instance.Translate("can't_locate_player"));
         return;
     }
     if (command.Length == 1)
     {
         // Only allow the player to locate another player if they have the right permission.
         if (caller.HasPermission("locate.other") || untrunedCaller.IsAdmin || caller is ConsolePlayer)
         {
             UnturnedChat.Say(caller, TeleportUtil.Instance.Translate("location_on_map_other", target.CharacterName.Truncate(14), target.Position.xyz_Location()));
         }
         else
         {
             UnturnedChat.Say(caller, TeleportUtil.Instance.Translate("locate_other_not_allowed"));
             return;
         }
     }
     else
     {
         UnturnedPlayer unturnedCaller = (UnturnedPlayer)caller;
         UnturnedChat.Say(caller, TeleportUtil.Instance.Translate("location_on_map", unturnedCaller.Position.xyz_Location()));
     }
 }
开发者ID:cartman-2000,项目名称:TeleportUtil,代码行数:33,代码来源:CommandLocate.cs

示例2: DropMagsWithLimit

        public void DropMagsWithLimit(ushort ammoAmountToSpawn, IRocketPlayer caller, SDG.Unturned.ItemGunAsset currentWeapon, UnturnedPlayer Uplayer, string[] command)
        {
            if (ammoAmountToSpawn <= (ushort)EasyAmmo.Instance.Configuration.Instance.ClipLimit || caller.HasPermission("easyammo.bypasslimit"))
            {
                UnturnedChat.Say(caller, EasyAmmo.Instance.Translate("dropping_mags", ammoAmountToSpawn.ToString(), UnturnedItems.GetItemAssetById(GetMagId(Uplayer, currentWeapon, command)).Name, GetMagId(Uplayer, currentWeapon, command).ToString()));

                for (int ii = 0; ii < (int)ammoAmountToSpawn; ii++)
                {
                    ItemManager.dropItem(new Item(GetMagId(Uplayer, currentWeapon, command), true), Uplayer.Position, true, true, true);
                }
            }
            else
            {
                UnturnedItems.GetItemAssetById(1);
                ushort amountoverlimit = ammoAmountToSpawn;
                ammoAmountToSpawn = (ushort)EasyAmmo.Instance.Configuration.Instance.ClipLimit;

                UnturnedChat.Say(caller, EasyAmmo.Instance.Translate("over_clip_spawn_limit_dropping", amountoverlimit.ToString(), EasyAmmo.Instance.Configuration.Instance.ClipLimit, UnturnedItems.GetItemAssetById(GetMagId(Uplayer, currentWeapon, command)).Name, GetMagId(Uplayer, currentWeapon, command).ToString()));

                for (int ii = 0; ii < (int)ammoAmountToSpawn; ii++)
                {
                    ItemManager.dropItem(new Item(GetMagId(Uplayer, currentWeapon, command), true), Uplayer.Position, true, true, true);
                }

            }
        }
开发者ID:RocketModPlugins,项目名称:EasyAmmo,代码行数:26,代码来源:CommandDropAmmo.cs

示例3: Execute

        public void Execute(IRocketPlayer caller, string[] command)
        {
            IRocketPlayer player = command.GetUnturnedPlayerParameter(0);
            if (player == null) player = command.GetRocketPlayerParameter(0);
            string groupName = command.GetStringParameter(1);

            if (command.Length == 0 && !(caller is ConsolePlayer))
            {
                UnturnedChat.Say(caller, U.Translate("command_p_groups_private", "Your", string.Join(", ", R.Permissions.GetGroups(caller, true).Select(g => g.DisplayName).ToArray())));
                UnturnedChat.Say(caller, U.Translate("command_p_permissions_private", "Your", string.Join(", ", Core.R.Permissions.GetPermissions(caller).ToArray())));
            }
            else if(command.Length == 1 && player != null) {
                UnturnedChat.Say(caller, U.Translate("command_p_groups_private", player.DisplayName+"s", string.Join(", ", R.Permissions.GetGroups(caller, true).Select(g => g.DisplayName).ToArray())));
                UnturnedChat.Say(caller, U.Translate("command_p_permissions_private", player.DisplayName + "s", string.Join(", ", Core.R.Permissions.GetPermissions(player).ToArray())));
            }
            else if (command.Length == 2 && player != null && !String.IsNullOrEmpty(groupName) && caller.HasPermission("p.set"))
            {
                if (Core.R.Permissions.SetGroup(player, groupName))
                {
                    UnturnedChat.Say(caller, U.Translate("command_p_group_assigned", player.DisplayName, groupName));
                }
                else {
                    UnturnedChat.Say(caller, U.Translate("command_p_group_not_found"));
                }
            }
            else
            {
                UnturnedChat.Say(caller, U.Translate("command_generic_invalid_parameter"));
                return;
            }

            
         }
开发者ID:KhrumoX,项目名称:Rocket.Unturned,代码行数:33,代码来源:CommandP.cs

示例4: Execute

        public void Execute(IRocketPlayer playerid, string[] msg)
        {
            if (playerid == null) return;
            if (msg.Length > 1)
            {
                UnturnedChat.Say(playerid, Zaup_Warning.Instance.Translate("warnings_command_usage", new object[] { }));
                return;
            }

            UnturnedPlayer caller = UnturnedPlayer.FromName(playerid.ToString());

            if (msg.Length == 0)
            {
                byte currentlevel = Zaup_Warning.Instance.Database.GetWarnings(caller.CSteamID);
                UnturnedChat.Say(playerid, Zaup_Warning.Instance.Translate("warnings_current_level", new object[] { currentlevel }));
                return;
            }
            if (!playerid.HasPermission("warnings.others"))
            {
                UnturnedChat.Say(playerid, Zaup_Warning.Instance.Translate("warnings_no_permission_others", new object[] { }));
                return;
            }
            UnturnedPlayer warnee = UnturnedPlayer.FromName(msg[0]);
            if (warnee == null)
            {
                UnturnedChat.Say(playerid, Zaup_Warning.Instance.Translate("invalid_name_provided", new object[] { }));
                return;
            }
            byte currentlevel1 = Zaup_Warning.Instance.Database.GetWarnings(warnee.CSteamID);
            UnturnedChat.Say(playerid, Zaup_Warning.Instance.Translate("warnings_current_level_others", new object[] { warnee.CharacterName, currentlevel1 }));
            return;
        }
开发者ID:ClassyDestroyer,项目名称:Zaup_Warning,代码行数:32,代码来源:CommandWarnings.cs

示例5: HasPermission

 public static bool HasPermission(IRocketPlayer player, string permission)
 {
     var unturnedPlayer = player as UnturnedPlayer;
     if (unturnedPlayer != null && unturnedPlayer.IsAdmin)
     {
         return true;
     }
     return player.HasPermission("regions." + permission);
 }
开发者ID:Trojaner25,项目名称:Rocket-Regions,代码行数:9,代码来源:PermissionUtil.cs

示例6: Execute

        public void Execute(IRocketPlayer caller, string[] command)
        {
            UnturnedPlayer player = (UnturnedPlayer)caller;

            List<string> availableKits = new List<string>();

            foreach(Kit kit in Kits.Instance.Configuration.Instance.Kits)
            {
                if(caller.HasPermission("kit." + kit.Name.ToLower()))
                {
                    availableKits.Add(kit.Name);
                }
            }

            UnturnedChat.Say(caller, Kits.Instance.Translations.Instance.Translate("command_kits", String.Join(", ",availableKits.ToArray())));
        }
开发者ID:Nicoalas,项目名称:Kits,代码行数:16,代码来源:CommandKits.cs

示例7: Execute

        public void Execute(IRocketPlayer caller, string[] command)
        {
            if (command.Length == 0)
            {
                UnturnedChat.Say(caller, "Rocket v" + Assembly.GetExecutingAssembly().GetName().Version + " for Unturned v" + Provider.APP_VERSION);
                UnturnedChat.Say(caller, "https://rocketmod.net - 2017");
                return;
            }

            if (command.Length == 1)
            {
                switch (command[0].ToLower()) {
                    case "plugins":
                        if (caller != null && !caller.HasPermission("rocket.plugins")) return;
                        List<IRocketPlugin> plugins = R.Plugins.GetPlugins();
                        UnturnedChat.Say(caller, U.Translate("command_rocket_plugins_loaded", String.Join(", ", plugins.Where(p => p.State == PluginState.Loaded).Select(p => p.GetType().Assembly.GetName().Name).ToArray())));
                        UnturnedChat.Say(caller, U.Translate("command_rocket_plugins_unloaded", String.Join(", ", plugins.Where(p => p.State == PluginState.Unloaded).Select(p => p.GetType().Assembly.GetName().Name).ToArray())));
                        UnturnedChat.Say(caller, U.Translate("command_rocket_plugins_failure", String.Join(", ", plugins.Where(p => p.State == PluginState.Failure).Select(p => p.GetType().Assembly.GetName().Name).ToArray())));
                        UnturnedChat.Say(caller, U.Translate("command_rocket_plugins_cancelled", String.Join(", ", plugins.Where(p => p.State == PluginState.Cancelled).Select(p => p.GetType().Assembly.GetName().Name).ToArray())));
                        break;
                    case "reload":
                        if (caller!=null && !caller.HasPermission("rocket.reload")) return;
                            UnturnedChat.Say(caller, U.Translate("command_rocket_reload"));
                            R.Reload();
                        break;
                }
            }

            if (command.Length == 2)
            {
                RocketPlugin p = (RocketPlugin)R.Plugins.GetPlugins().Where(pl => pl.Name.ToLower().Contains(command[1].ToLower())).FirstOrDefault();
                if (p != null)
                {
                    switch (command[0].ToLower())
                    {
                        case "reload":
                            if (caller != null && !caller.HasPermission("rocket.reloadplugin")) return;
                            if (p.State == PluginState.Loaded)
                            {
                                UnturnedChat.Say(caller, U.Translate("command_rocket_reload_plugin", p.GetType().Assembly.GetName().Name));
                                p.ReloadPlugin();
                            }
                            else
                            {
                                UnturnedChat.Say(caller, U.Translate("command_rocket_not_loaded", p.GetType().Assembly.GetName().Name));
                            }
                            break;
                        case "unload":
                            if (caller != null && !caller.HasPermission("rocket.unloadplugin")) return;
                            if (p.State == PluginState.Loaded)
                            {
                                UnturnedChat.Say(caller, U.Translate("command_rocket_unload_plugin", p.GetType().Assembly.GetName().Name));
                                p.UnloadPlugin();
                            }
                            else
                            {
                                UnturnedChat.Say(caller, U.Translate("command_rocket_not_loaded", p.GetType().Assembly.GetName().Name));
                            }
                            break;
                        case "load":
                            if (caller != null && !caller.HasPermission("rocket.loadplugin")) return;
                            if (p.State != PluginState.Loaded)
                            {
                                UnturnedChat.Say(caller, U.Translate("command_rocket_load_plugin", p.GetType().Assembly.GetName().Name));
                                p.LoadPlugin();
                            }
                            else
                            {
                                UnturnedChat.Say(caller, U.Translate("command_rocket_already_loaded", p.GetType().Assembly.GetName().Name));
                            }
                            break;
                    }
                }
                else
                {
                    UnturnedChat.Say(caller, U.Translate("command_rocket_plugin_not_found", command[1]));
                }
            }


        }
开发者ID:RocketMod,项目名称:Rocket.Unturned,代码行数:81,代码来源:CommandRocket.cs

示例8: Execute

        public void Execute(IRocketPlayer caller, string[] command)
        {
            UnturnedPlayer player = (UnturnedPlayer)caller;
            if (command.Length != 1)
            {
                UnturnedChat.Say(caller, Kits.Instance.Translations.Instance.Translate("command_kit_invalid_parameter"));
                return;
            }

            Kit kit = Kits.Instance.Configuration.Instance.Kits.Where(k => k.Name.ToLower() == command[0].ToLower()).FirstOrDefault();
            if (kit == null)
            {
                UnturnedChat.Say(caller, Kits.Instance.Translations.Instance.Translate("command_kit_not_found"));
                return;
            }

            bool hasPermissions = caller.HasPermission("kit." + kit.Name.ToLower());

            if (!hasPermissions)
            {
                UnturnedChat.Say(caller, Kits.Instance.Translations.Instance.Translate("command_kit_no_permissions"));
                return;
            }

            KeyValuePair<string, DateTime> globalCooldown = Kits.GlobalCooldown.Where(k => k.Key == caller.ToString()).FirstOrDefault();
            if (!globalCooldown.Equals(default(KeyValuePair<string, DateTime>)))
            {
                double globalCooldownSeconds = (DateTime.Now - globalCooldown.Value).TotalSeconds;
                if (globalCooldownSeconds < Kits.Instance.Configuration.Instance.GlobalCooldown)
                {
                    UnturnedChat.Say(caller, Kits.Instance.Translations.Instance.Translate("command_kit_cooldown_command", (int)(Kits.Instance.Configuration.Instance.GlobalCooldown - globalCooldownSeconds)));
                    return;
                }
            }

            KeyValuePair<string, DateTime> individualCooldown = Kits.InvididualCooldown.Where(k => k.Key == (caller.ToString() + kit.Name)).FirstOrDefault();
            if (!individualCooldown.Equals(default(KeyValuePair<string, DateTime>)))
            {
                double individualCooldownSeconds = (DateTime.Now - individualCooldown.Value).TotalSeconds;
                if (individualCooldownSeconds < kit.Cooldown)
                {
                    UnturnedChat.Say(caller, Kits.Instance.Translations.Instance.Translate("command_kit_cooldown_kit", (int)(kit.Cooldown - individualCooldownSeconds)));
                    return;
                }
            }

            foreach (KitItem item in kit.Items)
            {

                if (!player.GiveItem(item.ItemId, item.Amount))
                {
                    Logger.Log(Kits.Instance.Translations.Instance.Translate("command_kit_failed_giving_item", player.CharacterName, item.ItemId, item.Amount));
                }
            }
            UnturnedChat.Say(caller, Kits.Instance.Translations.Instance.Translate("command_kit_success", kit.Name));

            if (Kits.GlobalCooldown.ContainsKey(caller.ToString()))
            {
                Kits.GlobalCooldown[caller.ToString()] = DateTime.Now;
            }
            else
            {
                Kits.GlobalCooldown.Add(caller.ToString(), DateTime.Now);
            }

            if (Kits.GlobalCooldown.ContainsKey(caller.ToString()))
            {
                Kits.InvididualCooldown[caller.ToString() + kit.Name] = DateTime.Now;
            }
            else
            {
                Kits.InvididualCooldown.Add(caller.ToString() + kit.Name, DateTime.Now);
            }
        }
开发者ID:Nicoalas,项目名称:Kits,代码行数:74,代码来源:CommandKit.cs

示例9: Execute

        public void Execute(IRocketPlayer caller, string[] command)
        {
            ushort AmountToSpawn = (ushort)0;
            bool EnteredAmount = false;
            SDG.Unturned.ItemAsset currentEquiped;
            UnturnedPlayer Uplayer = (UnturnedPlayer)caller;

            if (command.Length == 1)
            {
                if (ushort.TryParse(command[0], out AmountToSpawn))
                {
                    EnteredAmount = true;
                }
            }

            currentEquiped = Uplayer.Player.equipment.asset;
            if (currentEquiped == null)
            {
                UnturnedChat.Say(caller, EasyAmmo.Instance.Translate("nothing_equipped"));
                return;
            }

            if (checkIfBlacklisted(caller, currentEquiped))
            {
                UnturnedChat.Say(EasyAmmo.Instance.Translate("Clonei_item_blacklisted", currentEquiped.Name));
                return;
            }

            var state = Uplayer.Player.equipment.state;

               /* for (int count = 0; count <= state.Length - 1; count++)
            {
                Logger.Log("State " + count.ToString() + " : " + state[count].ToString());
                //state[count] = 17;
            }  */
            /*
            state[0] is a sight
            state[8] is a magazine
            state[10] is ammo count
             */

            SDG.Unturned.Item newItem = new SDG.Unturned.Item(currentEquiped.id, 100, 100, state);

            if (AmountToSpawn == 0)
            {
                AmountToSpawn = 1;
            }

            if (caller.HasPermission("clonei.amount"))
            {
                for (int ii = 0; ii < AmountToSpawn; ii++)
                {
                    Uplayer.GiveItem(newItem);
                }
            }
            else
            {
                Uplayer.GiveItem(newItem);
            }

            UnturnedChat.Say(caller, EasyAmmo.Instance.Translate("cloned_item",
               UnturnedItems.GetItemAssetById(currentEquiped.id).itemName, AmountToSpawn.ToString()));
            return;
        }
开发者ID:RocketModPlugins,项目名称:EasyAmmo,代码行数:64,代码来源:CommandCloneItem.cs

示例10: checkIfBlacklisted

 bool checkIfBlacklisted(IRocketPlayer caller, ItemAsset item)
 {
     if (caller.HasPermission("clonei.bypassblacklist")) return false;
     return EasyAmmo.Instance.Configuration.Instance.BannedIds.Contains(item.Id);
 }
开发者ID:RocketModPlugins,项目名称:EasyAmmo,代码行数:5,代码来源:CommandCloneItem.cs

示例11: Execute

        public void Execute(IRocketPlayer caller, params string[] command)
        {
            if (command.Length == 3 && command[0] == "add" && caller.HasPermission("hitman.add"))
            {
                UnturnedPlayer otherPlayer = UnturnedPlayer.FromName(command[1]);

                if (otherPlayer == null)
                {
                    if (FeexHitman.Instance.Translations.Instance.Translate("hitman_general_not_found") != "hitman_general_not_found")
                    {
                        UnturnedChat.Say(caller, FeexHitman.Instance.Translations.Instance.Translate("hitman_general_not_found"));
                    }
                    return;
                }

                if (caller.Id == otherPlayer.Id)
                {
                    if (FeexHitman.Instance.Translations.Instance.Translate("hitman_add_self") != "hitman_add_self")
                    {
                        UnturnedChat.Say(caller, FeexHitman.Instance.Translations.Instance.Translate("hitman_add_self"));
                    }
                    return;
                }

                decimal bounty = 0;
                if (!Decimal.TryParse(command[2], out bounty) || bounty <= 0)
                {
                    if (FeexHitman.Instance.Translations.Instance.Translate("hitman_add_amount") != "hitman_add_amount")
                    {
                        UnturnedChat.Say(caller, FeexHitman.Instance.Translations.Instance.Translate("hitman_add_amount"));
                    }
                    return;
                }

                decimal myBalance = Uconomy.Instance.Database.GetBalance(caller.Id);
                if ((myBalance - bounty) < 0)
                {
                    if (FeexHitman.Instance.Translations.Instance.Translate("hitman_add_balance") != "hitman_add_balance")
                    {
                        UnturnedChat.Say(caller, FeexHitman.Instance.Translations.Instance.Translate("hitman_add_balance"));
                    }
                    return;
                }

                if (bounty < FeexHitman.Instance.Configuration.Instance.MinimumBounty)
                {
                    if (FeexHitman.Instance.Translations.Instance.Translate("hitman_add_minimum") != "hitman_add_minimum")
                    {
                        UnturnedChat.Say(caller, FeexHitman.Instance.Translations.Instance.Translate("hitman_add_minimum", FeexHitman.Instance.Configuration.Instance.MinimumBounty));
                    }
                    return;
                }

                if (FeexHitman.Instance.FeexHitmanDatabase.CheckExists(otherPlayer.CSteamID))
                {
                    if (FeexHitman.Instance.Translations.Instance.Translate("hitman_general_chat_increased") != "hitman_general_chat_increased")
                    {
                        UnturnedChat.Say(FeexHitman.Instance.Translations.Instance.Translate("hitman_general_chat_increased", otherPlayer.DisplayName, bounty, Convert.ToDecimal(FeexHitman.Instance.FeexHitmanDatabase.GetBounty(otherPlayer.CSteamID)) + bounty), UnityEngine.Color.yellow);
                    }
                }
                else
                {
                    if (FeexHitman.Instance.Translations.Instance.Translate("hitman_general_chat_created") != "hitman_general_chat_created")
                    {
                        UnturnedChat.Say(FeexHitman.Instance.Translations.Instance.Translate("hitman_general_chat_created", otherPlayer.DisplayName, bounty), UnityEngine.Color.yellow);
                    }
                }

                Uconomy.Instance.Database.IncreaseBalance(caller.Id.ToString(), -bounty);
                FeexHitman.Instance.FeexHitmanDatabase.AddUpdateVictimAccount(otherPlayer.CSteamID, bounty, otherPlayer.DisplayName);
            }
            else if (command.Length == 2 && command[0] == "payout" && caller.HasPermission("hitman.payout"))
            {
                UnturnedPlayer otherPlayer = UnturnedPlayer.FromName(command[1]);

                if (otherPlayer == null)
                {
                    if (FeexHitman.Instance.Translations.Instance.Translate("hitman_general_not_found") != "hitman_general_not_found")
                    {
                        UnturnedChat.Say(caller, FeexHitman.Instance.Translations.Instance.Translate("hitman_general_not_found"));
                    }
                    return;
                }

                if (FeexHitman.Instance.FeexHitmanDatabase.CheckExists(otherPlayer.CSteamID))
                {
                    decimal bounty = FeexHitman.Instance.FeexHitmanDatabase.GetBounty(otherPlayer.CSteamID);
                    Uconomy.Instance.Database.IncreaseBalance(caller.Id, bounty);
                    FeexHitman.Instance.FeexHitmanDatabase.RemoveVictimAccount(otherPlayer.CSteamID);
                    if (FeexHitman.Instance.Translations.Instance.Translate("hitman_payout") != "hitman_payout")
                    {
                        UnturnedChat.Say(caller, FeexHitman.Instance.Translations.Instance.Translate("hitman_payout", otherPlayer.DisplayName, bounty));
                    }
                }
                else
                {
                    if (FeexHitman.Instance.Translations.Instance.Translate("hitman_check_false") != "hitman_check_false")
                    {
                        UnturnedChat.Say(caller, FeexHitman.Instance.Translations.Instance.Translate("hitman_check_false", otherPlayer.DisplayName));
                    }
//.........这里部分代码省略.........
开发者ID:jorea143,项目名称:FeexHitman,代码行数:101,代码来源:CommandHitman.cs

示例12: Execute

        public void Execute(IRocketPlayer caller, string[] command)
        {
            if (caller is ConsolePlayer)
            {
                if (command.Length == 0 || command.Length > 1)
                {
                    Logger.Log("missing parameter or invalid parameter");
                    return;
                }

                UnturnedPlayer Uplayer = UnturnedPlayer.FromName(command[0]);
                IRocketPlayer Rplayer = (IRocketPlayer)Uplayer;

                if (Uplayer == null)
                {
                    Logger.Log("Player not found");
                    return;
                }

                if (Uplayer.Features.VanishMode)
                {
                    Uplayer.Features.VanishMode = false;
                    Logger.Log("you have disabled vanish on: " + Uplayer.DisplayName);
                    UnturnedChat.Say(Rplayer, "you are no longer in vanish", UnityEngine.Color.yellow);
                }
                else
                {
                    Uplayer.Features.VanishMode = true;
                    Logger.Log("you have enabled vanish on: " + Uplayer.DisplayName);
                    UnturnedChat.Say(Rplayer, "you are now in vanish", UnityEngine.Color.yellow);
                    Uplayer.Teleport(Uplayer);
                }
            }
            else
            {
                UnturnedPlayer player = (UnturnedPlayer)caller;

                if (command.Length == 1 && caller.HasPermission("vm.other"))
                {
                    UnturnedPlayer Uplayer = UnturnedPlayer.FromName(command[0]);
                    IRocketPlayer Rplayer = (IRocketPlayer)Uplayer;

                    if (Uplayer == null)
                    {
                        UnturnedChat.Say(caller, "player not found", UnityEngine.Color.yellow);
                        return;
                    }

                    if (Uplayer.Features.VanishMode)
                    {
                        Uplayer.Features.VanishMode = false;
                        Logger.Log(caller.DisplayName + " has disabled vanish on: " + Uplayer.DisplayName);
                        UnturnedChat.Say(Rplayer, player.DisplayName + " has taken you out of vanish", UnityEngine.Color.yellow);
                        UnturnedChat.Say(caller, "you have disabled vanish on: " + Uplayer.DisplayName, UnityEngine.Color.yellow);
                    }
                    else
                    {
                        Uplayer.Features.VanishMode = true;
                        Logger.Log(caller.DisplayName + " has enabled vanish on: " + Uplayer.DisplayName);
                        UnturnedChat.Say(Rplayer, player.DisplayName + " has put you in vanish", UnityEngine.Color.yellow);
                        UnturnedChat.Say(caller, "you have enabled vanish on: " + Uplayer.DisplayName, UnityEngine.Color.yellow);
                        Uplayer.Teleport(Uplayer);
                    }
                }
                else
                {
                    if (player.Features.VanishMode)
                    {
                        player.Features.VanishMode = false;
                        UnturnedChat.Say(caller, "you have disabled vanish", UnityEngine.Color.yellow);
                        Logger.Log(player.DisplayName + " has disabled vanish");
                    }
                    else
                    {
                        player.Features.VanishMode = true;
                        UnturnedChat.Say(caller, "you have enabled vanish", UnityEngine.Color.yellow);
                        Logger.Log(player.DisplayName + " has enabled vanish");
                        player.Teleport(player);
                    }
                }
            }
        }
开发者ID:sharkbound,项目名称:csharp-projects,代码行数:82,代码来源:CommandVM.cs

示例13: Execute

        public void Execute(IRocketPlayer caller, string[] command)
        {
            if (caller is ConsolePlayer)
            {
                if (command.Length == 0)
                {
                    Logger.Log("missing parameter");
                    return;
                }

                UnturnedPlayer player = UnturnedPlayer.FromName(command[0]);
                IRocketPlayer Rplayer = (IRocketPlayer)player;

                if (player == null )
                {
                    Logger.Log("failed to find player by the name: " + command[0]);
                    return;
                }

                if (player.Features.GodMode)
                {
                    player.Features.GodMode = false;
                    Logger.Log(player.DisplayName + " is no longer in godmode");
                    UnturnedChat.Say(Rplayer, "you are no longer in godmode", UnityEngine.Color.yellow);
                }
                else
                {
                    player.Features.GodMode = true;
                    Logger.Log(player.DisplayName + " is now in godmode");
                    UnturnedChat.Say(Rplayer, "you are now in godmode", UnityEngine.Color.yellow);
                }
            }
            else
            {
                UnturnedPlayer player = (UnturnedPlayer)caller;

                if (command.Length == 1 && caller.HasPermission("godmode.other"))
                {
                    UnturnedPlayer Uplayer = UnturnedPlayer.FromName(command[0]);
                    IRocketPlayer Rplayer = (IRocketPlayer)Uplayer;

                    if (Uplayer.Features.GodMode)
                    {
                        Uplayer.Features.GodMode = false;
                        UnturnedChat.Say(caller, "you have disabled godmode on: " + Uplayer.DisplayName, UnityEngine.Color.yellow);
                        UnturnedChat.Say(Rplayer, caller.DisplayName + " has taken you out of godmode", UnityEngine.Color.yellow);
                        Logger.Log(caller.DisplayName + " has taken " + Uplayer.DisplayName + " out of godmode");
                    }
                    else
                    {
                        Uplayer.Features.GodMode = true;
                        UnturnedChat.Say(caller, "you have enabled godmode on: " + Uplayer.DisplayName, UnityEngine.Color.yellow);
                        UnturnedChat.Say(Rplayer, caller.DisplayName + " has put you in godmode", UnityEngine.Color.yellow);
                        Logger.Log(caller.DisplayName + " has put " + Uplayer.DisplayName + " in godmode");
                    }
                    return;
                }

                if (player.Features.GodMode)
                {
                    player.Features.GodMode = false;
                    string globalMessage = player.DisplayName + " has disabled godmode";
                    Logger.Log(globalMessage);
                    UnturnedChat.Say(globalMessage, UnityEngine.Color.yellow);
                }
                else
                {
                    player.Features.GodMode = true;
                    string globalMessage = player.DisplayName + " has enabled godmode";
                    Logger.Log(globalMessage);
                    UnturnedChat.Say(globalMessage, UnityEngine.Color.yellow);
                }
            }
        }
开发者ID:sharkbound,项目名称:csharp-projects,代码行数:74,代码来源:Commandgodmode.cs

示例14: SpawnMagsWithLimit_Uconomy

        public void SpawnMagsWithLimit_Uconomy(ushort ammoAmountToSpawn, IRocketPlayer caller, SDG.Unturned.ItemGunAsset currentWeapon, UnturnedPlayer Uplayer, string[] command)
        {
            int costMultiplier = EasyAmmo.Instance.Configuration.Instance.PerBulletCostMultiplier;
            SDG.Unturned.ItemMagazineAsset magazine = (SDG.Unturned.ItemMagazineAsset)UnturnedItems.GetItemAssetById(GetMagId(Uplayer, currentWeapon, command));

            if (ammoAmountToSpawn <= (ushort)EasyAmmo.Instance.Configuration.Instance.ClipLimit || caller.HasPermission("easyammo.bypasslimit"))
            {
                if (Uconomy.Instance.Database.GetBalance(caller.Id) >= GetCost(false, ammoAmountToSpawn, currentWeapon, magazine))
                {
                    if (Uplayer.GiveItem(GetMagId(Uplayer, currentWeapon, command), (byte)ammoAmountToSpawn))
                    {
                        Uconomy.Instance.Database.IncreaseBalance(caller.Id, GetCost(true, ammoAmountToSpawn, currentWeapon, magazine));

                        UnturnedChat.Say(caller, EasyAmmo.Instance.Translate("giving_mags", ammoAmountToSpawn.ToString(), UnturnedItems.GetItemAssetById(GetMagId(Uplayer, currentWeapon, command)).Name, GetMagId(Uplayer, currentWeapon, command).ToString()));
                        UnturnedChat.Say(caller, EasyAmmo.Instance.Translate("balance", Uconomy.Instance.Database.GetBalance(caller.Id)));
                    }
                    else
                    {
                        UnturnedChat.Say(caller, EasyAmmo.Instance.Translate("failed_to_spawn_mags"));
                    }
                }
                else
                {
                    UnturnedChat.Say(caller, EasyAmmo.Instance.Translate("not_enough_funds",
                        Uconomy.Instance.Configuration.Instance.MoneyName,
                        ammoAmountToSpawn, magazine.itemName, GetCost(false, ammoAmountToSpawn, currentWeapon, magazine).ToString()));
                }
            }
            else
            {
                ushort amountoverlimit = ammoAmountToSpawn;
                ammoAmountToSpawn = (ushort)EasyAmmo.Instance.Configuration.Instance.ClipLimit;

                if (Uconomy.Instance.Database.GetBalance(caller.Id) >= GetCost(false, ammoAmountToSpawn, currentWeapon, magazine))
                {
                    if (Uplayer.GiveItem(GetMagId(Uplayer, currentWeapon, command), (byte)ammoAmountToSpawn))
                    {
                        Uconomy.Instance.Database.IncreaseBalance(caller.Id, GetCost(true, ammoAmountToSpawn, currentWeapon, magazine));

                        UnturnedChat.Say(caller, EasyAmmo.Instance.Translate("over_clip_spawn_limit_giving", amountoverlimit.ToString(),
                            EasyAmmo.Instance.Configuration.Instance.ClipLimit, UnturnedItems.GetItemAssetById(GetMagId(Uplayer, currentWeapon, command)).Name,
                            GetMagId(Uplayer, currentWeapon, command).ToString()));
                        UnturnedChat.Say(caller, EasyAmmo.Instance.Translate("balance", Uconomy.Instance.Database.GetBalance(caller.Id)));
                    }
                    else
                    {
                        UnturnedChat.Say(caller, EasyAmmo.Instance.Translate("failed_to_spawn_mags"));
                    }
                }
                else
                {
                    UnturnedChat.Say(caller, EasyAmmo.Instance.Translate("not_enough_funds",
                        Uconomy.Instance.Configuration.Instance.MoneyName,
                        ammoAmountToSpawn, magazine.itemName, GetCost(false, ammoAmountToSpawn, currentWeapon, magazine).ToString()));
                }
            }
        }
开发者ID:RocketModPlugins,项目名称:EasyAmmo,代码行数:57,代码来源:CommandAmmo.cs

示例15: Execute

        public void Execute(IRocketPlayer caller, string[] command)
        {
            if(command.Length == 1 && command[0].ToLower() == "reload" && caller.HasPermission("p.reload"))
            {
                R.Permissions.Reload();
                UnturnedChat.Say(caller, U.Translate("command_p_permissions_reload"));
                return;
            }




            if (command.Length == 0 && !(caller is ConsolePlayer))
            {
                UnturnedChat.Say(caller, U.Translate("command_p_groups_private", "Your", string.Join(", ", R.Permissions.GetGroups(caller, true).Select(g => g.DisplayName).ToArray())));
                UnturnedChat.Say(caller, U.Translate("command_p_permissions_private", "Your", string.Join(", ", Core.R.Permissions.GetPermissions(caller).Select(p => p.Name + (p.Cooldown != 0 ? "(" + p.Cooldown + ")" : "")).ToArray())));
            }
            else if(command.Length == 1) {

                IRocketPlayer player = command.GetUnturnedPlayerParameter(0);
                if (player == null) player = command.GetRocketPlayerParameter(0);
                if (player != null) {
                UnturnedChat.Say(caller, U.Translate("command_p_groups_private", player.DisplayName+"s", string.Join(", ", R.Permissions.GetGroups(player, true).Select(g => g.DisplayName).ToArray())));
                UnturnedChat.Say(caller, U.Translate("command_p_permissions_private", player.DisplayName + "s", string.Join(", ", Core.R.Permissions.GetPermissions(player).Select(p => p.Name +(p.Cooldown != 0? "(" + p.Cooldown + ")" : "")).ToArray())));
                }
                else
                {
                    UnturnedChat.Say(caller, U.Translate("command_generic_invalid_parameter"));
                    return;
                }
            }
            else if (command.Length == 3)
            {
                string c = command.GetStringParameter(0).ToLower();

                IRocketPlayer player = command.GetUnturnedPlayerParameter(1);
                if (player == null) player = command.GetRocketPlayerParameter(1);

                string groupName = command.GetStringParameter(2);
                
                switch (c)
                {
                    case "add":
                        if (caller.HasPermission("p.add")&& player != null && groupName != null) {
                            switch (Core.R.Permissions.AddPlayerToGroup(groupName, player))
                            {
                                case RocketPermissionsProviderResult.Success:
                                    UnturnedChat.Say(caller, U.Translate("command_p_group_player_added", player.DisplayName, groupName));
                                    return;
                                case RocketPermissionsProviderResult.DuplicateEntry:
                                    UnturnedChat.Say(caller, U.Translate("command_p_duplicate_entry", player.DisplayName, groupName));
                                    return;
                                case RocketPermissionsProviderResult.GroupNotFound:
                                    UnturnedChat.Say(caller, U.Translate("command_p_group_not_found", player.DisplayName, groupName));
                                    return;
                                case RocketPermissionsProviderResult.PlayerNotFound:
                                    UnturnedChat.Say(caller, U.Translate("command_p_player_not_found", player.DisplayName, groupName));
                                    return;
                                default:
                                    UnturnedChat.Say(caller, U.Translate("command_p_unknown_error", player.DisplayName, groupName));
                                    return;
                            }
                        }
                        return;
                    case "remove":
                        if (caller.HasPermission("p.remove") && player != null && groupName != null) {
                            switch (Core.R.Permissions.RemovePlayerFromGroup(groupName, player))
                            {
                                case RocketPermissionsProviderResult.Success:
                                    UnturnedChat.Say(caller, U.Translate("command_p_group_player_removed", player.DisplayName, groupName));
                                    return;
                                case RocketPermissionsProviderResult.DuplicateEntry:
                                    UnturnedChat.Say(caller, U.Translate("command_p_duplicate_entry", player.DisplayName, groupName));
                                    return;
                                case RocketPermissionsProviderResult.GroupNotFound:
                                    UnturnedChat.Say(caller, U.Translate("command_p_group_not_found", player.DisplayName, groupName));
                                    return;
                                case RocketPermissionsProviderResult.PlayerNotFound:
                                    UnturnedChat.Say(caller, U.Translate("command_p_player_not_found", player.DisplayName, groupName));
                                    return;
                                default:
                                    UnturnedChat.Say(caller, U.Translate("command_p_unknown_error", player.DisplayName, groupName));
                                    return;
                            }
                        }
                        return;
                    default:
                        UnturnedChat.Say(caller, U.Translate("command_generic_invalid_parameter"));
                        throw new WrongUsageOfCommandException(caller, this);
                }


            }
            else
            {
                UnturnedChat.Say(caller, U.Translate("command_generic_invalid_parameter"));
                throw new WrongUsageOfCommandException(caller, this);
            }

            
//.........这里部分代码省略.........
开发者ID:ClassyDestroyer,项目名称:Rocket.Unturned,代码行数:101,代码来源:CommandP.cs


注:本文中的IRocketPlayer.HasPermission方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。