GetPlayerInvincible() public static method

public static GetPlayerInvincible ( GTA.Player p ) : bool
p GTA.Player
return bool
 private void PlayersCommand()
 {
     for (var i = 0; i < 32; i++)
     {
         var p = new Player(i);
         if (p.Name != "**Invalid**")
         {
             _developerConsole
             .PrintLine(
                 p.Name + " -- Player #" + p.Handle + ", Ped #" + p.Character.Handle + ", Position: " +
                 p.Character.Position.X + " " + p.Character.Position.Y + " " + p.Character.Position.Z,
                 GTAFuncs.GetPlayerInvincible(p) ? Color.CadetBlue : ConsoleSettings.DefaultTextColor);
         }
     }
 }
Ejemplo n.º 2
0
        /// <summary>
        ///     Draw a specified entity
        /// </summary>
        /// <param name="e">The entity to draw</param>
        private void DrawEntity(Entity e)
        {
            if (!e.IsOnScreen || e.IsOccluded)
            {
                return;
            }

            var textScale = .25f;

            //Set text color
            var c = Color.FromArgb(150, Color.White);

            if (_selectedEntity != null && e.Equals(_selectedEntity))
            {
                c = Color.Red;
            }
            else
            {
                switch (GTAFuncs.GetEntityType(e))
                {
                case GTAFuncs.EntityType.Ped:
                    c = new Ped(e.Handle).IsPlayer
                            ? Color.FromArgb(150, Color.CornflowerBlue)
                            : Color.FromArgb(150, Color.Yellow);
                    break;

                case GTAFuncs.EntityType.Vehicle:
                    c = Color.FromArgb(150, Color.DeepPink);
                    break;

                case GTAFuncs.EntityType.Prop:
                    c = Color.FromArgb(150, Color.Green);
                    break;
                }
            }

            //Create entity info lines
            var lines = new List <string>();

            switch (GTAFuncs.GetEntityType(e))
            {
            case GTAFuncs.EntityType.Ped:
                Ped ped = new Ped(e.Handle);
                if (ped.IsPlayer)
                {
                    Player pl = GTAFuncs.GetPedPlayer(ped);
                    lines.Add(pl.Name);
                    lines.Add("Player #" + pl.Handle);
                    if (GTAFuncs.GetPlayerInvincible(pl))
                    {
                        lines.Add("INVINCIBLE");
                    }
                }
                lines.Add("Ped #" + ped.Handle);
                e = ped;
                break;

            case GTAFuncs.EntityType.Vehicle:
                Vehicle v = new Vehicle(e.Handle);
                lines.Add("Vehicle #" + v.Handle);
                lines.Add(v.FriendlyName);
                lines.Add(v.DisplayName);
                e = v;
                break;

            case GTAFuncs.EntityType.Prop:
                Prop prop = new Prop(e.Handle);
                lines.Add("Prop #" + prop.Handle);
                lines.Add("Model: " + prop.Model.Hash);
                e = prop;
                break;

            default:
                lines.Add("Entity #" + e.Handle);
                break;
            }

            Entities.Add(e.Handle, e);

            //Draw entity info
            var screenPos = GTAFuncs.WorldToScreen(e.Position);
            var contain   =
                new Rectangle(
                    new Point((int)screenPos.X,
                              (int)screenPos.Y + (GTAFuncs.GetEntityType(e) == GTAFuncs.EntityType.Ped && new Ped(e.Handle).IsInVehicle() ? lines.Count * -10 : 0)),
                    new Size(50, (lines.Count * 11) - 1));

            for (var i = 0; i < lines.Count; i++)
            {
                GTAFuncs.SetTextDropShadow(2, Color.FromArgb(255, 0, 0, 0));
                new UIText(lines[i], new Point(0, (i * 10)), textScale, Color.FromArgb(255, c), 0, true).Draw(
                    new Size(contain.Location));
                GTAFuncs.SetTextDropShadow(0, Color.Transparent);
            }

            EntityClickBoxes.Add(e, contain);
            DrawEntBox(e, c);
        }