Esempio n. 1
0
        public PlayerMenu(int serverId, PlayerListMenu parent, Client client) : base("Player", parent)
        {
            ServerId = serverId;

            var spec = new MenuItemCheckbox(client, this, "Spectate Player", false, Constants.AceAdminSpec)
            {
                IsChecked = () => client.Spectate.CurrentPlayer?.ServerId == ServerId
            };

            spec.Activate += () => {
                if (client.Spectate.CurrentPlayer == null || client.Spectate.CurrentPlayer.ServerId != ServerId)
                {
                    client.Spectate.Start(Player);
                }
                else
                {
                    client.Spectate.Stop();
                }
                return(Task.FromResult(0));
            };
            Add(spec);

            var tpTo = new MenuItem(client, this, "Teleport To Player", Constants.AceAdminTp);

            tpTo.Activate += () => {
                parent.LastTpTarget = ServerId;
                BaseScript.TriggerServerEvent("HyperAdmin.TpTo", ServerId);
                return(Task.FromResult(0));
            };
            Add(tpTo);

            var bring = new MenuItem(client, this, "Bring Player", Constants.AceAdminBring);

            bring.Activate += () => {
                BaseScript.TriggerServerEvent("HyperAdmin.Bring", ServerId, JsonConvert.SerializeObject(Game.PlayerPed.Position));
                return(Task.FromResult(0));
            };
            Add(bring);

            var freeze = new MenuItemCheckbox(client, this, "Freeze Player", Player.Character.IsPositionFrozen, Constants.AceAdminFreeze)
            {
                IsChecked = () => API.DecorGetBool(Player.Character.Handle, "Player.Frozen")
            };

            freeze.Activate += () => {
                BaseScript.TriggerServerEvent("HyperAdmin.Freeze", ServerId);
                return(Task.FromResult(0));
            };
            Add(freeze);

            var kick = new MenuItemSubMenu(client, this, new KickMenu(client, this), ace: Constants.AceAdminKick);

            Add(kick);

            var ban = new MenuItemSubMenu(client, this, new BanMenu(client, this), ace: Constants.AceAdminBan);

            Add(ban);
        }
Esempio n. 2
0
        public AdminMenu(Client client) : base("HyperAdmin")
        {
            _client = client;
            var players = new PlayerListMenu(this, client);

            Add(new MenuItemSubMenu(client, this, players, ace: Constants.AceAdminMonitor));

            // TODO: Fix Overhead Names (Mooshe)
            //var hudMenu = new HudMenu( client, this );
            //Add( new MenuItemSubMenu( client, this, hudMenu, ace: Constants.AceAdminMonitor ) );

            var serverMenu = new ServerMenu(client, this);

            Add(new MenuItemSubMenu(client, this, serverMenu, ace: Constants.AceAdminMonitor));
        }