Esempio n. 1
0
        public override async Task Started()
        {
            // Request server configuration
            this.config = await Comms.Event(CharacterCustomizationEvents.Configuration).ToServer().Request <CharactersCustomizationConfiguration>();

            //Comms.Event(CharacterEvents.Selected).FromServer().On<CharacterSession>(OnCharacterSelected);
        }
Esempio n. 2
0
        private void MarkersTick()
        {
            var pedPos = Game.PlayerPed.Position;

            foreach (var marker in this.markers)
            {
                API.DrawMarker(marker.MarkerType,
                               marker.Location.X, marker.Location.Y, marker.Location.Z,
                               marker.Rotation.X, marker.Rotation.Y, marker.Rotation.Z,
                               marker.Direction.X, marker.Direction.Y, marker.Direction.Z,
                               marker.Scale.X, marker.Scale.Y, marker.Scale.Z,
                               marker.Color.Red, marker.Color.Green, marker.Color.Blue, marker.IsVisible ? marker.Color.Alpha : 0,
                               marker.BobUpDown, marker.FaceCamera, 2, marker.RotateWithHeading,
                               marker.TextureDictionary, marker.TextureName, marker.DrawOnEnts);

                var markerLocation    = ToCfxVector(marker.Location);
                var pedMarkerDistance = markerLocation.DistanceToSquared(pedPos);

                // Check if inside marker
                if (pedMarkerDistance < marker.Scale.X + 1.5f && pedMarkerDistance < marker.Scale.Y + 1.5f && pedMarkerDistance <= marker.Scale.Z + 1.5f)
                {
                    // Check if the player has entered the marker already
                    if (!marker.HasPlayerInside)
                    {
                        // If not, set as is inside
                        marker.HasPlayerInside = true;
                        // Emit the event
                        Comms.Event(MarkersEvents.MarkerEntered).ToClient().Emit(marker);
                    }
                }
                else if (marker.HasPlayerInside)
                {
                    // If not inside the marker anymore, but the marker previously had the player inside
                    // set as not inside
                    marker.HasPlayerInside = false;
                    // Emit the event
                    Comms.Event(MarkersEvents.MarkerLeft).ToClient().Emit(marker);
                }
            }

            foreach (var marker in this.GetInsideMarkersList())
            {
                // Check if the marker's key was clicked while inside marker
                if (marker.IsClickable && marker.Hotkey.IsJustPressed())
                {
                    Logger.Info("Pressed " + marker.Hotkey.ControlNativeName);
                    Comms.Event(MarkersEvents.MarkerClicked).ToClient().Emit(marker);
                }
            }
        }
Esempio n. 3
0
        public override async Task Started()
        {
            // Lookup local identity from server
            this.Identity = await this.Comms.Event(IdentityManagerEvents.Identity).ToServer().Request <Identity>();

            // Create events
            Comms.Event(IdentityManagerEvents.GetLocalIdentity).FromClient().OnRequest(e => e.Reply(GetLocalIdentity()));

            #region Example Debug
            this.Logger.Debug($"From server config: {this.Identity.UserId.ToString()}");
            foreach (CharacterData c in this.Identity.Characters)
            {
                this.Logger.Debug($"Character: {c.CharacterId.ToString()} - {c.FirstName} {c.LastName}");
            }
            #endregion
        }