示例#1
0
        static public KeyValuePair <Control, string>?DisplayButtonInstructionCheck()
        {
            WarpPoint warp = GetActiveWarpPoint().Item1;

            if (warp != null)
            {
                return(new KeyValuePair <Control, string>(Control.Context, warp.TargetLabel));
            }
            else
            {
                return(null);
            }
        }
示例#2
0
 public WarpPointPair(WarpPoint A, WarpPoint B)
 {
 }
示例#3
0
        static public async Task OnTick()
        {
            try
            {
                NearbyWarps.ForEach(w =>
                {
                    World.DrawMarker(MarkerType.HorizontalCircleFat, w.A.TargetCoords, MarkerDirection, MarkerRotation, MarkerScale, MarkerColor);
                    World.DrawMarker(MarkerType.HorizontalCircleFat, w.B.TargetCoords, MarkerDirection, MarkerRotation, MarkerScale, MarkerColor);
                });
                if (ControlHelper.IsControlJustPressed(Control.Context))
                {
                    Tuple <WarpPoint, Dictionary <string, bool>, Dictionary <string, bool> > detailedWarp = GetActiveWarpPoint();
                    //TODO: Add the ability to gate warp points.  E.g. Berr's G.G. Deleware character is the only one that can unlock
                    //      (and lock) Solomon's office to allow (disallow) warps to the location.
                    if (detailedWarp != null)
                    {
                        WarpPoint warp = detailedWarp.Item1;
                        Dictionary <string, bool> propList = detailedWarp.Item2;
                        Dictionary <string, bool> IPLsList = detailedWarp.Item3;

                        CitizenFX.Core.UI.Screen.Fading.FadeOut(500);

                        while (!CitizenFX.Core.UI.Screen.Fading.IsFadedOut)
                        {
                            await BaseScript.Delay(10);
                        }

                        Game.PlayerPed.Position = warp.TargetCoords;
                        Game.PlayerPed.Heading  = warp.TargetHeading;
                        // Pretty sure the below is not required, but does no harm
                        Function.Call(Hash.REQUEST_COLLISION_AT_COORD, warp.TargetCoords.X, warp.TargetCoords.Y, warp.TargetCoords.Z);

                        if (IPLsList.Count > 0)
                        {
                            IPLsList.ToList().ForEach(l =>
                            {
                                if (l.Value)
                                {
                                    Function.Call(Hash.REQUEST_IPL, l.Key);
                                }
                                else
                                {
                                    Function.Call(Hash.REMOVE_IPL, l.Key);
                                }
                            });
                        }

                        if (propList.Count > 0)
                        {
                            int interior = Function.Call <int>(Hash.GET_INTERIOR_AT_COORDS, warp.TargetCoords.X, warp.TargetCoords.Y, warp.TargetCoords.Z);
                            propList.ToList().ForEach(l =>
                            {
                                if (l.Value)
                                {
                                    Function.Call(Hash._ENABLE_INTERIOR_PROP, interior, l.Key);
                                }
                                else
                                {
                                    Function.Call(Hash._DISABLE_INTERIOR_PROP, interior, l.Key);
                                }
                            });
                            Function.Call(Hash.REFRESH_INTERIOR, interior);
                        }

                        RecalculateNearby();
                        //Necessary to allow props to load in
                        await BaseScript.Delay(1000);

                        CitizenFX.Core.UI.Screen.Fading.FadeIn(500);
                    }
                }
            }
            catch (Exception ex)
            {
                Log.Error($"[WARPPOINTS] OnTick error: {ex.Message}");
            }
            await Task.FromResult(0);
        }