private void onExitVechicleRequeseted(Player player, InteractableVehicle vehicle, ref bool shouldAllow, ref Vector3 pendingLocation, ref float pendingYaw)
        {
            if (vehicle.asset.id == Configuration.Instance.BusID)
            {
                RocketPermissionsGroup group   = R.Permissions.GetGroup(AutoBusPlugin.pluginInstance.Configuration.Instance.BusGroupID);
                UnturnedPlayer         uPlayer = UnturnedPlayer.FromPlayer(player);

                if (isInGroup(group, uPlayer) && (GetDriver(vehicle, uPlayer) == uPlayer))
                {
                    int asiento = vehicle.passengers.Length;
                    while (asiento >= 0)
                    {
                        SteamPlayer steamPlayer = vehicle.passengers[asiento].player;
                        if (steamPlayer != null)
                        {
                            UnturnedPlayer unturnedPlayer = UnturnedPlayer.FromPlayer(player);
                            ChatManager.serverSendMessage(String.Format(pluginInstance.Translate("OUT_DRIVER", unturnedPlayer.CharacterName).Replace('(', '<').Replace(')', '>')), Color.white, null, steamPlayer, EChatMode.WELCOME, AutoBusPlugin.pluginInstance.Configuration.Instance.ImageUrl, true);
                        }
                    }

                    vehicle.forceRemoveAllPlayers();
                    return;
                }
            }
            shouldAllow = true;
        }
Exemple #2
0
        public static void DestroyVehicle(InteractableVehicle vehicle)
        {
            if (!vehicle.isEmpty)
            {
                vehicle.forceRemoveAllPlayers();
            }

            SDG.Unturned.VehicleManager.askVehicleDestroy(vehicle);
        }
Exemple #3
0
        private void OnDamageVehicle(CSteamID instigatorSteamID, InteractableVehicle vehicle, ref ushort pendingTotalDamage, ref bool canRepair, ref bool shouldAllow, EDamageOrigin damageOrigin)
        {
            UnturnedPlayer player = UnturnedPlayer.FromCSteamID(instigatorSteamID);

            // uff zombie detector and player -_-
            if (pendingTotalDamage <= 2)
            {
                return;
            }

            if (player == null)
            {
                return;
            }

            // need to do some changes here, with health update, because when u hit a player still working this function, nelson nigger don't want to fix this...
            if (damageOrigin.ToString() == "Vehicle_Collision_Self_Damage")
            {
                if (player.CurrentVehicle.asset.engine == EEngine.CAR)
                {
                    if (player.CurrentVehicle.health < VehicleCrash.Instance.Configuration.Instance.ifvehiclehasXhealthStopWork)
                    {
                        burn_Fuel(player.CurrentVehicle);

                        vehicle.forceRemoveAllPlayers();

                        if (VehicleCrash.Instance.Configuration.Instance.autowarnmechanic)
                        {
                            ChatManager.serverSendMessage(VehicleCrash.Instance.Translate("warning", player.DisplayName).Replace('(', '<').Replace(')', '>'), Color.white, null, null, EChatMode.SAY, VehicleCrash.Instance.Translate("iconwarning", player.DisplayName), true);
                        }
                    }
                    else
                    {
                        tire_Damage(player, UnityEngine.Random.Range(1, 2), UnityEngine.Random.value);

                        foreach (var passenger in vehicle.passengers)
                        {
                            UnturnedPlayer jugador = UnturnedPlayer.FromSteamPlayer(passenger.player);

                            if (jugador != null && !jugador.GetComponent <PlayerComponent>().niggagetwork)
                            {
                                StartCoroutine(crash(jugador));
                            }
                            // break; my cucumber idk, for prevent bugs
                            break;
                        }
                    }
                }
            }
        }