Ejemplo n.º 1
0
        public void Destroy(bool check_players = false)
        {
            if (check_players)
            {
                foreach (var player in Main.Players.Keys.ToList())
                {
                    if (!Main.Players.ContainsKey(player))
                    {
                        continue;
                    }
                    if (player.Position.DistanceTo(colShape.Position) > 1.5f)
                    {
                        continue;
                    }

                    Trigger.ClientEvent(player, "SetSafeNearby", false);
                    player.ResetData("temp_SafeID");
                }
            }

            Object.Delete();
            DoorObject.Delete();
            Label.Delete();

            NAPI.ColShape.DeleteColShape(colShape);
            if (Timer != null)
            {
                Timers.Stop(Timer);
            }
        }
Ejemplo n.º 2
0
        public void AmeCommand(Client player, string message = "")
        {
            if (player.HasData(EntityData.PLAYER_AME) == true)
            {
                // We get player's TextLabel
                TextLabel label = player.GetData(EntityData.PLAYER_AME);

                if (message.Length > 0)
                {
                    // We update label's text
                    label.Text = "*" + message + "*";
                }
                else
                {
                    // Deleting TextLabel
                    label.Detach();
                    label.Delete();
                    player.ResetData(EntityData.PLAYER_AME);
                }
            }
            else
            {
                TextLabel ameLabel = NAPI.TextLabel.CreateTextLabel("*" + message + "*", new Vector3(0.0f, 0.0f, 0.0f), 50.0f, 0.5f, 4, new Color(201, 90, 0, 255));
                ameLabel.AttachTo(player, "SKEL_Head", new Vector3(0.0f, 0.0f, 1.0f), new Vector3(0.0f, 0.0f, 0.0f));
                player.SetData(EntityData.PLAYER_AME, ameLabel);
            }
        }
Ejemplo n.º 3
0
 public static void OnPlayerDisconnected(Client player, DisconnectionType type, string reason)
 {
     // Deleting player's attached label
     if (player.HasData(EntityData.PLAYER_AME) == true)
     {
         TextLabel label = player.GetData(EntityData.PLAYER_AME);
         label.Detach();
         label.Delete();
     }
 }
Ejemplo n.º 4
0
        public void PickupItem()
        {
            if (NAPI.Entity.DoesEntityExist(SpawnedObject))
            {
                NAPI.Entity.DeleteEntity(SpawnedObject);
            }

            if (TextLabel != null)
            {
                TextLabel.Delete();
            }
        }
Ejemplo n.º 5
0
Archivo: Door.cs Proyecto: Yarpii/MTGRP
        public void Delete()
        {
            Locked = true;
            RefreshDoor();
            Text.Delete();
            Shape.OnEntityEnterColShape -= Shape_onEntityEnterColShape;
            API.Shared.DeleteColShape(Shape);

            var filter = MongoDB.Driver.Builders <Door> .Filter.Eq("_id", Id);

            DatabaseManager.DoorsTable.DeleteOne(filter);
            Doors.Remove(this);
        }
Ejemplo n.º 6
0
        public static void MoveDealer()
        {
            Random rand = new Random();
            int    r    = rand.Next(DealerLocations.Count);

            if (CurrentDealer != null)
            {
                API.Shared.DeleteEntity(CurrentDealer);
            }
            if (DealerLabel != null)
            {
                DealerLabel.Delete();
            }
            if (DealerNameLabel != null)
            {
                DealerNameLabel.Delete();
            }
            foreach (var o in WeaponCases)
            {
                API.Shared.DeleteEntity(o);
            }

            DealerLabel     = API.Shared.CreateTextLabel("~g~/gunrun\n/intervene", DealerLocations[r], 25f, 1f, 1, new GTANetworkAPI.Color(1, 1, 1), true);
            DealerNameLabel = API.Shared.CreateTextLabel("Yuri_Orlov", DealerLocations[r] + new Vector3(0, 0, 1f), 25f, 0.5f, 1, new GTANetworkAPI.Color(1, 1, 1), true);
            CurrentDealer   = API.Shared.CreatePed(PedHash.RoccoPelosi, DealerLocations[r], 180);
            Entity WeaponCase = API.Shared.CreateObject((int)API.Shared.GetHashKey("prop_gun_case_01"),
                                                        DealerLocations[r] - new Vector3(-1f, 0, 1f), new Vector3(0, 0, 180));

            WeaponCases.Add(WeaponCase);
            WeaponCase = API.Shared.CreateObject((int)API.Shared.GetHashKey("prop_idol_case_02"),
                                                 DealerLocations[r] - new Vector3(0.7f, 0, 1f), new Vector3(0, 0, 180));
            WeaponCases.Add(WeaponCase);

            foreach (var p in PlayerManager.Players)
            {
                CreateMovingMessage(p.Player, DealerLocations[r]);
            }
        }