Beispiel #1
0
        void Hover(BasePlayer player)
        {
            if (permission.UserHasPermission(player.UserIDString, canHover) && player.GetMountedVehicle() != null)
            {
                BaseVehicle playerVehicle = player.GetMountedVehicle();

                if (_config.Permission.passengerToggle || !_config.Permission.passengerToggle && playerVehicle.GetDriver() == player)
                {
                    if (player.isMounted && playerVehicle.ShortPrefabName == "minicopter.entity" ||
                        playerVehicle.ShortPrefabName == "scraptransporthelicopter" && _config.Permission.scrapheliCanHover ||
                        playerVehicle.ShortPrefabName == "ch47.entity" && _config.Permission.chinookCanHover)
                    {
                        MiniCopter minicopter = playerVehicle as MiniCopter;

                        //Chinook
                        if (minicopter == null && playerVehicle.ShortPrefabName == "ch47.entity")
                        {
                            CH47Helicopter chinook = playerVehicle as CH47Helicopter;

                            if (chinook != null)
                            {
                                if (_config.Permission.enableHoverWithTwoOccupants)
                                {
                                    ChinookHover(player, chinook);
                                    return;
                                }
                                else
                                {
                                    if (chinook.NumMounted() >= 2)
                                    {
                                        PrintToChat(player, lang.GetMessage("CantHoverTwoOccupants", this, player.UserIDString));

                                        return;
                                    }
                                }
                            }
                        }

                        if (minicopter != null)
                        {
                            if (minicopter.IsEngineOn() && minicopter.isMobile || minicopter.isMobile && minicopter.GetDriver() != player)
                            {
                                if (_config.Permission.enableHoverWithTwoOccupants)
                                {
                                    ToggleHover(player, minicopter);
                                }
                                else
                                {
                                    if (minicopter.NumMounted() >= 2)
                                    {
                                        PrintToChat(player, lang.GetMessage("CantHoverTwoOccupants", this, player.UserIDString));

                                        return;
                                    }
                                }
                            }
                            else
                            {
                                PrintToChat(player, lang.GetMessage("NotFlying", this, player.UserIDString));
                            }
                        }
                        else
                        {
                            PrintWarning(lang.GetMessage("HelicopterNull", this, player.UserIDString));

                            PrintToChat(player, lang.GetMessage("ErrorFound", this, player.UserIDString));

                            return;
                        }
                    }
                    else
                    {
                        if (!player.isMounted)
                        {
                            PrintToChat(lang.GetMessage("NotMounted", this, player.UserIDString));
                        }

                        if (playerVehicle is MiniCopter == false)
                        {
                            PrintToChat(player, lang.GetMessage("NotInHelicopter", this, player.UserIDString));
                        }
                    }
                }
            }
            else if (player.GetMountedVehicle() == null)
            {
                PrintToChat(player, lang.GetMessage("NotInHelicopter", this, player.UserIDString));
            }
            else
            {
                PrintToChat(player, lang.GetMessage("NoPermission", this, player.UserIDString));
            }
        }