Пример #1
0
        protected override async Task OnExecuteAsync()
        {
            UnturnedUser user = (UnturnedUser)Context.Actor;
            uint         id   = await Context.Parameters.GetAsync <uint>(0);

            PlayerBunch?pBunch = await m_KeysManager.TryGetPlayerBunch(user.SteamId.ToString());

            if (pBunch == null || pBunch.VehiclesKey.Count == 0)
            {
                await user.PrintMessageAsync(m_StringLocalizer["translations:no_key"], System.Drawing.Color.Red, false, "");
            }
            else if (!pBunch.VehiclesKey.Any(v => v.InstanceId == id))
            {
                InteractableVehicle vehicle = VehicleManager.findVehicleByNetInstanceID(id);
                if (vehicle != null && !vehicle.isExploded && !vehicle.isDead)
                {
                    await UniTask.SwitchToMainThread();

                    await user.PrintMessageAsync(m_StringLocalizer["translations:vehicle_position", new { vehicle = pBunch.VehiclesKey.Where(z => z.InstanceId == id).First().VehicleName }], System.Drawing.Color.Green);

                    user.Player.Player.quests.replicateSetMarker(true, vehicle.transform.position, "Your vehicle!");
                }
                else
                {
                    await user.PrintMessageAsync(m_StringLocalizer["translations:vehicle_explode"]);

                    await m_KeysManager.TryRemoveKeyFromBunch(user.SteamId.ToString(), id);
                }
            }
            else
            {
                await user.PrintMessageAsync(m_StringLocalizer["translations:no_vehicle", new { vehicleID = id }]);
            }
        }
        protected override async Task OnExecuteAsync()
        {
            UnturnedUser        user    = (UnturnedUser)Context.Actor;
            InteractableVehicle?vehicle = RaycastHelper.Raycast(user.Player.Player, 6f);

            if (vehicle != null)
            {
                string ownerId = await m_KeysManager.CheckVehicleOwner(vehicle.instanceID);

                if (ownerId != "")
                {
                    await m_KeysManager.TryRemoveKeyFromBunch(ownerId, vehicle.instanceID);

                    await user.PrintMessageAsync(m_StringLocalizer["translations:vehicle_removedkey", new { vehicleID = vehicle.instanceID }]);

                    var player = PlayerTool.getPlayer(new Steamworks.CSteamID(ulong.Parse(ownerId)));
                    if (player != null)
                    {
                        ChatManager.say(player.channel.owner.playerID.steamID, m_StringLocalizer["translations:vehicle_lockpicked", new { vehicle = vehicle.asset.name, vehicleID = vehicle.instanceID }], UnityEngine.Color.red, EChatMode.SAY, true);
                    }
                }
            }
            else
            {
                await user.PrintMessageAsync(m_StringLocalizer["translations:vehicle_notfound"], System.Drawing.Color.Red, false, "");
            }
        }
Пример #3
0
        protected override async Task OnExecuteAsync()
        {
            UnturnedUser user = (UnturnedUser)Context.Actor;
            uint         id   = await Context.Parameters.GetAsync <uint>(0);

            if (!await m_KeysManager.TryRemoveKeyFromBunch(user.Id, id))
            {
                await user.PrintMessageAsync(m_StringLocalizer["translations:no_vehicle", new { vehicleID = id }], System.Drawing.Color.Red, false, "");
            }
            else
            {
                InteractableVehicle vehicle = VehicleManager.findVehicleByNetInstanceID(id);
                await UniTask.SwitchToMainThread();

                VehicleManager.instance.channel.send("tellVehicleLock", ESteamCall.ALL, ESteamPacket.UPDATE_RELIABLE_BUFFER, new object[]
                {
                    vehicle.instanceID,
                    user.SteamId,
                    user.Player.Player.quests.groupID,
                    false
                });
                await user.PrintMessageAsync(m_StringLocalizer["translations:vehicle_delete", new { vehicleID = id }], System.Drawing.Color.Red, false, "");
            }
        }