Exemple #1
0
            protected override void execute(CSteamID executorID, string parameter)
            {
                SteamPlayer player = PlayerTool.getSteamPlayer(executorID);

                List <InteractableVehicle> nearbyVehicles = new List <InteractableVehicle>();

                VehicleManager.getVehiclesInRadius(player.player.movement.transform.position, 15f, nearbyVehicles);

                foreach (InteractableVehicle v in nearbyVehicles)
                {
                    byte     seat;
                    CSteamID escorteeID;

                    if (EscortingPlayers.TryGetValue(executorID, out escorteeID))
                    {
                        Player ply = PlayerTool.getPlayer(escorteeID);


                        if (v.tryAddPlayer(out seat, ply) && !v.isLocked)
                        {
                            EscortedPlayers.Remove(escorteeID);
                            EscortingPlayers.Remove(executorID);
                            VehicleManager.instance.channel.send("tellEnterVehicle", ESteamCall.ALL, ESteamPacket.UPDATE_RELIABLE_BUFFER, new object[] {
                                v.instanceID,
                                seat,
                                escorteeID
                            });
                        }
                    }
                }
            }
Exemple #2
0
            protected override void execute(CSteamID executorID, string parameter)
            {
                if (EscortingPlayers.ContainsKey(executorID))
                {
                    CSteamID escorteeID;
                    if (EscortingPlayers.TryGetValue(executorID, out escorteeID))
                    {
                        EscortedPlayers.Remove(escorteeID);
                        Player ply = PlayerTool.getPlayer(escorteeID);
                        ply.movement.sendPluginSpeedMultiplier(Main.Config.arrestMoveSpeed);
                    }

                    EscortingPlayers.Remove(executorID);
                    return;
                }
                else if (EscortedPlayers.ContainsKey(executorID))
                {
                    return;
                }

                SteamPlayer player = PlayerTool.getSteamPlayer(executorID);

                List <Player> nearbyPlayers = new List <Player>();

                PlayerTool.getPlayersInRadius(player.player.movement.transform.position, 10f, nearbyPlayers);

                if (nearbyPlayers == null)
                {
                    return;
                }

                foreach (Player p in nearbyPlayers)
                {
                    if (p.animator.gesture == EPlayerGesture.ARREST_START)
                    {
                        EscortingPlayers.Add(player.playerID.steamID, p.channel.owner.playerID.steamID);
                        EscortedPlayers.Add(p.channel.owner.playerID.steamID, player.playerID.steamID);
                        p.movement.sendPluginSpeedMultiplier(0); // make it so players cant move while being escorted
                        return;
                    }
                }
            }