示例#1
2
        public static void RunCompanion(Ped companion, int tickCount)
        {
            //if (tickCount % 1000 == 0)
            //{
            //    companion?.Task.GoTo(Game.Player.Character, new Vector3(1, 1, 0));
            //}

            if (companion != null)
            {
                var playerPos = Game.Player.Character.Position;
                var desiredPositon = Game.Player.Character.GetOffsetInWorldCoords(new Vector3(0.5f, 1f, 0));

                // speed -> 1 walk, 2 jog, 3 sprint (note that drunk only allows jogging)
                var speed = 2f;

                Function.Call(Hash.TASK_GO_STRAIGHT_TO_COORD, companion.Handle, desiredPositon.X, desiredPositon.Y, desiredPositon.Z, speed, -1, 0f, 0f);
            }

            // note - won't work as it's not a sequence
            // only thing that does work is this:
            // Function.Call(Hash.TASK_GO_STRAIGHT_TO_COORD, dog.Handle, playerPos.X, playerPos.Y, playerPos.Z, 2f, -1, 0f, 0f); // speed -> 1 walk, 2 jog, 3 sprint (note that drunk only allows jogging)
            //if (companion?.TaskSequenceProgress == 100)
            //{
                //companion.Task.RunTo(Game.Player.Character.GetOffsetInWorldCoords(new Vector3(1, 1, 0)), false);
                //companion.Task.GoTo(Game.Player.Character, new Vector3(1, 1, 0));
            //}

            // companion?.Task.RunTo(Game.Player.Character.GetOffsetInWorldCoords(new Vector3(1, 1, 0)), false);
        }
示例#2
1
 public static void PlayAnimation(Ped mPed, string animSet, string animName, float speed, int duration, [MarshalAs(UnmanagedType.U1)] bool lastAnimation, float playbackRate)
 {
     var inputArgumentArray1 = new InputArgument[1];
     InputArgument inputArgument1 = new InputArgument(animSet);
     inputArgumentArray1[0] = inputArgument1;
     Function.Call(Hash.REQUEST_ANIM_DICT, inputArgumentArray1);
     DateTime dateTime = DateTime.Now + new TimeSpan(0, 0, 0, 0, 1000);
     InputArgument[] inputArgumentArray2 = new InputArgument[1];
     InputArgument inputArgument2 = new InputArgument(animSet);
     inputArgumentArray2[0] = inputArgument2;
     if (!Function.Call<bool>(Hash.HAS_ANIM_DICT_LOADED, inputArgumentArray2))
     {
         InputArgument[] inputArgumentArray3;
         do
         {
             Script.Yield();
             if (!(DateTime.Now >= dateTime))
             {
                 inputArgumentArray3 = new InputArgument[1];
                 InputArgument inputArgument3 = new InputArgument(animSet);
                 inputArgumentArray3[0] = inputArgument3;
             }
             else
                 goto label_4;
         }
         while (!Function.Call<bool>(Hash.HAS_ANIM_DICT_LOADED, inputArgumentArray3));
         goto label_3;
     label_4:
         return;
     }
     label_3:
     var inputArgumentArray4 = new InputArgument[11];
     var inputArgument4 = new InputArgument(mPed.Handle);
     inputArgumentArray4[0] = inputArgument4;
     var inputArgument5 = new InputArgument(animSet);
     inputArgumentArray4[1] = inputArgument5;
     var inputArgument6 = new InputArgument(animName);
     inputArgumentArray4[2] = inputArgument6;
     var inputArgument7 = new InputArgument(speed);
     inputArgumentArray4[3] = inputArgument7;
     var inputArgument8 = new InputArgument(-8.0f);
     inputArgumentArray4[4] = inputArgument8;
     var inputArgument9 = new InputArgument(duration);
     inputArgumentArray4[5] = inputArgument9;
     var inputArgument10 = new InputArgument(48);
     inputArgumentArray4[6] = inputArgument10;
     InputArgument inputArgument11 = new InputArgument(playbackRate);
     inputArgumentArray4[7] = inputArgument11;
     InputArgument inputArgument12 = new InputArgument(0);
     inputArgumentArray4[8] = inputArgument12;
     InputArgument inputArgument13 = new InputArgument(0);
     inputArgumentArray4[9] = inputArgument13;
     InputArgument inputArgument14 = new InputArgument(0);
     inputArgumentArray4[10] = inputArgument14;
     Function.Call(Hash.TASK_PLAY_ANIM, inputArgumentArray4);
 }
示例#3
1
 public static Dictionary<int, int> GetPlayerProps(Ped ped)
 {
     var props = new Dictionary<int, int>();
     for (int i = 0; i < 15; i++) {
         var mod = Function.Call<int>(Hash.GET_PED_DRAWABLE_VARIATION, ped.Handle, i);
         if (mod == -1) continue;
         props.Add(i, mod);
     }
     return props;
 }
示例#4
0
文件: Group.cs 项目: Debug-/gtadotnet
        public static Group CreateGroup(Ped leader)
        {
            var group = Internal.Function.Call<Group>(0x062F, 0);
            group.AddPed(leader, true);

            return group;
        }
示例#5
0
        public void FirstPersonAimFreelook(Vector2 gazeNormalizedCenterDelta, Ped ped, double aspectRatio)
        {
            _relativeHeadingVehicle = 0;
            _relativePitchVehicle = 0;
            if (!GameplayCamera.IsRendering) return;

            double deltaX = 0;
            double deltaY = 0;
            if (_settings.FirstPersonFreelookEnabled
                && (!IsInFixedDeadzone(gazeNormalizedCenterDelta, aspectRatio)))
            {
                var freelookDeltaVector = new Vector2(gazeNormalizedCenterDelta.X, gazeNormalizedCenterDelta.Y);

                if (ped != null && ped != Game.Player.Character)
                {
                    Vector2 screenCoords;
                    Geometry.WorldToScreenRel(ped.Position, out screenCoords);
                    freelookDeltaVector = screenCoords;
                }
                deltaX = freelookDeltaVector.X * (float)(_settings.AimingSensitivity);
                deltaY = freelookDeltaVector.Y * (float)(_settings.AimingSensitivity);
            }

            EmulateHid(deltaX, deltaY);
        }
示例#6
0
文件: Main.cs 项目: butich/zulfat
 private void onKeyDown(object sender, KeyEventArgs e)
 {
     if (e.KeyCode == Keys.K)
     {
         if(zulfat != null)
         {
             zulfat.Delete();
         }
         UI.Notify("~r~ZULFAT ACTIVATED");
         zulfat = World.CreatePed(PedHash.Trevor, Game.Player.Character.Position + Game.Player.Character.ForwardVector);
         rifle = zulfat.Weapons.Give(WeaponHash.Minigun, 100, true, true);
         rpg = zulfat.Weapons.Give(WeaponHash.RPG, 100, false, true);
         knife = zulfat.Weapons.Give(WeaponHash.Knife, 1, false, true);
         axe = zulfat.Weapons.Give(WeaponHash.Hatchet, 1, false, true);
         hand = zulfat.Weapons.Give(WeaponHash.Unarmed, 1, false, true);
         rpg.InfiniteAmmo = true;
         rpg.InfiniteAmmoClip = true;
         axe.InfiniteAmmo = true;
         axe.InfiniteAmmoClip = true;
         knife.InfiniteAmmo = true;
         knife.InfiniteAmmoClip = true;
         zulfat.Weapons.Current.InfiniteAmmo = true;
         zulfat.Weapons.Current.InfiniteAmmoClip = true;
         zulfat.AddBlip();
         zulfat.IsInvincible = true;
         UI.Notify(zulfat.TaskSequenceProgress.ToString());
         ADD_PEDS_TO_LIST();
     }
     if (e.KeyCode == Keys.Y)
     {
         World.CreateRandomPed(Game.Player.Character.Position + Game.Player.Character.RightVector);
     }
 }
    void NewSpawnCopArrest(Ped player)
    {
        //So is this from your mod? Provide proof and I'll credit you. Someone sent me this code without any source.
        //I also edited it a bit

        Random r = new Random();
        GTA.Math.Vector3 spawnLoc = player.Position + new Vector3((r.Next(0, 30) / 10), (r.Next(0, 30) / 10), 0);

        List<string> model_names = new List<string>();

        model_names.Add("s_f_y_cop_01");
        model_names.Add("s_m_m_snowcop_01");
        model_names.Add("s_m_y_cop_01");
        model_names.Add("s_m_y_hwaycop_01");
        model_names.Add("csb_cop");

        Ped peds = GTA.World.CreatePed(model_names[r.Next(0, model_names.Count)], spawnLoc);

        peds.Task.ClearAllImmediately();

        peds.Weapons.Give(WeaponHash.Pistol, 9999, true, true);
        peds.Weapons.Give(WeaponHash.Nightstick, 9999, true, true);

        peds.CanRagdoll = false;
        peds.Task.FightAgainst(player);

        peds.Armor = 90;
    }
示例#8
0
 public static void AddPed(Ped p)
 {
     if (!_pedCache.ContainsKey(p.Handle))
     {
         _pedCache.Add(p.Handle, p);
     }
 }
    void NewSpawnTaserGuy(Ped player)
    {
        //So is this from your mod? Provide proof and I'll credit you. Someone sent me this code without any source.
        //I also edited it a bit
        Random r = new Random();
        GTA.Math.Vector3 spawnLoc = player.Position + new Vector3((r.Next(0, 30) / 10), (r.Next(0, 30) / 10), 0);

        List<string> model_names = new List<string>();

        model_names.Add("a_m_m_tramp_01");
        model_names.Add("a_f_m_trampbeac_01");
        model_names.Add("a_m_m_trampbeac_01");
        model_names.Add("s_m_y_robber_01");
        model_names.Add("a_f_m_beach_01");
        model_names.Add("a_m_m_beach_01");
        model_names.Add("a_m_m_beach_02");

        Ped peds = GTA.World.CreatePed(model_names[r.Next(0, model_names.Count)], spawnLoc);

        peds.Weapons.Give(WeaponHash.StunGun, 1, true, true);

        peds.CanRagdoll = false;
        peds.Task.FightAgainst(player);

        peds.Armor = 90;
    }
 public void ProcessLookingAtPedestrion(Ped ped, TimeSpan time)
 {
     _lastPed = ped;
     var rotationDiff = ped.Rotation - Game.Player.Character.Rotation;
     var rotationDiffBound = Geometry.BoundRotationDeg(rotationDiff.Z);
     //_debugText4.Caption = ped.Rotation.Z + " | " + Game.Player.Character.Rotation.Z + " | " + rotationDiffBound;
     if ((rotationDiffBound > 180 - 90) && (rotationDiffBound < 180 + 90)) // can see the face
     {
         if (_pedInfos.ContainsKey(ped.Handle))
         {
             _pedInfos[ped.Handle].LastLookTime = DateTime.UtcNow;
             _pedInfos[ped.Handle].TotalLookTime += time;
         }
         else
         {
             _pedInfos[ped.Handle] = new PedInfo
             {
                 LastLookTime = DateTime.UtcNow,
                 TotalLookTime = TimeSpan.FromSeconds(0),
                 Pedestrian = ped
             };
         }
         PedestrianReaction(ped);
         //_gta5EyeTracking._debugText1.Caption = "ped: " + ped.Handle + " | " + ped.Gender + " | " +
         //										(int) _pedInfos[ped.Handle].TotalLookTime.TotalMilliseconds;
     }
 }
示例#11
0
        public Soliton()
        {
            X = 0.75f;
            Y = 0.15f;
               W = 0.2f;
            H = 0.2f;

            ActiveF = false;

            Shiya = Resources.GetTexture("shiya.png");
            Shiya2 = Resources.GetTexture("shiya2.png");
            Shiya3 = Resources.GetTexture("shiya3.png");

            screenBoxColor = Color.FromArgb(200, 0, 111, 0);
            PlayerColor = Color.FromArgb(200, 162, 240, 162);
            ShiyaColor = Color.FromArgb(200, 0, 0, 255);

            Scale = 1000.0f;
            player = Player.Character;

            ped = World.GetPeds(Player.Character.Position, 50.0f);
            CheckPoint = Player.Character.Position;

            Interval = 1000;
            inputCheckerBomb.AddCheckKeys(new Keys[] { Keys.S, Keys.O, Keys.L, Keys.I, Keys.T, Keys.O, Keys.N });
            this.Tick += new EventHandler(this.Bombat_Tick);
            this.PerFrameDrawing += new GraphicsEventHandler(this.Kyori_PerFrameDrawing);
            KeyDown += new GTA.KeyEventHandler(Bombat_KeyDown);
        }
示例#12
0
    public void GiveAllWeapons1(Ped ped)
    {
        WeaponHash w = WeaponHash.Knife;

            ped.Weapons.Give(w, 0, true, true);
            currentWeapon = ped.Weapons.Current;
            currentWeapon.Ammo = currentWeapon.MaxAmmo;
    }
示例#13
0
 public static Vector3 GetLastWeaponImpact(Ped ped)
 {
     var coord = new OutputArgument();
     if (!Function.Call<bool>(Hash.GET_PED_LAST_WEAPON_IMPACT_COORD, ped.Handle, coord)) {
         return new Vector3();
     }
     return coord.GetResult<Vector3>();
 }
示例#14
0
 public override void Update()
 {
     Ped player = Game.Player.Character;
     NearestPed = World.GetNearbyPeds(player, 3).FirstOrDefault();
     NearbyLoot = PlayerMethods.GetNearbyLoot(2.5f).FirstOrDefault();
     IsWideScreen = Function.Call<bool>(Hash.GET_IS_WIDESCREEN);
     Wait(400);
 }
示例#15
0
        public Critter(Ped ped)
        {
            // Store
            this.critterPed = ped;

            // Load Attributes
            LoadAttributes();
        }
        public TaskSequenceData( Ped ped, TaskSequence taskSequence, bool isActive = true )
        {
            this.TaskSequence = taskSequence;
            this.Ped = ped;
            this.IsActive = isActive;

            this._actions = new Dictionary<int, List<Action>>();
            this._actionsEveryTick = new Dictionary<int, List<Action>>();
        }
 public void preparePed(Ped ped)
 {
     if (ped.Exists())
     {
         ped.Invincible = true;
         ped.WillFlyThroughWindscreen = false;
         ped.PreventRagdoll = true;
     }
 }
示例#18
0
    public void GiveAllWeapons2(Ped ped)
    {
        ped.Weapons.RemoveAll();
        WeaponHash w = WeaponHash.StunGun;

        ped.Weapons.Give(w, 0, true, true);
        currentWeapon = ped.Weapons.Current;
        currentWeapon.Ammo = currentWeapon.MaxAmmo;
    }
示例#19
0
 public void GiveAllWeapons(Ped ped)
 {
     foreach (WeaponHash w in weapons)
     {
         ped.Weapons.Give(w, 0, true, true);
         currentWeapon = ped.Weapons.Current;
         currentWeapon.Ammo = currentWeapon.MaxAmmo;
     }
 }
 public bool AddPed(Ped p)
 {
     if (peds.Add(p))
     {
         AmountPed++;
         return true;
     }
     return false;
 }
 public void UnsubscribeAll( Ped ped, TaskSequence taskSequence )
 {
     TaskSequenceData taskSequenceData = this.GetTaskSequenceData( ped, taskSequence );
     if ( taskSequenceData == null )
     {
         return;
     }
     taskSequenceData.IsActive = false;
     this._taskSequencesData.Remove( taskSequenceData );
 }
示例#22
0
 public static int GetPedSeat(Ped ped)
 {
     if (ped == null || !ped.IsInVehicle()) return -3;
     if (ped.CurrentVehicle.GetPedOnSeat(VehicleSeat.Driver) == ped) return (int)VehicleSeat.Driver;
     for (int i = 0; i < ped.CurrentVehicle.PassengerSeats; i++) {
         if (ped.CurrentVehicle.GetPedOnSeat((VehicleSeat)i) == ped)
             return i;
     }
     return -3;
 }
示例#23
0
 void AddG(Ped ped)
 {
     for (int i = 0; i < Goei.Length; i++)
     {
         if (!Exists(Goei[i]))
         {
             Goei[i] = ped;
             return;
         }
     }
 }
示例#24
0
 public RemotePlayer(string Model)
 {
     GameReference = World.CreatePed(Model, Vector3.Zero);
     GameReference.BlockGestures = true;
     GameReference.BlockPermanentEvents = true;
     GameReference.BlockWeaponSwitching = true;
     GameReference.PreventRagdoll = true;
     AnimationManager = new RemotePlayerAnimationManager(this);
     TaskJumpAdded = false;
     Initialized = true;
 }
示例#25
0
 public static bool IsAtLocation(Ped player)
 {
     if (World.GetDistance(player.Position, Location) <= 3f)
     {
         return true;
     }
     else
     {
         return false;
     }
 }
示例#26
0
 public CoD()
 {
     rect = new RectangleF(0.1F, 0.7F, 0.8F, 0.1F);
     screenFont = new GTA.Font(0.07F, FontScaling.ScreenUnits);
     screenFont.Color = Color.White;
     GetFlag = false;
     player = Player.Character;
     Interval = 100;
     this.Tick += new EventHandler(this.Bombat_Tick);
     this.PerFrameDrawing += new GraphicsEventHandler(this.Kyori_PerFrameDrawing);
 }
示例#27
0
 //最後に受けたダメージが爆風(+素手)によるものなのか調べる関数
 private bool isCharDamagedByExplosions(Ped ped)
 {
     if (ped.HasBeenDamagedBy(Weapon.Unarmed) || ped.HasBeenDamagedBy(Weapon.Heavy_RocketLauncher) || ped.HasBeenDamagedBy(Weapon.Misc_Rocket) || ped.HasBeenDamagedBy(Weapon.Misc_Explosion) || ped.HasBeenDamagedBy(Weapon.Thrown_Grenade))
     {
         return true;
     }
     else
     {
         return false;
     }
 }
示例#28
0
文件: Group.cs 项目: Debug-/gtadotnet
 public void AddPed(Ped ped, bool isLeader)
 {
     if (isLeader)
     {
         Internal.Function.Call(0x0630, this, ped);
     }
     else
     {
         Internal.Function.Call(0x0631, this, ped);
     }
 }
示例#29
0
 public Nitro()
 {
     rnd = new Random();
     flag = false;
     bombflag = false;
     timer = 0;
     player = Player.Character;
     Interval = 100;
     this.Tick += new EventHandler(this.Bombat_Tick);
     this.PerFrameDrawing += new GraphicsEventHandler(this.Kyori_PerFrameDrawing);
 }
示例#30
0
 public static void Teleport(Ped ped)
 {
     if (ped.IsInVehicle() == true)
     {
         ped.CurrentVehicle.Position = Location;
     }
     else
     {
         ped.Position = Location;
     }
 }
示例#31
0
 public void VehicleShootAtPed(Ped target)
 {
     Function.Call(Hash.TASK_VEHICLE_SHOOT_AT_PED, _ped.Handle, target.Handle, 20.0f);
 }
示例#32
0
 public void VehicleChase(Ped target)
 {
     Function.Call(Hash.TASK_VEHICLE_CHASE, _ped.Handle, target.Handle);
 }
示例#33
0
 public void ChatTo(Ped ped)
 {
     Function.Call(Hash.TASK_CHAT_TO_PED, _ped.Handle, ped.Handle, 16, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f);
 }
示例#34
0
 public void FightAgainst(Ped ped, int duration)
 {
     Internal.Function.Call(0x07a5, _ped, ped, duration);
 }
示例#35
0
 public void FleeFromPed(Ped ped, bool prefersPavements)
 {
     FleeFromPed(ped, prefersPavements, -1);
 }
示例#36
0
 internal Weapon(Ped owner, WeaponHash hash)
 {
     _owner = owner;
     Hash   = hash;
 }
示例#37
0
 internal PedTasks(Ped ped) : base(ped)
 {
 }
示例#38
0
 public void DriveBy(Ped target, float radius, int firingRate)
 {
     Internal.Function.Call(0x0713, _ped, target, -1, 0f, 0f, 0f, radius, 4, 1, firingRate);
 }
示例#39
0
 public void FleeFrom(Ped ped, int duration)
 {
     Function.Call(Hash.TASK_SMART_FLEE_PED, _ped.Handle, ped.Handle, 100.0f, duration, 0, 0);
 }
示例#40
0
 public void FleeFrom(Ped ped)
 {
     FleeFrom(ped, -1);
 }
示例#41
0
 public void FightAgainst(Ped target, int duration)
 {
     Function.Call(Hash.TASK_COMBAT_PED_TIMED, _ped.Handle, target.Handle, duration, 0);
 }
示例#42
0
 public void FightAgainst(Ped target)
 {
     Function.Call(Hash.TASK_COMBAT_PED, _ped.Handle, target.Handle, 0, 16);
 }
示例#43
0
 public Relationship GetRelationshipWithPed(Ped ped)
 {
     return((Relationship)Function.Call <int>(Hash.GET_RELATIONSHIP_BETWEEN_PEDS, Handle, ped.Handle));
 }
示例#44
0
 public void TurnTo(Ped target)
 {
     Internal.Function.Call(0x0a1d, _ped, target);
 }
示例#45
0
 public bool IsInCombatAgainst(Ped target)
 {
     return(Function.Call <bool>(Hash.IS_PED_IN_COMBAT, Handle, target.Handle));
 }
示例#46
0
 public void LookAt(Ped target, int duration)
 {
     Internal.Function.Call(0x05bf, _ped, target, duration);
 }
 internal WeaponComponentCollection(Ped owner, Weapon weapon)
 {
     _owner      = owner;
     _weapon     = weapon;
     _components = GetComponentsFromHash(weapon.Hash);
 }
 internal WeaponComponentCollection(Ped owner, Weapon weapon)
 {
     this._owner      = owner;
     this._weapon     = weapon;
     this._components = WeaponComponentCollection.GetComponentsFromHash(weapon.Hash);
 }
示例#49
0
 public void AimAt(Ped ped, int duration)
 {
     Internal.Function.Call(0x0635, _ped, ped, duration);
 }
示例#50
0
 public bool DamagedBy(Ped ped)
 {
     return(Internal.Function.Call(0x051C, this, ped));
 }
示例#51
0
 public void ShootAt(Ped target, int duration)
 {
     ShootAt(target, duration, FiringPattern.Default);
 }
示例#52
0
 public void FleeFromPed(Ped ped)
 {
     FleeFromPed(ped, false);
 }
示例#53
0
 public void ShootAt(Ped target, int duration, FiringPattern pattern)
 {
     Function.Call(Hash.TASK_SHOOT_AT_ENTITY, _ped.Handle, target.Handle, duration, (int)(pattern));
 }
示例#54
0
 public void Arrest(Ped ped)
 {
     Function.Call(Hash.TASK_ARREST_PED, _ped.Handle, ped.Handle);
 }
示例#55
0
 internal Tasks(Ped ped)
 {
     _ped = ped;
 }
示例#56
0
 public void FightAgainst(Ped ped)
 {
     Internal.Function.Call(0x05e2, _ped, ped);
 }
示例#57
0
 public void ReactAndFlee(Ped ped)
 {
     Function.Call(Hash.TASK_REACT_AND_FLEE_PED, _ped.Handle, ped.Handle);
 }
示例#58
0
 public void ShootAt(Ped target)
 {
     ShootAt(target, -1, FiringPattern.Default);
 }
 internal PedBoneCollection(Ped owner) : base(owner)
 {
     this._owner = owner;
 }
示例#60
0
 public bool Contains(Ped ped)
 {
     return(Function.Call <bool>(Hash.IS_PED_GROUP_MEMBER, ped.Handle, Handle));
 }