Ejemplo n.º 1
0
        public void CMD_MutePlayer(Client player, string targetName)
        {
            AdminAccount acc = AccountHandler.instance.GetAccount(player);

            if (acc != null)
            {
                if (DoesPlayerHaveAccess(acc.Level, AdminRanks.JuniorAdmin))
                {
                    Client target = GetPlayerByNameOrID(targetName);
                    if (target != null)
                    {
                        target.TriggerEvent("TOGGLE_MUTE", false);
                        target.SendChatMessage("~r~[MUTED]: An admin has muted you..");
                        SendAdmMsg(player, "You have muted: ~o~" + target.Name);
                        return;
                    }
                    else
                    {
                        SendPlayerNotFound(player);
                    }
                }
                else
                {
                    SendNoPermMsg(player);
                }
            }
            else
            {
                SendNoPermMsg(player);
            }
        }
Ejemplo n.º 2
0
        public void CMD_Kick(Client player, string targetName, string reason)
        {
            AdminAccount acc = AccountHandler.instance.GetAccount(player);

            if (acc != null)
            {
                if (DoesPlayerHaveAccess(acc.Level, AdminRanks.JuniorAdmin))
                {
                    Client target = GetPlayerByNameOrID(targetName);
                    if (target != null)
                    {
                        NAPI.Player.KickPlayer(target, reason);
                        SendGlobalAdmCmd(target.Name + " was kicked by " + acc.AdminName + ". Reason: " + reason);
                        return;
                    }
                    else
                    {
                        SendPlayerNotFound(player);
                    }
                }
                else
                {
                    SendNoPermMsg(player);
                }
            }
            else
            {
                SendNoPermMsg(player);
            }
        }
Ejemplo n.º 3
0
        public void CMD_GetHere(Client player, string targetName)
        {
            AdminAccount acc = AccountHandler.instance.GetAccount(player);

            if (acc != null)
            {
                if (DoesPlayerHaveAccess(acc.Level, AdminRanks.JuniorAdmin))
                {
                    Client target = GetPlayerByNameOrID(targetName);
                    if (target != null)
                    {
                        target.Position = new Vector3(player.Position.X + 1f,
                                                      player.Position.Y,
                                                      player.Position.Z + 1f);
                        SendAdmMsg(player, "You teleported: ~o~" + target.Name + " ~w~to your position.");
                        target.SendChatMessage("[TELEPORTED]: An admin teleported you..");
                        return;
                    }
                    else
                    {
                        SendPlayerNotFound(player);
                    }
                }
                else
                {
                    SendNoPermMsg(player);
                }
            }
            else
            {
                SendNoPermMsg(player);
            }
        }
Ejemplo n.º 4
0
        public void CMD_Goto(Client player, string targetName)
        {
            AdminAccount acc = AccountHandler.instance.GetAccount(player);

            if (acc != null)
            {
                if (DoesPlayerHaveAccess(acc.Level, AdminRanks.JuniorAdmin))
                {
                    Client target = GetPlayerByNameOrID(targetName);
                    if (target != null)
                    {
                        player.Position = new Vector3(target.Position.X + 1f,
                                                      target.Position.Y,
                                                      target.Position.Z + 1f);
                        SendAdmMsg(player, "You teleported to: ~o~" + target.Name);
                        return;
                    }
                    else
                    {
                        SendPlayerNotFound(player);
                    }
                }
                else
                {
                    SendNoPermMsg(player);
                }
            }
            else
            {
                SendNoPermMsg(player);
            }
        }
Ejemplo n.º 5
0
        public void CMD_SetKevlar(Client player, string targetName, int amount)
        {
            AdminAccount acc = AccountHandler.instance.GetAccount(player);

            if (acc != null)
            {
                if (DoesPlayerHaveAccess(acc.Level, AdminRanks.Senior))
                {
                    if (amount <= 0 || amount > 100)
                    {
                        NAPI.Chat.SendChatMessageToPlayer(player, "~r~ERROR: ~w~Valid range is 1-100..");
                    }
                    Client target = GetPlayerByNameOrID(targetName);
                    if (target != null)
                    {
                        target.Armor = amount;
                        SendAdmMsg(target, "Your kevlar was set to: ~o~" + amount + " ~w~by ~o~" + acc.AdminName);
                        SendAdmMsg(player, "You set the kevlar of: ~o~" + target.Name + " ~w~to ~o~" + amount);
                    }
                    else
                    {
                        SendPlayerNotFound(player);
                    }
                }
                else
                {
                    SendNoPermMsg(player);
                }
            }
            else
            {
                SendNoPermMsg(player);
            }
        }
Ejemplo n.º 6
0
        public void CMD_SpawnCar(Client player, string vehName, int color1 = 1, int color2 = 1)
        {
            AdminAccount acc = AccountHandler.instance.GetAccount(player);

            if (acc != null)
            {
                if (DoesPlayerHaveAccess(acc.Level, AdminRanks.Senior))
                {
                    VehicleHash vehHash = NAPI.Util.VehicleNameToModel(vehName);
                    if (vehHash != 0)
                    {
                        NAPI.Player.SetPlayerIntoVehicle(player, NAPI.Vehicle.CreateVehicle(vehHash, player.Position, player.Rotation, color1, color2), -1);
                        SendAdmMsg(player, "You successfully spawned : ~o~" + vehName.ToUpper());
                        return;
                    }
                    else
                    {
                        NAPI.Chat.SendChatMessageToPlayer(player, "~r~ERROR: ~w~There is no vehicle model called: ~o~" + vehName);
                        return;
                    }
                }
                else
                {
                    SendNoPermMsg(player);
                }
            }
            else
            {
                SendNoPermMsg(player);
            }
        }
Ejemplo n.º 7
0
        public void LoginAdmin(Client player, string password)
        {
            string path = Path.Combine(NAPI.Resource.GetResourceFolder(this), dataFolderName, player.SocialClubName.ToString() + ".json");

            if (File.Exists(path))
            {
                AdminAccount savedAcc = JsonConvert.DeserializeObject <AdminAccount>(File.ReadAllText(path));
                if (BCr.BCrypt.Verify(password, savedAcc.Password))
                {
                    player.SetData("Account", savedAcc);
                    NAPI.Chat.SendChatMessageToPlayer(player, "~g~SUCCESS: ~w~You're now logged into your admin account. Use ~y~/ahelp ~w~to get started.");
                    return;
                }
                else
                {
                    NAPI.Chat.SendChatMessageToPlayer(player, "~r~ERROR: ~w~Wrong password.");
                    return;
                }
            }
            else
            {
                NAPI.Chat.SendChatMessageToPlayer(player, "~r~ERROR: ~w~No admin account found with the SocialClubeName: ~y~" + player.SocialClubName);
                return;
            }
        }
Ejemplo n.º 8
0
        public void CMD_Ban(Client player, string targetName, string reason)
        {
            AdminAccount acc = AccountHandler.instance.GetAccount(player);

            if (acc != null)
            {
                if (DoesPlayerHaveAccess(acc.Level, AdminRanks.Admin))
                {
                    Client target = GetPlayerByNameOrID(targetName);
                    if (target != null)
                    {
                        BanData data = new BanData
                        {
                            SocialClub = target.SocialClubName,
                            HardwareID = target.Serial,
                            IP         = target.Address,

                            BannedBy = acc.AdminName,
                            Reason   = reason,
                            Date     = DateTime.Now
                        };
                        if (Database.instance.BanPlayer(target, data))
                        {
                            // Player doesn't seem to get the kick reason, hence the sendchat has been added.
                            NAPI.Chat.SendChatMessageToPlayer(target, "BANNED: " + reason);
                            NAPI.Player.KickPlayer(target, "BANNED: " + reason);
                            SendGlobalAdmCmd(target.Name + " was banned by " + acc.AdminName + ". Reason: " + reason);
                        }
                        else
                        {
                            SendAdmMsg(player, "Something went wrong.. A file for this player already exists!");
                        }
                    }
                    else
                    {
                        SendPlayerNotFound(player);
                    }
                }
                else
                {
                    SendNoPermMsg(player);
                }
            }
            else
            {
                SendNoPermMsg(player);
            }
        }
Ejemplo n.º 9
0
        public AdminAccount InitAccount(Client player, object[] data)
        {
            if (player != null && data != null)
            {
                AdminAccount acc = new AdminAccount();

                acc.SocialClub = (string)data[0];
                acc.AdminName  = (string)data[1];
                acc.Level      = (byte)data[2];
                acc.Password   = (string)data[3];

                player.SetData("Account", acc);
                return(acc);
            }
            else
            {
                return(null);
            }
        }
Ejemplo n.º 10
0
        public void CMD_SpawnWeapon(Client player, string wepName, int ammo = 9999)
        {
            AdminAccount acc = AccountHandler.instance.GetAccount(player);

            if (acc != null)
            {
                if (DoesPlayerHaveAccess(acc.Level, AdminRanks.Senior))
                {
                    WeaponHash wepHash = NAPI.Util.WeaponNameToModel(wepName);
                    NAPI.Player.GivePlayerWeapon(player, wepHash, ammo);
                    SendAdmMsg(player, "You successfully gave yourself a: ~o~" + wepName.ToUpper() + " ~w~with: ~o~" + ammo + " ~w~bullets.");
                    return;
                }
                else
                {
                    SendNoPermMsg(player);
                }
            }
            else
            {
                SendNoPermMsg(player);
            }
        }