コード例 #1
0
        //ヘリを生成して、市民を中に乗せる
        private void CreateHeli()
        {
            heli = GTA.World.CreateVehicle("MAVERICK",Player.Character.Position + new Vector3(0,0,100));
                if (Exists(heli))
                {
                    //ヘリ生成に成功したら

                    heli.MakeProofTo(false, true, true, true, true);
                    heli.EngineHealth = 3000;
                    heli.PetrolTankHealth = 3000;
                    if (Exists(driver)) { driver.NoLongerNeeded(); }
                    driver = heli.CreatePedOnSeat(VehicleSeat.Driver);
                    if (Exists(driver))
                    {
                        driver.Money = 500;
                        driver.Invincible = true;
                    }

                    if (Exists(p[0])) { p[0].NoLongerNeeded(); }
                    if (Exists(p[1])) { p[1].NoLongerNeeded(); }
                    if (Exists(p[2])) { p[2].NoLongerNeeded(); }

                    p[0] = heli.CreatePedOnSeat(VehicleSeat.LeftRear);
                    p[1] = heli.CreatePedOnSeat(VehicleSeat.RightFront);
                    p[2] = heli.CreatePedOnSeat(VehicleSeat.RightRear);
                    for (int i = 0; i < 3; i++)
                    {
                        if (Exists(p[i]))
                        {
                            p[i].MaxHealth = 500;
                            p[i].Health = 500;

                        }
                    }
                        Timer = 40 * 2;
                }
        }
コード例 #2
0
        private void Bombat_Tick(object sender, EventArgs e)
        {
            if (player.isInVehicle())
            {
                Vehicle pV = Player.Character.CurrentVehicle;
                LastV = pV;
                if (timer == 0 && flag == false)
                {

                    if (GetGamePad() && Share.POINTs-5>=0)
                    {
                        if (!player.isAlive)
                        {
                            Game.DisplayText("Nitro Start", 4000);
                            flag = true;
                            timer = 0;
                            if (!Share.NitroLimit)
                            {
                                Share.AddPoint(-5);
                            }
                        }
                        else
                        {
                            if (pV.EngineHealth > 0 && pV.PetrolTankHealth > 0)
                            {
                                Game.DisplayText("Nitro Start", 4000);
                                flag = true;
                                timer = 0;
                                if (!Share.NitroLimit)
                                {
                                    Share.AddPoint(-5);
                                }
                            }
                        }

                    }
                }

                if (flag == true)
                {
                    if (timer == 0)
                    {
                        pV.MakeProofTo(false, false,true, false, false);
                        bombflag = true;
                        //GTA.Native.Function.Call("ADD_EXPLOSION", pV.Position.X, pV.Position.Y, pV.Position.Z, 6, 10.0f, 30, 0, 0.5f);

                        GTA.World.AddExplosion(pV.Position,ExplosionType.Rocket, 0.0f, true, false, 0.5f);
                        pV.HazardLightsOn = true;

                        GTA.Native.Pointer LX = typeof(int);
                        GTA.Native.Pointer LY = typeof(int);
                        GTA.Native.Pointer RX = typeof(int);
                        GTA.Native.Pointer RY = typeof(int);
                        GTA.Native.Function.Call("GET_POSITION_OF_ANALOGUE_STICKS",0,LX,LY,RX,RY);
                        if (Math.Abs(LY) > 20 && Share.POINTs - 5 >= 0)
                        {
                          //  player.Money -= (int)(player.Money * 0.1);
                        }
                        if (Player.WantedLevel == 0)
                        {
                            pV.Rotation = new Vector3(pV.Rotation.X + (LY * 30) / 126, pV.Rotation.Y, pV.Rotation.Z);
                        }
                        if ((int)pV.EngineHealth*3 > rnd.Next(0, 1001) || !pV.isAlive)
                        {
                            if (Game.isGameKeyPressed(GameKey.Crouch))
                            {
                                if (Math.Abs(LY) > 20)
                                {
                                    pV.Speed -= 20.0f;
                                }
                                else
                                {
                                    pV.Speed -= 55.0f;
                                }
                            }
                            else
                            {
                                if (Math.Abs(LY) > 20)
                                {
                                    pV.Speed += 20.0f;
                                }
                                else
                                {
                                    pV.Speed += 55.0f;
                                }
                            }
                        }
                        else
                        {
                            pV.Speed += 5.0f;
                            pV.EngineHealth = 0.1f;
                        }
                    }
                    else if (timer == 3 * 10)
                    {
                        bombflag = false;

                    }
                    else if (timer == 10 * 10)
                    {
                        pV.HazardLightsOn = false;
                        flag = false;
                        timer = -1;
                        Game.DisplayText("Nitro OK", 4000);

                    }

                    if (bombflag == true)
                    {
                        if (pV.Speed <= 20.0f)
                        {
                            bombflag = false;
                        }
                        else
                        {
                            pV.MakeProofTo(false, false, false, false, false);
                            //    GTA.Native.Function.Call("ADD_EXPLOSION", pV.Position.X, pV.Position.Y, pV.Position.Z, 3, 0.0f, 30, 0, 0.1f);
                        }
                    }
                    else
                    {
                        pV.MakeProofTo(false, false, false, false, false);

                    }
                    timer++;
                    if (Share.NitroLimit) { timer = 100; }

                }
                else
                {
                    flag = false;
                    timer = 0;
                    if (Exists(LastV))
                    {
                        LastV.MakeProofTo(false, false, false, false, false);
                    }
                }
            }
            else
            {
                timer = 0;
                flag = false;
                if (Exists(LastV))
                {
                    LastV.MakeProofTo(false, false, false, false, false);
                }
            }
        }