using System;
using System.Collections.Generic;
using System.Text;
using System.Windows.Forms;
using GTA;

namespace TestScriptCS
{
   public class Wanzer : Script
   {
       const double TO_RADIAN = 0.017453292519943295;

       Blip zn_blip;
       Ped[] pd1;
       Ped pilot_char;
       GTA.Object zn_rock = null;
       GTA.Object zn_armup_l = null;
       GTA.Object zn_armup_r = null;
       GTA.Object zn_legup_l = null;
       GTA.Object zn_legup_r = null;
       GTA.Object zn_foot_l = null;
       GTA.Object zn_foot_r = null;
       GTA.Object zn_body01 = null;
       GTA.Object zn_body02 = null;
       GTA.Vehicle zn_core = null;
       GTA.Native.Pointer bullet_x = new GTA.Native.Pointer(typeof(float));
       GTA.Native.Pointer bullet_y = new GTA.Native.Pointer(typeof(float));
       GTA.Native.Pointer bullet_z = new GTA.Native.Pointer(typeof(float));
       GTA.Native.Pointer bullet_x2 = new GTA.Native.Pointer(typeof(float));
       GTA.Native.Pointer bullet_y2 = new GTA.Native.Pointer(typeof(float));
       GTA.Native.Pointer bullet_z2 = new GTA.Native.Pointer(typeof(float));
       GTA.Native.Pointer bullet_x3 = new GTA.Native.Pointer(typeof(float));
       GTA.Native.Pointer bullet_y3 = new GTA.Native.Pointer(typeof(float));
       GTA.Native.Pointer bullet_z3 = new GTA.Native.Pointer(typeof(float));
       GTA.Native.Pointer bullet_x4 = new GTA.Native.Pointer(typeof(float));
       GTA.Native.Pointer bullet_y4 = new GTA.Native.Pointer(typeof(float));
       GTA.Native.Pointer bullet_z4 = new GTA.Native.Pointer(typeof(float));
       GTA.Native.Pointer rock_angle = new GTA.Native.Pointer(typeof(float));
       int auto_attack = 0;
       int auto_pilot_flg = 0;
       int pd1_cnt = 0;
       int robot_flg = 1;
       int chakuchi_flg = 1;
       int weapon_num = 2;
       int rock_num = 0;
       int DASH_flg = 0;
       int WALK_flg = 0;
       int angl_body01_cnt = 0;
       int fire_timer = 0;
       int wep_timer = 0;
       int jump_timer = 0;
       int arm_timer = 0;
       float bullet_range_r = 0.0f;
       float bullet_range_l = 0.0f;
       float pos_body = 1.5f;
       float pos_leg = 1.1f;
       float pos_armup_r = 0.0f;
       float pos_armup_l = 0.0f;
       float pos_body01 = 0.0f;
       float angl_body01 = 135.02f;
       float angl_body01_b = 0.0f;
       float angl_body02 = 0.0f;
       float angl_armup_r = 0.4f;
       float angl_armup_l = 0.4f;
       float angl_armup_r_b = 0.0f;
       float angl_armup_l_b = 0.0f;
       float angl_armup_r_c = -1.55f;
       float angl_armup_l_c = -1.55f;
       float angl_legup_r_a = 0.0f;
       float angl_legup_l_a = 0.0f;
       float angl_legup_r_b = 0.0f;
       float angl_legup_l_b = 0.0f;
       float angl_foot_r_a = 0.0f;
       float angl_foot_l_a = 0.0f;
       float angl_foot_r_b = 0.0f;
       float angl_foot_l_b = 0.0f;
       float angle = 0.0f;
       float speed = 0.0f;
       float x99 = 0.0f;
       float y99 = 0.0f;
       float z99 = 0.0f;
       Vector3 Destination;

       Random cRandom = new System.Random();
       public Wanzer()
      {
          Wait(0);
          this.Tick += new EventHandler(this.Wanzer_Tick);

          
          

          while (!GTA.Native.Function.Call<bool>("IS_PLAYER_PLAYING", Player))
          {
              Wait(0);
          }
          Game.DisplayText("Step 1 SUCCESS", 5000);
          Wait(2000);


          pilot_char = World.CreatePed("M_Y_BOUNCER_02", Player.Character.Position.Around(50.0F));
          Wait(1000);
          while (!GTA.Native.Function.Call<bool>("DOES_CHAR_EXIST", pilot_char))
          {
              Wait(0);
          }
          pilot_char.Delete();
          Game.DisplayText("Step 2 SUCCESS", 5000);


          zn_armup_l = World.CreateObject("GB_candlestik01", Player.Character.Position.Around(100.5F));
          Wait(200);
          zn_armup_r = World.CreateObject("GB_comb01", Player.Character.Position.Around(100.5F));
          Wait(300);
          zn_foot_l = World.CreateObject("GB_hairdry02", Player.Character.Position.Around(100.5F));
          Wait(400);
          zn_foot_r = World.CreateObject("GB_hairdry02", Player.Character.Position.Around(100.5F));
          Wait(500);
          zn_legup_l = World.CreateObject("GB_cycler01", Player.Character.Position.Around(100.5F));
          Wait(600);
          zn_legup_r = World.CreateObject("GB_dumbbells", Player.Character.Position.Around(100.5F));
          Wait(1500);

          while (!GTA.Native.Function.Call<bool>("DOES_OBJECT_EXIST", zn_armup_l)
             || !GTA.Native.Function.Call<bool>("DOES_OBJECT_EXIST", zn_armup_r)
             || !GTA.Native.Function.Call<bool>("DOES_OBJECT_EXIST", zn_legup_l)
             || !GTA.Native.Function.Call<bool>("DOES_OBJECT_EXIST", zn_legup_r)
             || !GTA.Native.Function.Call<bool>("DOES_OBJECT_EXIST", zn_foot_l)
             || !GTA.Native.Function.Call<bool>("DOES_OBJECT_EXIST", zn_foot_r))
          {
              Wait(0);
          }
          Wait(100);
          Game.DisplayText("Step 3 SUCCESS", 5000);

          zn_body01 = World.CreateObject("GB_MAKEUPbag01", Player.Character.Position.Around(100.5F));
          Wait(300);
          zn_body02 = World.CreateObject("GB_abductor", Player.Character.Position.Around(100.5F));
          Wait(1000);

          while (!GTA.Native.Function.Call<bool>("DOES_OBJECT_EXIST", zn_body01)
             || !GTA.Native.Function.Call<bool>("DOES_OBJECT_EXIST", zn_body02))
          {
              Wait(0);
          }
          Game.DisplayText("Step 4 SUCCESS", 5000);

          Wait(200);
          zn_core = World.CreateVehicle("Patriot", Player.Character.Position.Around(100.5F)); //Patrio
          Wait(1000);

          while (!GTA.Native.Function.Call<bool>("DOES_VEHICLE_EXIST", zn_core))
          {
              Wait(0);
          }

          Game.DisplayText("Step 5 SUCCESS", 5000);

          zn_blip = GTA.Blip.AddBlip(zn_core);
          zn_blip.Name = "WANZER";
          Wait(200);


           zn_armup_l.Delete();
           zn_armup_r.Delete();
           zn_legup_l.Delete();
           zn_legup_r.Delete();
           zn_foot_l.Delete();
           zn_foot_r.Delete();
           zn_body01.Delete();
           zn_body02.Delete();
           zn_core.Delete();
           //pd1.Delete();

           zn_rock = World.CreateObject("cj_rpg_rocket", Player.Character.Position.Around(100.5F));
           Wait(1000);
           while (!GTA.Native.Function.Call<bool>("DOES_OBJECT_EXIST", zn_rock))
           {
               Wait(0);
           }
           zn_rock.Delete();
           Game.DisplayText("wanzer.cs LOAD SUCCESS", 5000);
      }

       #region main
       private void Wanzer_Tick(object sender, EventArgs e)
      {
          Wait(0);

          //if (Game.isGameKeyPressed(GTA.GameKey.RadarZoom))

          if (GTA.Native.Function.Call<bool>("IS_CHAR_IN_AREA_3D", Player.Character, 544.597f, 1335.141f, -5.89f, 644.597f, 1435.141f, 150.89f)
              || GTA.Native.Function.Call<bool>("IS_CHAR_IN_AREA_3D", Player.Character, 850.353f, -558.049f, -35.006f, 950.353f, -458.049f, 60.006f)
              || GTA.Native.Function.Call<bool>("IS_CHAR_IN_AREA_3D", Player.Character, -471.959f, 1437.988f, -50.606f, -371.959f, 1537.988f, 68.606f)
              || GTA.Native.Function.Call<bool>("IS_CHAR_IN_AREA_3D", Player.Character, 63.209f, 788.872f, -40.476f, 163.209f, 888.872f, 64.476f)
              || GTA.Native.Function.Call<bool>("IS_CHAR_IN_AREA_3D", Player.Character, -1007.202f, 845.272f, -40.424f, -907.202f, 945.272f, 63.424f)

              || GTA.Native.Function.Call<bool>("IS_CHAR_IN_AREA_3D", Player.Character, -1777.169f, 313.704f, 0.191, -1677.169f, 413.704f, 100.191f)
              || GTA.Native.Function.Call<bool>("IS_CHAR_IN_AREA_3D", Player.Character, -2041.986f, -128.879f, -20.423f, -1841.986f, -28.879f, 100.423f)

              || GTA.Native.Function.Call<bool>("IS_CHAR_IN_AREA_3D", Player.Character, -489.024f, 1331.316f, 0.741f, -389.024f, 1431.316f, 60.741f)
              )
          {
              if (!GTA.Native.Function.Call<bool>("DOES_VEHICLE_EXIST", zn_core) ||
                  GTA.Native.Function.Call<bool>("IS_CAR_DEAD", zn_core))
              {
                  Wanzer_Make();
                  
              }
          }
          if (Game.isKeyPressed(System.Windows.Forms.Keys.R))
          {
              robot_flg = 1;
          }
          if (Game.isKeyPressed(System.Windows.Forms.Keys.O) && robot_flg == 1)
          {
              robot_flg = 2;
          }
          if (Game.isKeyPressed(System.Windows.Forms.Keys.B) && robot_flg == 2)
          {
              robot_flg = 3;
          }
          if (Game.isKeyPressed(System.Windows.Forms.Keys.O) && robot_flg == 3)
          {
              robot_flg = 4;
          }
          if (Game.isKeyPressed(System.Windows.Forms.Keys.T) && robot_flg == 4)
          {
              robot_flg = 5;
          }
          if (robot_flg == 5)
          {
              //if (!GTA.Native.Function.Call<bool>("DOES_VEHICLE_EXIST", zn_core) ||
                //  GTA.Native.Function.Call<bool>("IS_CAR_DEAD", zn_core))
              //{
                  Wanzer_Make();
              //}
              robot_flg = 0;
              GTA.Native.Pointer x = new GTA.Native.Pointer(typeof(float));
              GTA.Native.Pointer y = new GTA.Native.Pointer(typeof(float));
              GTA.Native.Pointer z = new GTA.Native.Pointer(typeof(float));
              GTA.Native.Function.Call("GET_OFFSET_FROM_CHAR_IN_WORLD_COORDS", Player.Character, 0.0f, 4.0f, 0.0f, x, y, z);
              GTA.Native.Function.Call("SET_CAR_COORDINATES", zn_core, x.ToInputParameter(), y.ToInputParameter(), z.ToInputParameter());
              GTA.Native.Pointer angle = new GTA.Native.Pointer(typeof(float));
              GTA.Native.Function.Call("GET_CHAR_HEADING", Player.Character, angle);
              angle += 180.0f;
              GTA.Native.Function.Call("SET_CAR_HEADING", zn_core, angle.ToInputParameter());
          }
          

          while (GTA.Native.Function.Call<bool>("DOES_VEHICLE_EXIST", zn_core) && !GTA.Native.Function.Call<bool>("IS_CAR_DEAD", zn_core))
          {
              Wait(0);

              GTA.Native.Function.Call("SET_CAR_VISIBLE", zn_core, 0);
              GTA.Native.Function.Call("SET_CAR_STRONG", zn_core, 1);
              GTA.Native.Function.Call("SET_CAR_PROOFS", zn_core, 1, 1, 1, 1, 1);
              GTA.Native.Function.Call("LOCK_CAR_DOORS", zn_core, 2);
              GTA.Native.Function.Call("MARK_CAR_AS_CONVOY_CAR", zn_core, 1);

              GTA.Native.Pointer x = new GTA.Native.Pointer(typeof(float));
              GTA.Native.Pointer y = new GTA.Native.Pointer(typeof(float));
              GTA.Native.Pointer z = new GTA.Native.Pointer(typeof(float));
              GTA.Native.Pointer x2 = new GTA.Native.Pointer(typeof(float));
              GTA.Native.Pointer y2 = new GTA.Native.Pointer(typeof(float));
              GTA.Native.Pointer z2 = new GTA.Native.Pointer(typeof(float));
              GTA.Native.Function.Call("GET_OFFSET_FROM_CHAR_IN_WORLD_COORDS", Player.Character, -4.0f, 0.0f, -4.0f, x, y, z);
              GTA.Native.Function.Call("GET_OFFSET_FROM_CHAR_IN_WORLD_COORDS", Player.Character, 4.0f, 4.0f, 4.0f, x2, y2, z2);

              if (pos_body > 1.2f)
              {
                  pos_body -= 0.03f;
              }
              if (pos_leg > 1.1f)
              {
                  pos_leg -= 0.03f;
              }

              pos_armup_r = 0.0f;
              pos_armup_l = 0.0f;
              angl_body01 = 135.02f;
              angl_body01_b = 0.3f;
              angl_body02 = 0.3f;
              if (angl_armup_r > 0.42f)
              {
                  angl_armup_r -= 0.03f;
              }
              else if (angl_armup_r < 0.38f)
              {
                  angl_armup_r += 0.03f;
              }
              if (angl_armup_l > 0.42f)
              {
                  angl_armup_l -= 0.03f;
              }
              else if (angl_armup_l < 0.38f)
              {
                  angl_armup_l += 0.03f;
              }

              angl_armup_r_b = 0.0f;
              angl_armup_l_b = 0.0f;
              angl_armup_r_c = -1.55f;
              angl_armup_l_c = -1.55f;

              if (angl_legup_r_a < 0.7f)
              {
                  angl_legup_r_a += 0.03f;
              }
              if (angl_legup_l_a > -0.7f)
              {
                  angl_legup_l_a -= 0.03f;
              }
              angl_legup_r_b = 0.0f;
              angl_legup_l_b = 0.0f;
              if (angl_foot_r_a > -0.7f)
              {
                  angl_foot_r_a -= 0.03f;
              }
              if (angl_foot_l_a < 0.7f)
              {
                  angl_foot_l_a += 0.03f;
              }
              angl_foot_r_b = 0.0f;
              angl_foot_l_b = 0.0f;

              GTA.Native.Function.Call("ATTACH_OBJECT_TO_OBJECT", zn_armup_l, zn_body01, 0, 1.1f, pos_armup_l, 0.6f, angl_armup_l_b, angl_armup_l, angl_armup_l_c);  //o x x
              GTA.Native.Function.Call("ATTACH_OBJECT_TO_OBJECT", zn_armup_r, zn_body01, 0, -1.1f, pos_armup_r, 0.6f, angl_armup_r_b, angl_armup_r, angl_armup_r_c); //o x x
              GTA.Native.Function.Call("ATTACH_OBJECT_TO_CAR", zn_legup_l, zn_core, 0, -0.7f, 0.0f, 0.8f, angl_legup_l_a, angl_legup_l_b, 135.02f);  //o x x
              GTA.Native.Function.Call("ATTACH_OBJECT_TO_CAR", zn_legup_r, zn_core, 0, 0.7f, 0.0f, 0.8f, angl_legup_r_a, angl_legup_r_b, 135.02f); //o x x
              GTA.Native.Function.Call("ATTACH_OBJECT_TO_OBJECT", zn_foot_l, zn_legup_l, 0, 0.0f, 0.0f, -1.5f, angl_foot_l_a, angl_foot_l_b, 0.1f);  //o x x
              GTA.Native.Function.Call("ATTACH_OBJECT_TO_OBJECT", zn_foot_r, zn_legup_r, 0, 0.0f, 0.0f, -1.5f, angl_foot_r_a, angl_foot_r_b, -0.1f); //o x x
              GTA.Native.Function.Call("ATTACH_OBJECT_TO_CAR", zn_body02, zn_core, 0, 0.0f, 0.0f, 1.2f, angl_body02, 0.0f, 135.02f);
              GTA.Native.Function.Call("ATTACH_OBJECT_TO_CAR", zn_body01, zn_core, 0, 0.0f, pos_body01, pos_body, angl_body01_b, 0.0f, angl_body01);

              if (Game.isGameKeyPressed(GTA.GameKey.EnterCar) && auto_pilot_flg == 0
                  && GTA.Native.Function.Call<bool>("IS_CAR_IN_AREA_3D", zn_core, x.ToInputParameter(), y.ToInputParameter(), z.ToInputParameter(), x2.ToInputParameter(), y2.ToInputParameter(), z2.ToInputParameter()))
              {
                  //GTA.Blip.Delete(zn_blip);
                  GTA.Native.Function.Call("WARP_CHAR_INTO_CAR", Player.Character, zn_core);
                  Wait(500);
              }



              if (Game.isKeyPressed(System.Windows.Forms.Keys.R))
              {
                  robot_flg = 1;
              }
              if (Game.isKeyPressed(System.Windows.Forms.Keys.O) && robot_flg == 1)
              {
                  robot_flg = 2;
              }
              if (Game.isKeyPressed(System.Windows.Forms.Keys.B) && robot_flg == 2)
              {
                  robot_flg = 3;
              }
              if (Game.isKeyPressed(System.Windows.Forms.Keys.O) && robot_flg == 3)
              {
                  robot_flg = 4;
              }
              if (Game.isKeyPressed(System.Windows.Forms.Keys.T) && robot_flg == 4)
              {
                  robot_flg = 5;
              }
              if (robot_flg == 5)
              {
                  //if (!GTA.Native.Function.Call<bool>("DOES_VEHICLE_EXIST", zn_core) ||
                  //  GTA.Native.Function.Call<bool>("IS_CAR_DEAD", zn_core))
                  //{
                  Wanzer_Make();
                  //}
                  robot_flg = 0;
                  GTA.Native.Function.Call("GET_OFFSET_FROM_CHAR_IN_WORLD_COORDS", Player.Character, 0.0f, 4.0f, 0.0f, x, y, z);
                  GTA.Native.Function.Call("SET_CAR_COORDINATES", zn_core, x.ToInputParameter(), y.ToInputParameter(), z.ToInputParameter());
                  GTA.Native.Pointer angle = new GTA.Native.Pointer(typeof(float));
                  GTA.Native.Function.Call("GET_CHAR_HEADING", Player.Character, angle);
                  angle += 180.0f;
                  GTA.Native.Function.Call("SET_CAR_HEADING", zn_core, angle.ToInputParameter());
              }

              if (Game.isGameKeyPressed(GTA.GameKey.Reload) && Game.isGameKeyPressed(GTA.GameKey.Sprint) && auto_pilot_flg == 0
                  || Game.isKeyPressed(System.Windows.Forms.Keys.LMenu) && auto_pilot_flg == 0)
              {
                  SetDestination();
                  //DASH_flg = 0;
                  //WALK_flg = 0;
                  pilot_char = World.CreatePed("M_Y_BOUNCER_02", Player.Character.Position.Around(50.0F));
                  Wait(500);
                  GTA.Native.Function.Call("WARP_CHAR_INTO_CAR", pilot_char, zn_core);
                  pilot_char.BlockPermanentEvents = true;
                  pilot_char.Task.ClearAll();
                  pilot_char.Task.AlwaysKeepTask = true;
                  auto_pilot_flg = 1;
                  Blip w = Game.GetWaypoint();
                  int follow_cnt = 0;
                  auto_attack = 0;
                  GTA.Native.Function.Call("TASK_USE_MOBILE_PHONE_TIMED", Player.Character, 500);
                  if (w == null)
                  {
                      Game.DisplayText("BODYGUARD MODE", 5000);
                  }
                  else
                  {
                      Game.DisplayText("AUTO DRIVE ON", 5000);
                      pilot_char.Task.DriveTo(zn_core, Destination, 30.0f, false);
                  }
                  GTA.Native.Function.Call("SET_CHAR_VISIBLE", pilot_char, 0);
                  GTA.Native.Function.Call("SET_CHAR_INVINCIBLE", pilot_char, 1);

                  GTA.Native.Function.Call("SET_CAR_VISIBLE", zn_core, 0);
                  GTA.Native.Function.Call("SET_CAR_STRONG", zn_core, 1);
                  GTA.Native.Function.Call("SET_CAR_PROOFS", zn_core, 1, 1, 1, 1, 1);
                  GTA.Native.Function.Call("LOCK_CAR_DOORS", zn_core, 2);
                  GTA.Native.Function.Call("MARK_CAR_AS_CONVOY_CAR", zn_core, 1);
                  Wait(800);
                  
                  while (GTA.Native.Function.Call<bool>("DOES_VEHICLE_EXIST", zn_core) && !GTA.Native.Function.Call<bool>("IS_CAR_DEAD", zn_core) && auto_pilot_flg == 1)
                  {


                      GTA.Native.Pointer speed = new GTA.Native.Pointer(typeof(float));
                      GTA.Native.Pointer angle = new GTA.Native.Pointer(typeof(float));
                      GTA.Native.Function.Call("GET_CAR_SPEED", zn_core, speed);
                      Wait(0);
                      GTA.Native.Function.Call("SET_CHAR_VISIBLE", pilot_char, 0);
                      GTA.Native.Function.Call("SET_CHAR_INVINCIBLE", pilot_char, 1);

                      GTA.Native.Function.Call("SET_CAR_VISIBLE", zn_core, 0);
                      GTA.Native.Function.Call("SET_CAR_STRONG", zn_core, 1);
                      GTA.Native.Function.Call("SET_CAR_PROOFS", zn_core, 1, 1, 1, 1, 1);
                      GTA.Native.Function.Call("LOCK_CAR_DOORS", zn_core, 2);
                      GTA.Native.Function.Call("MARK_CAR_AS_CONVOY_CAR", zn_core, 1);

                      if (wep_timer >= 1)
                      {
                          wep_timer += 1;
                          if (wep_timer >= 50)
                          {
                              wep_timer = 0;
                          }
                      }
                      if (Game.isGameKeyPressed(GTA.GameKey.Reload) && Game.isGameKeyPressed(GTA.GameKey.Sprint) && Game.isGameKeyPressed(GTA.GameKey.Attack) && auto_attack == 0
                          || Game.isKeyPressed(System.Windows.Forms.Keys.LMenu) && Game.isGameKeyPressed(GTA.GameKey.Attack) && auto_attack == 0)
                      {
                          GTA.Native.Function.Call("TASK_USE_MOBILE_PHONE_TIMED", Player.Character, 500);
                          Wait(500);
                          auto_attack = 600;
                          if (wep_timer == 0)
                          {
                              wep_timer = 1;
                              weapon_num += 1;
                              if (weapon_num > 3)
                              {
                                  weapon_num = 0;
                              }
                              if (weapon_num == 0)
                              {
                                  zn_rock.Delete();
                                  fire_timer = 0;
                                  wep_timer = 100;
                                  Game.DisplayText("Right Arm Weapon", 3000);
                              }
                              if (weapon_num == 1)
                              {
                                  zn_rock.Delete();
                                  fire_timer = 0;
                                  wep_timer = 100;
                                  Game.DisplayText("Left Arm Weapon", 3000);
                              }
                              if (weapon_num == 2)
                              {
                                  zn_rock.Delete();
                                  fire_timer = 0;
                                  wep_timer = 100;
                                  Game.DisplayText("Double Arm Weapons", 3000);
                              }
                              if (weapon_num == 3)
                              {
                                  zn_rock.Delete();
                                  fire_timer = 0;
                                  wep_timer = 100;
                                  Game.DisplayText("Rocket Launcher", 3000);
                              }
                          }

                      }
                      if (Game.isGameKeyPressed(GTA.GameKey.Reload) && Game.isGameKeyPressed(GTA.GameKey.Sprint) && Game.isGameKeyPressed(GTA.GameKey.Attack) && auto_attack > 0
                          || Game.isKeyPressed(System.Windows.Forms.Keys.LMenu) && Game.isGameKeyPressed(GTA.GameKey.Attack) && auto_attack > 0)
                      {
                          GTA.Native.Function.Call("TASK_USE_MOBILE_PHONE_TIMED", Player.Character, 500);
                          Game.DisplayText("STOP ATTACK MODE", 3000);
                          auto_attack = 0;
                          zn_rock.Delete();
                          fire_timer = 0;
                          wep_timer = 100;
                          Wait(500);
                      }
                      if (auto_attack > 50 || GTA.Native.Function.Call<bool>("DOES_OBJECT_EXIST", zn_rock))
                      {
                          //auto_attack -= 1;
                          if (zn_core.Position.DistanceTo2D(Player.Character.Position) < 60.0f)
                          {
                              if (!GTA.Native.Function.Call<bool>("IS_CHAR_ON_FOOT", Player.Character))
                              {
                                  GTA.Native.Pointer player_car = new GTA.Native.Pointer(typeof(Vehicle));
                                  GTA.Native.Function.Call("GET_CAR_CHAR_IS_USING", Player.Character, player_car);
                                  GTA.Native.Function.Call("SET_CAR_PROOFS", player_car.ToInputParameter(), 1, 1, 1, 1, 1);
                              }
                              GTA.Native.Function.Call("SET_PLAYER_INVINCIBLE", Player, 1);
                              Wanzer_Aim();
                              Wanzer_GUN_FIRE();
                          }
                          if (GTA.Native.Function.Call<bool>("DOES_OBJECT_EXIST", zn_rock))
                          {
                              Wanzer_Aim();
                          }
                      }

                      if (auto_attack < 51 && auto_attack > 0)
                      {
                          auto_attack -= 1;
                          if (auto_attack == 0)
                          {
                              if (!GTA.Native.Function.Call<bool>("IS_CHAR_ON_FOOT", Player.Character))
                              {
                                  GTA.Native.Pointer player_car = new GTA.Native.Pointer(typeof(Vehicle));
                                  GTA.Native.Function.Call("GET_CAR_CHAR_IS_USING", Player.Character, player_car);
                                  GTA.Native.Function.Call("SET_CAR_PROOFS", player_car.ToInputParameter(), 0, 0, 0, 0, 0);
                              }
                              fire_timer = 0;
                              wep_timer = 100;
                              zn_rock.Delete();
                              GTA.Native.Function.Call("SET_PLAYER_INVINCIBLE", Player, 0);
                          }
                      }



                      if (GTA.Native.Function.Call<bool>("IS_CAR_UPSIDEDOWN", zn_core) && !GTA.Native.Function.Call<bool>("IS_CAR_IN_AIR_PROPER", zn_core))
                      {

                          GTA.Native.Function.Call("GET_CHAR_HEADING", Player.Character, angle);
                          GTA.Native.Function.Call("SET_CAR_HEADING", zn_core, angle.ToInputParameter());
                          DASH_flg = 0;
                          WALK_flg = 0;
                      }
                      if (w == null)
                      {
                          follow_cnt +=  1;
                          if (follow_cnt == 0 || follow_cnt > 50)
                          {
                              
                              pilot_char.Task.DriveTo(zn_core, Player.Character.Position, 30.0f, false);
                              follow_cnt = 1;
                          }
                      }

                      if (speed < 10.0f && WALK_flg != 1 && WALK_flg != 2 && WALK_flg != 3)
                      {
                          DASH_flg = 0;
                          WALK_flg = 0;
                      }
                      if (speed >= 10.0f)
                      {
                          DASH_flg = 1;
                          WALK_flg = 0;
                      }

                      Wanzer_ANIM();
                      if (Game.isGameKeyPressed(GTA.GameKey.EnterCar) && auto_pilot_flg == 1)
                      {
                          GTA.Native.Function.Call("GET_OFFSET_FROM_CHAR_IN_WORLD_COORDS", Player.Character, -4.0f, 0.0f, -4.0f, x, y, z);
                          GTA.Native.Function.Call("GET_OFFSET_FROM_CHAR_IN_WORLD_COORDS", Player.Character, 4.0f, 4.0f, 4.0f, x2, y2, z2);
                          if (GTA.Native.Function.Call<bool>("IS_CAR_IN_AREA_3D", zn_core, x.ToInputParameter(), y.ToInputParameter(), z.ToInputParameter(), x2.ToInputParameter(), y2.ToInputParameter(), z2.ToInputParameter()))
                          {
                              auto_pilot_flg = 0;
                              Game.DisplayText("AUTO DRIVE OFF", 5000);
                              chakuchi_flg = 1;
                              DASH_flg = 0;
                              WALK_flg = 0;
                          }
                      }
                      if (w != null)
                      {
                          if (zn_core.Position.DistanceTo2D(Destination) < 5.0f)
                          {
                              auto_pilot_flg = 0;
                              zn_core.Speed = 1.0f;
                              chakuchi_flg = 1;
                              DASH_flg = 0;
                              WALK_flg = 0;
                          }
                      }
                      else if (zn_core.Position.DistanceTo2D(Player.Character.Position) < 7.0f)
                      {
                          if (speed > 1.0f)
                          {
                              zn_core.Speed /= 2.0f;
                          }
                      }
                      if (Game.isGameKeyPressed(GTA.GameKey.Reload) && Game.isGameKeyPressed(GTA.GameKey.Sprint) && !Game.isGameKeyPressed(GTA.GameKey.Attack)
                          || Game.isKeyPressed(System.Windows.Forms.Keys.LMenu) && !Game.isGameKeyPressed(GTA.GameKey.Attack))
                      {
                          GTA.Native.Function.Call("TASK_USE_MOBILE_PHONE_TIMED", Player.Character, 500);
                          auto_pilot_flg = 0;
                          Game.DisplayText("AUTO DRIVE OFF", 5000);
                          chakuchi_flg = 1;
                          DASH_flg = 0;
                          WALK_flg = 0;
                          Wait(500);
                      }
                      if (!GTA.Native.Function.Call<bool>("IS_CHAR_IN_CAR", pilot_char, zn_core))
                      {
                          auto_pilot_flg = 0;
                          Game.DisplayText("AUTO DRIVE OFF", 5000);
                          chakuchi_flg = 1;
                          DASH_flg = 0;
                          WALK_flg = 0;
                      }
                  }
                  if (!GTA.Native.Function.Call<bool>("IS_CHAR_ON_FOOT", Player.Character))
                  {
                      GTA.Native.Pointer player_car = new GTA.Native.Pointer(typeof(Vehicle));
                      GTA.Native.Function.Call("GET_CAR_CHAR_IS_USING", Player.Character, player_car);
                      GTA.Native.Function.Call("SET_CAR_PROOFS", player_car.ToInputParameter(), 0, 0, 0, 0, 0);
                  }
                  auto_attack = 0;
                  fire_timer = 0;
                  wep_timer = 100;
                  zn_rock.Delete();
                  pilot_char.Delete();
                  GTA.Native.Function.Call("SET_PLAYER_INVINCIBLE", Player, 0);
              }
              
              //GTA.Native.Pointer speed = new GTA.Native.Pointer(typeof(float));
              //GTA.Native.Function.Call("GET_CAR_SPEED", zn_core, speed);
              //if (speed < 0.01f && auto_pilot_flg == 1)
              //{
                  //auto_pilot_flg = 0;
                  //pilot_char.Delete();
                  //Game.DisplayText("AUTO PILOT OFF");
                //  Wait(500);
              //}


              




              while (GTA.Native.Function.Call<bool>("IS_CHAR_IN_CAR", Player.Character, zn_core))
              {
                  In_Car();
                  GTA.Native.Function.Call("SET_CHAR_WILL_FLY_THROUGH_WINDSCREEN", Player.Character, 1);
                  GTA.Native.Function.Call("SET_PLAYER_CAN_DO_DRIVE_BY", Player, 1);
                  Player.Character.Visible = true;
                  GTA.Native.Function.Call("SET_PLAYER_INVINCIBLE", Player, 0);

                  auto_pilot_flg = 0;
                  chakuchi_flg = 1;
                  DASH_flg = 0;
                  WALK_flg = 0;
                  angl_body01_cnt = 0;
                  fire_timer = 0;
                  wep_timer = 0;
                  jump_timer = 0;
                  bullet_range_r = 0.0f;
                  bullet_range_l = 0.0f;


                  while (angl_armup_r > 0.42f || angl_armup_r < 0.38f || angl_armup_l > 0.42f || angl_armup_l < 0.38f
                      || angl_legup_r_a < 0.7f || angl_legup_l_a > -0.7f || angl_foot_r_a > -0.7f || angl_foot_l_a < 0.7f)
                  {
                      Wait(0);
                      if (pos_body > 1.2f)
                      {
                          pos_body -= 0.03f;
                      }
                      if (pos_leg > 1.1f)
                      {
                          pos_leg -= 0.03f;
                      }
                      pos_armup_r = 0.0f;
                      pos_armup_l = 0.0f;
                      angl_body01 = 135.02f;
                      angl_body01_b = 0.3f;
                      angl_body02 = 0.3f;
                      if (angl_armup_r > 0.42f)
                      {
                          angl_armup_r -= 0.03f;
                      }
                      else if (angl_armup_r < 0.38f)
                      {
                          angl_armup_r += 0.03f;
                      }
                      if (angl_armup_l > 0.42f)
                      {
                          angl_armup_l -= 0.03f;
                      }
                      else if (angl_armup_l < 0.38f)
                      {
                          angl_armup_l += 0.03f;
                      }

                      angl_armup_r_b = 0.0f;
                      angl_armup_l_b = 0.0f;
                      angl_armup_r_c = -1.55f;
                      angl_armup_l_c = -1.55f;

                      if (angl_legup_r_a < 0.7f)
                      {
                          angl_legup_r_a += 0.03f;
                      }
                      if (angl_legup_l_a > -0.7f)
                      {
                          angl_legup_l_a -= 0.03f;
                      }
                      angl_legup_r_b = 0.0f;
                      angl_legup_l_b = 0.0f;
                      if (angl_foot_r_a > -0.7f)
                      {
                          angl_foot_r_a -= 0.03f;
                      }
                      if (angl_foot_l_a < 0.7f)
                      {
                          angl_foot_l_a += 0.03f;
                      }
                      angl_foot_r_b = 0.0f;
                      angl_foot_l_b = 0.0f;

                      GTA.Native.Function.Call("ATTACH_OBJECT_TO_OBJECT", zn_armup_l, zn_body01, 0, 1.1f, pos_armup_l, 0.6f, angl_armup_l_b, angl_armup_l, angl_armup_l_c);  //o x x
                      GTA.Native.Function.Call("ATTACH_OBJECT_TO_OBJECT", zn_armup_r, zn_body01, 0, -1.1f, pos_armup_r, 0.6f, angl_armup_r_b, angl_armup_r, angl_armup_r_c); //o x x
                      GTA.Native.Function.Call("ATTACH_OBJECT_TO_CAR", zn_legup_l, zn_core, 0, -0.7f, 0.0f, 0.8f, angl_legup_l_a, angl_legup_l_b, 135.02f);  //o x x
                      GTA.Native.Function.Call("ATTACH_OBJECT_TO_CAR", zn_legup_r, zn_core, 0, 0.7f, 0.0f, 0.8f, angl_legup_r_a, angl_legup_r_b, 135.02f); //o x x
                      GTA.Native.Function.Call("ATTACH_OBJECT_TO_OBJECT", zn_foot_l, zn_legup_l, 0, 0.0f, 0.0f, -1.5f, angl_foot_l_a, angl_foot_l_b, 0.1f);  //o x x
                      GTA.Native.Function.Call("ATTACH_OBJECT_TO_OBJECT", zn_foot_r, zn_legup_r, 0, 0.0f, 0.0f, -1.5f, angl_foot_r_a, angl_foot_r_b, -0.1f); //o x x
                      GTA.Native.Function.Call("ATTACH_OBJECT_TO_CAR", zn_body02, zn_core, 0, 0.0f, 0.0f, pos_body, angl_body02, 0.0f, 135.02f);
                      GTA.Native.Function.Call("ATTACH_OBJECT_TO_CAR", zn_body01, zn_core, 0, 0.0f, pos_body01, pos_body, angl_body01_b, 0.0f, angl_body01);
                  }
                  Wait(500);
              }
          }

      }
#endregion

       private bool SetDestination()
       {
           Blip w = Game.GetWaypoint();
           if (w == null)
           {
               if (GTA.Native.Function.Call<bool>("IS_CHAR_IN_CAR", Player.Character, zn_core))
               {
                   Game.DisplayText("You have to select a waypoint first", 5000);
               }
               return false;

           }
           Destination = World.GetNextPositionOnStreet(w.Position);
           //Game.DisplayText("Driving to " + World.GetStreetName(Destination) + "...");
           if (GTA.Native.Function.Call<bool>("IS_CHAR_IN_CAR", Player.Character, zn_core))
           {
               Game.DisplayText("AUTO DRIVE ON", 5000);
           }
           return true;
       }

      private void In_Car()
      {
          while (GTA.Native.Function.Call<bool>("IS_CHAR_IN_CAR", Player.Character, zn_core))
          {
              

              GTA.Native.Function.Call("SET_CHAR_WILL_FLY_THROUGH_WINDSCREEN", Player.Character, 0);
              GTA.Native.Function.Call("SET_PLAYER_CAN_DO_DRIVE_BY", Player, 0);
              GTA.Native.Function.Call("SET_PLAYER_INVINCIBLE", Player, 1);

              GTA.Native.Function.Call("SET_CAR_VISIBLE", zn_core, 0);
              GTA.Native.Function.Call("SET_CAR_STRONG", zn_core, 1);
              GTA.Native.Function.Call("SET_CAR_PROOFS", zn_core, 1, 1, 1, 1, 1);
              GTA.Native.Function.Call("LOCK_CAR_DOORS", zn_core, 2);
              GTA.Native.Function.Call("MARK_CAR_AS_CONVOY_CAR", zn_core, 1);


              Player.Character.Visible = false;

              Wanzer_Aim();
              Wanzer_GUN_FIRE();
              Wanzer_ANIM();

              GTA.Native.Pointer angle = new GTA.Native.Pointer(typeof(float));
              GTA.Native.Function.Call("GET_CAR_HEADING", zn_core, angle);
              GTA.Native.Pointer speed = new GTA.Native.Pointer(typeof(float));
              GTA.Native.Function.Call("GET_CAR_SPEED", zn_core, speed);

              GTA.Native.Function.Call("SET_FOLLOW_VEHICLE_CAM_SUBMODE", 1);

              if (Game.isGameKeyPressed(GTA.GameKey.Reload) && Game.isGameKeyPressed(GTA.GameKey.Sprint) && auto_pilot_flg == 0
                  || Game.isKeyPressed(System.Windows.Forms.Keys.LMenu) && auto_pilot_flg == 0)
              {
                  if (SetDestination())
                  {
                      //DASH_flg = 1;
                      WALK_flg = 0;
                      // give the new task to the driver
                      Player.Character.BlockPermanentEvents = true;
                      Player.Character.Task.ClearAll();
                      Player.Character.Task.AlwaysKeepTask = true;
                      Player.Character.Task.DriveTo(zn_core, Destination, 30.0f, false);
                      auto_pilot_flg = 1;
                      Wait(300);
                  }
              }
              if (zn_core.Position.DistanceTo2D(Destination) < 5.0f && auto_pilot_flg == 1)
              {
                  auto_pilot_flg = 0;
                  Game.DisplayText("AUTO DRIVE OFF", 5000);
              }
              if (Game.isKeyPressed(System.Windows.Forms.Keys.W) && auto_pilot_flg == 1 || GTA.Native.Function.Call<bool>("IS_BUTTON_PRESSED", 0, 7) && auto_pilot_flg == 1
                  || Game.isKeyPressed(System.Windows.Forms.Keys.S) && auto_pilot_flg == 1 || GTA.Native.Function.Call<bool>("IS_BUTTON_PRESSED", 0, 5) && auto_pilot_flg == 1
                  || Game.isGameKeyPressed(GTA.GameKey.Reload) && Game.isGameKeyPressed(GTA.GameKey.Sprint) && auto_pilot_flg == 1
                  || Game.isKeyPressed(System.Windows.Forms.Keys.LMenu) && auto_pilot_flg == 1)
              {
                  auto_pilot_flg = 0;
                  
                  Player.Character.Task.ClearAll();
                  Game.DisplayText("AUTO DRIVE OFF", 5000);
                  Wait(300);
              }

              if (Game.isGameKeyPressed(GTA.GameKey.EnterCar) && auto_pilot_flg == 1
                  )
              {
                  auto_pilot_flg = 0;
                  Game.DisplayText("AUTO DRIVE OFF", 5000);
              }
              if (zn_core.Position.DistanceTo2D(Destination) < 5.0f && auto_pilot_flg == 1)
              {
                  auto_pilot_flg = 0;
                  Game.DisplayText("AUTO DRIVE OFF", 5000);
              }


              if (wep_timer >= 1)
              {
                  wep_timer += 1;
                  if (wep_timer >= 50)
                  {
                      wep_timer = 0;
                  }
              }

              if (jump_timer >= 1)
              {
                  jump_timer += 1;
                  if (jump_timer >= 60)
                  {
                      jump_timer = 0;
                  }
              }

              if (Game.isGameKeyPressed(GTA.GameKey.Jump) && wep_timer == 0 && !GTA.Native.Function.Call<bool>("DOES_OBJECT_EXIST", zn_rock)
                  || Game.isKeyPressed(System.Windows.Forms.Keys.Q) && wep_timer == 0 && !GTA.Native.Function.Call<bool>("DOES_OBJECT_EXIST", zn_rock))
              {
                  wep_timer = 1;
                  weapon_num += 1;
                  if (weapon_num > 3)
                  {
                      weapon_num = 0;
                  }
                  if (weapon_num == 0)
                  {
                      Game.DisplayText("Right Arm Weapon", 3000);
                  }
                  if (weapon_num == 1)
                  {
                      Game.DisplayText("Left Arm Weapon", 3000);
                  }
                  if (weapon_num == 2)
                  {
                      Game.DisplayText("Double Arm Weapons", 3000);
                  }
                  if (weapon_num == 3)
                  {
                      Game.DisplayText("Rocket Launcher", 3000);
                  }
              }
              if (Game.isGameKeyPressed(GTA.GameKey.Crouch) || Game.isKeyPressed(System.Windows.Forms.Keys.G))
              {
                  if (DASH_flg == 0)
                  {
                      DASH_flg = 1;
                      WALK_flg = 0;
                  }
                  else
                  {
                      DASH_flg = 0;
                      WALK_flg = 0;
                  }
                  Wait(300);
              }
              if (auto_pilot_flg == 1 && speed < 10.0f && WALK_flg != 1 && WALK_flg != 2 && WALK_flg != 3)
              {
                  DASH_flg = 0;
                  WALK_flg = 0;
              }
              if (auto_pilot_flg == 1 && speed >= 10.0f)
              {
                  DASH_flg = 1;
                  WALK_flg = 0;
              }
              if (GTA.Native.Function.Call<bool>("IS_CAR_UPSIDEDOWN", zn_core) && !GTA.Native.Function.Call<bool>("IS_CAR_IN_AIR_PROPER", zn_core))
              //|| GTA.Native.Function.Call<bool>("IS_CAR_UPRIGHT", zn_core))
              {
                 GTA.Native.Function.Call("SET_CAR_HEADING", zn_core, angle.ToInputParameter());
                 DASH_flg = 0;
                 WALK_flg = 0;
              }
              if (!GTA.Native.Function.Call<bool>("IS_CAR_IN_AIR_PROPER", zn_core) && !GTA.Native.Function.Call<bool>("IS_CAR_UPSIDEDOWN", zn_core))
              {
                  if (!Game.isKeyPressed(System.Windows.Forms.Keys.W)
                      && !Game.isKeyPressed(System.Windows.Forms.Keys.S)
                      && !GTA.Native.Function.Call<bool>("IS_BUTTON_PRESSED", 0, 7) && !GTA.Native.Function.Call<bool>("IS_BUTTON_PRESSED", 0, 5) && DASH_flg == 0
                      && auto_pilot_flg == 0)
                  {
                      if (speed >= -0.9f && speed <= 0.9f)
                      {
                          zn_core.Speed = 0.0f;
                      }
                      else
                          if (speed > 1.0f)
                          {
                              zn_core.Speed /= 1.1f;
                          }
                  }
                  if (Game.isKeyPressed(System.Windows.Forms.Keys.W) && DASH_flg == 0 || GTA.Native.Function.Call<bool>("IS_BUTTON_PRESSED", 0, 7) && DASH_flg == 0
                      && auto_pilot_flg == 0)
                  {
                      if (speed > 10.0f)
                      {
                          zn_core.Speed /= 2.0f;
                      }
                      if (speed < 1.0f)
                      {
                          zn_core.Speed = 1.0f;
                      }
                  }
                  if (Game.isKeyPressed(System.Windows.Forms.Keys.S) && DASH_flg == 0 || GTA.Native.Function.Call<bool>("IS_BUTTON_PRESSED", 0, 5) && DASH_flg == 0
                      && auto_pilot_flg == 0)
                  {
                      if (speed > 6.0f)
                      {
                          zn_core.Speed = -1.0f * (zn_core.Speed /= 2.0f);
                      }
                  }
                  if (Game.isGameKeyPressed(GTA.GameKey.Sprint) && Game.isGameKeyPressed(GTA.GameKey.SeekCover) && chakuchi_flg == 1 && jump_timer == 0
                      || Game.isKeyPressed(System.Windows.Forms.Keys.ShiftKey) && chakuchi_flg == 1 && jump_timer == 0)
                  {
                      jump_timer = 1;
                      GTA.Native.Function.Call("SET_PLAYER_CONTROL", Player, 0);
                      chakuchi_flg = 0;
                      DASH_flg = 0;
                      speed /= 100.0f;
                      float jump_foward = 5.0f;
                      jump_foward += (zn_core.Speed /= 1.5f);
                      Wait(0);
                      GTA.Native.Function.Call("SET_CAR_HEADING", zn_core, angle.ToInputParameter());
                      GTA.Native.Function.Call("APPLY_FORCE_TO_CAR", zn_core, 1, 0.0f, jump_foward, 15.0f, 0.0f, speed.ToInputParameter(), 0.0f, 1, 1, 1, 1);
                      GTA.Native.Function.Call("PLAY_AUDIO_EVENT_FROM_VEHICLE", "DISTANT_SHOTGUN", zn_core);

                  }

              }

              if (!GTA.Native.Function.Call<bool>("IS_CAR_IN_AIR_PROPER", zn_core) || GTA.Native.Function.Call<bool>("IS_CAR_IN_WATER", zn_core) && jump_timer > 50)
              {
                  if (chakuchi_flg == 0)
                  {
                      GTA.Native.Function.Call("PLAY_AUDIO_EVENT_FROM_VEHICLE", "DISTANT_SHOTGUN", zn_core);
                      
                      GTA.Native.Function.Call("SET_PLAYER_CONTROL", Player, 1);
                      GTA.Native.Function.Call("SET_CAR_HEADING", zn_core, angle.ToInputParameter());
                      Wait(100);
                  }
                  chakuchi_flg = 1;
              }
              if (Game.isGameKeyPressed(GTA.GameKey.EnterCar) && auto_pilot_flg == 0
                  //&& !GTA.Native.Function.Call<bool>("IS_CAR_IN_AIR_PROPER", zn_core)
                  //&& !GTA.Native.Function.Call<bool>("IS_CAR_UPSIDEDOWN", zn_core)
                  )
              {
                  while (angl_armup_r > 0.42f || angl_armup_r < 0.38f || angl_armup_l > 0.42f || angl_armup_l < 0.38f
                          || angl_legup_r_a < 0.7f || angl_legup_l_a > -0.7f || angl_foot_r_a > -0.7f || angl_foot_l_a < 0.7f)
                  {
                      arm_timer = 0;
                      zn_core.Speed /= 1.2f;
                      GTA.Native.Function.Call("WARP_CHAR_INTO_CAR", Player.Character, zn_core);
                      Wait(0);
                      if (pos_body > 1.2f)
                      {
                          pos_body -= 0.01f;
                      }
                      if (pos_leg > 1.1f)
                      {
                          pos_leg -= 0.01f;
                      }
                      pos_armup_r = 0.0f;
                      pos_armup_l = 0.0f;
                      angl_body01 = 135.02f;
                      angl_body01_b = 0.3f;
                      angl_body02 = 0.3f;
                      if (angl_armup_r > 0.42f)
                      {
                          angl_armup_r -= 0.03f;
                      }
                      else if (angl_armup_r < 0.38f)
                      {
                          angl_armup_r += 0.03f;
                      }
                      if (angl_armup_l > 0.42f)
                      {
                          angl_armup_l -= 0.03f;
                      }
                      else if (angl_armup_l < 0.38f)
                      {
                          angl_armup_l += 0.03f;
                      }

                      angl_armup_r_b = 0.0f;
                      angl_armup_l_b = 0.0f;
                      angl_armup_r_c = -1.55f;
                      angl_armup_l_c = -1.55f;

                      if (angl_legup_r_a < 0.7f)
                      {
                          angl_legup_r_a += 0.03f;
                      }
                      if (angl_legup_l_a > -0.7f)
                      {
                          angl_legup_l_a -= 0.03f;
                      }
                      angl_legup_r_b = 0.0f;
                      angl_legup_l_b = 0.0f;
                      if (angl_foot_r_a > -0.7f)
                      {
                          angl_foot_r_a -= 0.03f;
                      }
                      if (angl_foot_l_a < 0.7f)
                      {
                          angl_foot_l_a += 0.03f;
                      }
                      angl_foot_r_b = 0.0f;
                      angl_foot_l_b = 0.0f;

                      GTA.Native.Function.Call("ATTACH_OBJECT_TO_OBJECT", zn_armup_l, zn_body01, 0, 1.1f, pos_armup_l, 0.6f, angl_armup_l_b, angl_armup_l, angl_armup_l_c);  //o x x
                      GTA.Native.Function.Call("ATTACH_OBJECT_TO_OBJECT", zn_armup_r, zn_body01, 0, -1.1f, pos_armup_r, 0.6f, angl_armup_r_b, angl_armup_r, angl_armup_r_c); //o x x
                      GTA.Native.Function.Call("ATTACH_OBJECT_TO_CAR", zn_legup_l, zn_core, 0, -0.7f, 0.0f, 0.8f, angl_legup_l_a, angl_legup_l_b, 135.02f);  //o x x
                      GTA.Native.Function.Call("ATTACH_OBJECT_TO_CAR", zn_legup_r, zn_core, 0, 0.7f, 0.0f, 0.8f, angl_legup_r_a, angl_legup_r_b, 135.02f); //o x x
                      GTA.Native.Function.Call("ATTACH_OBJECT_TO_OBJECT", zn_foot_l, zn_legup_l, 0, 0.0f, 0.0f, -1.5f, angl_foot_l_a, angl_foot_l_b, 0.1f);  //o x x
                      GTA.Native.Function.Call("ATTACH_OBJECT_TO_OBJECT", zn_foot_r, zn_legup_r, 0, 0.0f, 0.0f, -1.5f, angl_foot_r_a, angl_foot_r_b, -0.1f); //o x x
                      GTA.Native.Function.Call("ATTACH_OBJECT_TO_CAR", zn_body02, zn_core, 0, 0.0f, 0.0f, pos_body, angl_body02, 0.0f, 135.02f);
                      GTA.Native.Function.Call("ATTACH_OBJECT_TO_CAR", zn_body01, zn_core, 0, 0.0f, pos_body01, pos_body, angl_body01_b, 0.0f, angl_body01);
                  }
                  GTA.Native.Function.Call("SET_PLAYER_CONTROL", Player, 1);
                  GTA.Native.Function.Call("TASK_LEAVE_ANY_CAR", Player.Character);
                  Wait(300);
                  GTA.Native.Function.Call("SET_CHAR_WILL_FLY_THROUGH_WINDSCREEN", Player.Character, 1);
                  GTA.Native.Function.Call("SET_PLAYER_CAN_DO_DRIVE_BY", Player, 1);
                  Player.Character.Visible = true;
                  GTA.Native.Function.Call("SET_PLAYER_INVINCIBLE", Player, 0);
                  while (GTA.Native.Function.Call<bool>("IS_CHAR_IN_CAR", Player.Character, zn_core))
                  {
                      Wait(0);
                  }
              }
              Wait(0);
          }
      }




      private void Wanzer_ANIM()
      {
          pos_body = 1.5f;
          pos_leg = 1.1f;
          GTA.Native.Pointer angle = new GTA.Native.Pointer(typeof(float));
          GTA.Native.Function.Call("GET_CAR_HEADING", zn_core, angle);
          GTA.Native.Pointer speed = new GTA.Native.Pointer(typeof(float));
          GTA.Native.Function.Call("GET_CAR_SPEED", zn_core, speed);

          #region ANIM_DASH


          if (DASH_flg == 1)
          {
              
              if (speed > 1.0f)
              {
                  

                  if (angl_body01_b < 0.5f)// = 0.5f;
                  {
                      angl_body01_b += 0.01f;
                  }
                  if (!Game.isKeyPressed(System.Windows.Forms.Keys.LButton) && !GTA.Native.Function.Call<bool>("IS_BUTTON_PRESSED", 0, 4) && auto_attack == 0
                      && !Game.isKeyPressed(System.Windows.Forms.Keys.RButton) && !GTA.Native.Function.Call<bool>("IS_BUTTON_PRESSED", 0, 6))
                  {
                      angl_body01_cnt += 1;
                      if (angl_body01_cnt > 50)
                      {
                          GTA.Native.Pointer x = new GTA.Native.Pointer(typeof(float));
                          GTA.Native.Pointer y = new GTA.Native.Pointer(typeof(float));
                          GTA.Native.Pointer z = new GTA.Native.Pointer(typeof(float));
                          GTA.Native.Pointer x2 = new GTA.Native.Pointer(typeof(float));
                          GTA.Native.Pointer y2 = new GTA.Native.Pointer(typeof(float));
                          GTA.Native.Pointer z2 = new GTA.Native.Pointer(typeof(float));
                          GTA.Native.Pointer dist = new GTA.Native.Pointer(typeof(float));
                          GTA.Native.Pointer dist2 = new GTA.Native.Pointer(typeof(float));

                          GTA.Native.Function.Call("GET_OFFSET_FROM_OBJECT_IN_WORLD_COORDS", zn_body01, 0.0f, -50.0f, 0.0f, x, y, z);
                          GTA.Native.Function.Call("GET_OFFSET_FROM_OBJECT_IN_WORLD_COORDS", zn_body02, 0.0f, -50.0f, 0.0f, x2, y2, z2);
                          GTA.Native.Function.Call("GET_DISTANCE_BETWEEN_COORDS_2D", x.ToInputParameter(), y.ToInputParameter(), x2.ToInputParameter(), y2.ToInputParameter(), dist);

                          if (dist >= 2.0f)
                          {
                              float a = dist;
                              a /= 120.0f;
                              float b = angl_body01;


                              GTA.Native.Function.Call("GET_OFFSET_FROM_OBJECT_IN_WORLD_COORDS", zn_body01, -0.5f, -50.0f, 0.0f, x, y, z);
                              GTA.Native.Function.Call("GET_DISTANCE_BETWEEN_COORDS_2D", x.ToInputParameter(), y.ToInputParameter(), x2.ToInputParameter(), y2.ToInputParameter(), dist);
                              GTA.Native.Function.Call("GET_OFFSET_FROM_OBJECT_IN_WORLD_COORDS", zn_body01, 0.5f, -50.0f, 0.0f, x, y, z);
                              GTA.Native.Function.Call("GET_DISTANCE_BETWEEN_COORDS_2D", x.ToInputParameter(), y.ToInputParameter(), x2.ToInputParameter(), y2.ToInputParameter(), dist2);



                              if (dist > dist2)
                              {
                                  angl_body01 += a;
                              }
                              else
                              {
                                  angl_body01 -= a;
                              }
                          }
                          else
                          {
                              angl_body01 = 135.02f;
                          }
                      }
                  }
                  else
                  {
                      angl_body01_cnt = 0;
                  }

                  if (!GTA.Native.Function.Call<bool>("IS_CAR_IN_AIR_PROPER", zn_core))
                  {
                      if (angl_body02 < 0.5f)// = 0.5f;
                      {
                          angl_body02 += 0.01f;
                          if (speed < 10.0f && !GTA.Native.Function.Call<bool>("IS_CAR_IN_AIR_PROPER", zn_core) && !GTA.Native.Function.Call<bool>("IS_CAR_UPSIDEDOWN", zn_core))
                          {
                              if (Game.isKeyPressed(System.Windows.Forms.Keys.W)
                                  || GTA.Native.Function.Call<bool>("IS_BUTTON_PRESSED", 0, 7)
                                  || Game.isKeyPressed(System.Windows.Forms.Keys.S)
                                  || GTA.Native.Function.Call<bool>("IS_BUTTON_PRESSED", 0, 5))
                              {
                                  if (Game.isKeyPressed(System.Windows.Forms.Keys.W)
                                  || GTA.Native.Function.Call<bool>("IS_BUTTON_PRESSED", 0, 7))
                                  {
                                      zn_core.Speed = 10.0f;
                                  }
                                  else
                                  {
                                      zn_core.Speed = -10.0f;
                                  }
                              }
                          }
                      }
                      if (angl_legup_r_a < 0.3f)// = 0.3f;
                      {
                          angl_legup_r_a += 0.02f;
                      }
                      else if (angl_legup_r_a > 0.3f)// = 0.3f;
                      {
                          angl_legup_r_a -= 0.02f;
                      }
                      if (angl_legup_r_b < 0.1f)
                      {
                          angl_legup_r_b += 0.01f;
                      }
                      if (angl_legup_l_a < 0.3f)
                      {
                          angl_legup_l_a += 0.02f;
                      }
                      else if (angl_legup_l_a > 0.3f)// = 0.3f;
                      {
                          angl_legup_l_a -= 0.02f;
                      }
                      if (angl_legup_l_b > -0.1f)
                      {
                          angl_legup_l_b -= 0.01f;
                      }
                      if (angl_foot_r_a > -0.3f)
                      {
                          angl_foot_r_a -= 0.01f;
                      }
                      else if (angl_foot_r_a < -0.3f)
                      {
                          angl_foot_r_a += 0.01f;
                      }
                      if (angl_foot_r_b > -0.1f)
                      {
                          angl_foot_r_b -= 0.01f;
                      }
                      if (angl_foot_l_a > -0.3f)
                      {
                          angl_foot_l_a -= 0.01f;
                      }
                      else if (angl_foot_l_a < -0.3f)
                      {
                          angl_foot_l_a += 0.01f;
                      }
                      if (angl_foot_l_b < 0.1f)
                      {
                          angl_foot_l_b += 0.01f;
                      }
                  }
                  GTA.Native.Function.Call("ATTACH_OBJECT_TO_CAR", zn_legup_l, zn_core, 0, -0.7f, 0.0f, 1.1f, angl_legup_l_a, angl_legup_l_b, 135.02f);  //o x x
                  GTA.Native.Function.Call("ATTACH_OBJECT_TO_CAR", zn_legup_r, zn_core, 0, 0.7f, 0.0f, 1.1f, angl_legup_r_a, angl_legup_r_b, 135.02f); //o x x
                  GTA.Native.Function.Call("ATTACH_OBJECT_TO_OBJECT", zn_foot_l, zn_legup_l, 0, 0.0f, 0.0f, -1.5f, angl_foot_l_a, angl_foot_l_b, 0.1f);  //o x x
                  GTA.Native.Function.Call("ATTACH_OBJECT_TO_OBJECT", zn_foot_r, zn_legup_r, 0, 0.0f, 0.0f, -1.5f, angl_foot_r_a, angl_foot_r_b, -0.1f); //o x x
                  GTA.Native.Function.Call("ATTACH_OBJECT_TO_CAR", zn_body02, zn_core, 0, 0.0f, 0.0f, 1.5f, angl_body02, 0.0f, 135.02f);
                  GTA.Native.Function.Call("ATTACH_OBJECT_TO_CAR", zn_body01, zn_core, 0, 0.0f, pos_body01, 1.5f, angl_body01_b, 0.0f, angl_body01);
                  if (!Game.isKeyPressed(System.Windows.Forms.Keys.LButton) && !GTA.Native.Function.Call<bool>("IS_BUTTON_PRESSED", 0, 4) && auto_attack == 0
                      && !Game.isKeyPressed(System.Windows.Forms.Keys.RButton) && !GTA.Native.Function.Call<bool>("IS_BUTTON_PRESSED", 0, 6))
                  {
                      if (angl_armup_l > 0.4f)
                      {
                          angl_armup_l -= 0.01f;
                      }
                      else if (angl_armup_l < 0.6f)
                      {
                          angl_armup_l += 0.01f;
                      }
                      if (angl_armup_l_c < -1.15f)
                      {
                          angl_armup_l_c += 0.01f;
                      }

                      if (angl_armup_r > 0.4f)
                      {
                          angl_armup_r -= 0.01f;
                      }
                      else if (angl_armup_r < 0.6f)
                      {
                          angl_armup_r += 0.01f;
                      }
                      if (angl_armup_r_c > -1.95f)
                      {
                          angl_armup_r_c -= 0.01f;
                      }
                      GTA.Native.Function.Call("ATTACH_OBJECT_TO_OBJECT", zn_armup_l, zn_body01, 0, 1.1f, pos_armup_l, 0.6f, angl_armup_l_b, angl_armup_l, angl_armup_l_c);  //o x x
                      GTA.Native.Function.Call("ATTACH_OBJECT_TO_OBJECT", zn_armup_r, zn_body01, 0, -1.1f, pos_armup_r, 0.6f, angl_armup_r_b, angl_armup_r, angl_armup_r_c); //o x x
                  }
              }
              else
              {
                  if (angl_body01_b > 0.0f)// = 0.5f;
                  {
                      angl_body01_b -= 0.01f;
                  }
                  if (!Game.isKeyPressed(System.Windows.Forms.Keys.LButton) && !GTA.Native.Function.Call<bool>("IS_BUTTON_PRESSED", 0, 4) && auto_attack == 0
                      && !Game.isKeyPressed(System.Windows.Forms.Keys.RButton) && !GTA.Native.Function.Call<bool>("IS_BUTTON_PRESSED", 0, 6))
                  {
                      angl_body01_cnt += 1;
                      if (angl_body01_cnt > 50)
                      {
                          GTA.Native.Pointer x = new GTA.Native.Pointer(typeof(float));
                          GTA.Native.Pointer y = new GTA.Native.Pointer(typeof(float));
                          GTA.Native.Pointer z = new GTA.Native.Pointer(typeof(float));
                          GTA.Native.Pointer x2 = new GTA.Native.Pointer(typeof(float));
                          GTA.Native.Pointer y2 = new GTA.Native.Pointer(typeof(float));
                          GTA.Native.Pointer z2 = new GTA.Native.Pointer(typeof(float));
                          GTA.Native.Pointer dist = new GTA.Native.Pointer(typeof(float));
                          GTA.Native.Pointer dist2 = new GTA.Native.Pointer(typeof(float));

                          GTA.Native.Function.Call("GET_OFFSET_FROM_OBJECT_IN_WORLD_COORDS", zn_body01, 0.0f, -50.0f, 0.0f, x, y, z);
                          GTA.Native.Function.Call("GET_OFFSET_FROM_OBJECT_IN_WORLD_COORDS", zn_body02, 0.0f, -50.0f, 0.0f, x2, y2, z2);
                          GTA.Native.Function.Call("GET_DISTANCE_BETWEEN_COORDS_2D", x.ToInputParameter(), y.ToInputParameter(), x2.ToInputParameter(), y2.ToInputParameter(), dist);

                          if (dist >= 2.0f)
                          {
                              float a = dist;
                              a /= 120.0f;
                              GTA.Native.Function.Call("GET_OFFSET_FROM_OBJECT_IN_WORLD_COORDS", zn_body01, -0.5f, -50.0f, 0.0f, x, y, z);
                              GTA.Native.Function.Call("GET_DISTANCE_BETWEEN_COORDS_2D", x.ToInputParameter(), y.ToInputParameter(), x2.ToInputParameter(), y2.ToInputParameter(), dist);
                              GTA.Native.Function.Call("GET_OFFSET_FROM_OBJECT_IN_WORLD_COORDS", zn_body01, 0.5f, -50.0f, 0.0f, x, y, z);
                              GTA.Native.Function.Call("GET_DISTANCE_BETWEEN_COORDS_2D", x.ToInputParameter(), y.ToInputParameter(), x2.ToInputParameter(), y2.ToInputParameter(), dist2);

                              if (dist > dist2)
                              {
                                  angl_body01 += a;
                              }
                              else
                              {
                                  angl_body01 -= a;
                              }
                          }
                          else
                          {
                              angl_body01 = 135.02f;
                          }
                      }
                  }
                  else
                  {
                      angl_body01_cnt = 0;
                  }

                  if (angl_body02 > 0.0f)// = 0.5f;
                  {
                      angl_body02 -= 0.015f;
                  }
                  if (angl_legup_r_a < 0.3f)// = 0.3f;
                  {
                      angl_legup_r_a += 0.01f;
                  }
                  else if (angl_legup_r_a > 0.3f)// = 0.3f;
                  {
                      angl_legup_r_a -= 0.01f;
                  }
                  if (angl_legup_r_b < 0.1f)
                  {
                      angl_legup_r_b += 0.01f;
                  }
                  if (angl_legup_l_a < 0.3f)
                  {
                      angl_legup_l_a += 0.01f;
                  }
                  else if (angl_legup_l_a > 0.3f)// = 0.3f;
                  {
                      angl_legup_l_a -= 0.01f;
                  }
                  if (angl_legup_l_b > -0.1f)
                  {
                      angl_legup_l_b -= 0.01f;
                  }
                  if (angl_foot_r_a > -0.3f)
                  {
                      angl_foot_r_a -= 0.01f;
                  }
                  else if (angl_foot_r_a < -0.3f)
                  {
                      angl_foot_r_a += 0.01f;
                  }
                  if (angl_foot_r_b > -0.1f)
                  {
                      angl_foot_r_b -= 0.01f;
                  }
                  if (angl_foot_l_a > -0.3f)
                  {
                      angl_foot_l_a -= 0.01f;
                  }
                  else if (angl_foot_l_a < -0.3f)
                  {
                      angl_foot_l_a += 0.01f;
                  }
                  if (angl_foot_l_b < 0.1f)
                  {
                      angl_foot_l_b += 0.01f;
                  }
                  GTA.Native.Function.Call("ATTACH_OBJECT_TO_CAR", zn_legup_l, zn_core, 0, -0.7f, 0.0f, 1.1f, angl_legup_l_a, angl_legup_l_b, 135.02f);  //o x x
                  GTA.Native.Function.Call("ATTACH_OBJECT_TO_CAR", zn_legup_r, zn_core, 0, 0.7f, 0.0f, 1.1f, angl_legup_r_a, angl_legup_r_b, 135.02f); //o x x
                  GTA.Native.Function.Call("ATTACH_OBJECT_TO_OBJECT", zn_foot_l, zn_legup_l, 0, 0.0f, 0.0f, -1.5f, angl_foot_l_a, angl_foot_l_b, 0.1f);  //o x x
                  GTA.Native.Function.Call("ATTACH_OBJECT_TO_OBJECT", zn_foot_r, zn_legup_r, 0, 0.0f, 0.0f, -1.5f, angl_foot_r_a, angl_foot_r_b, -0.1f); //o x x
                  GTA.Native.Function.Call("ATTACH_OBJECT_TO_CAR", zn_body02, zn_core, 0, 0.0f, 0.0f, 1.5f, angl_body02, 0.0f, 135.02f);
                  GTA.Native.Function.Call("ATTACH_OBJECT_TO_CAR", zn_body01, zn_core, 0, 0.0f, pos_body01, 1.5f, angl_body01_b, 0.0f, angl_body01);
                  if (!Game.isKeyPressed(System.Windows.Forms.Keys.LButton) && !GTA.Native.Function.Call<bool>("IS_BUTTON_PRESSED", 0, 4) && auto_attack == 0
                      && !Game.isKeyPressed(System.Windows.Forms.Keys.RButton) && !GTA.Native.Function.Call<bool>("IS_BUTTON_PRESSED", 0, 6))
                  {
                      if (angl_armup_l < 0.6f)
                      {
                          angl_armup_l += 0.01f;
                      }
                      if (angl_armup_l_c < -1.15f)
                      {
                          angl_armup_l_c += 0.01f;
                      }
                      if (angl_armup_r < 0.6f)
                      {
                          angl_armup_r += 0.01f;
                      }
                      if (angl_armup_r_c > -1.95f)
                      {
                          angl_armup_r_c -= 0.01f;
                      }
                      GTA.Native.Function.Call("ATTACH_OBJECT_TO_OBJECT", zn_armup_l, zn_body01, 0, 1.1f, pos_armup_l, 0.6f, angl_armup_l_b, angl_armup_l, angl_armup_l_c);  //o x x
                      GTA.Native.Function.Call("ATTACH_OBJECT_TO_OBJECT", zn_armup_r, zn_body01, 0, -1.1f, pos_armup_r, 0.6f, angl_armup_r_b, angl_armup_r, angl_armup_r_c); //o x x
                  }
              }
          }
          #endregion



          #region ANIM_WALK

          else
          {
              if (!Game.isKeyPressed(System.Windows.Forms.Keys.LButton) && !GTA.Native.Function.Call<bool>("IS_BUTTON_PRESSED", 0, 4) && auto_attack == 0
                  && !Game.isKeyPressed(System.Windows.Forms.Keys.RButton) && !GTA.Native.Function.Call<bool>("IS_BUTTON_PRESSED", 0, 6))
              {
                  angl_body01_cnt += 1;
                  if (angl_body01_cnt > 50)
                  {
                      GTA.Native.Pointer x = new GTA.Native.Pointer(typeof(float));
                      GTA.Native.Pointer y = new GTA.Native.Pointer(typeof(float));
                      GTA.Native.Pointer z = new GTA.Native.Pointer(typeof(float));
                      GTA.Native.Pointer x2 = new GTA.Native.Pointer(typeof(float));
                      GTA.Native.Pointer y2 = new GTA.Native.Pointer(typeof(float));
                      GTA.Native.Pointer z2 = new GTA.Native.Pointer(typeof(float));
                      GTA.Native.Pointer dist = new GTA.Native.Pointer(typeof(float));
                      GTA.Native.Pointer dist2 = new GTA.Native.Pointer(typeof(float));

                      GTA.Native.Function.Call("GET_OFFSET_FROM_OBJECT_IN_WORLD_COORDS", zn_body01, 0.0f, -50.0f, 0.0f, x, y, z);
                      GTA.Native.Function.Call("GET_OFFSET_FROM_OBJECT_IN_WORLD_COORDS", zn_body02, 0.0f, -50.0f, 0.0f, x2, y2, z2);
                      GTA.Native.Function.Call("GET_DISTANCE_BETWEEN_COORDS_2D", x.ToInputParameter(), y.ToInputParameter(), x2.ToInputParameter(), y2.ToInputParameter(), dist);

                      if (dist >= 2.0f)
                      {
                          float a = dist;
                          a /= 120.0f;
                          GTA.Native.Function.Call("GET_OFFSET_FROM_OBJECT_IN_WORLD_COORDS", zn_body01, -0.5f, -50.0f, 0.0f, x, y, z);
                          GTA.Native.Function.Call("GET_DISTANCE_BETWEEN_COORDS_2D", x.ToInputParameter(), y.ToInputParameter(), x2.ToInputParameter(), y2.ToInputParameter(), dist);
                          GTA.Native.Function.Call("GET_OFFSET_FROM_OBJECT_IN_WORLD_COORDS", zn_body01, 0.5f, -50.0f, 0.0f, x, y, z);
                          GTA.Native.Function.Call("GET_DISTANCE_BETWEEN_COORDS_2D", x.ToInputParameter(), y.ToInputParameter(), x2.ToInputParameter(), y2.ToInputParameter(), dist2);

                          if (dist > dist2)
                          {
                              angl_body01 += a;
                          }
                          else
                          {
                              angl_body01 -= a;
                          }
                      }
                      else
                      {
                          angl_body01 = 135.02f;
                      }
                  }
              }
              else
              {
                  angl_body01_cnt = 0;
              }

              if (weapon_num != 2 && weapon_num != 1 || arm_timer > 100)
              {
                  
                  angl_armup_l_b = 0.1f;
                  //if (angl_armup_l > 0.5f || angl_armup_l < 0.3f)// = 0.4
                  //{
                      if (angl_armup_l < 0.6f)// = 0.5f;
                      {
                          angl_armup_l += 0.02f;
                      }
                      else if (angl_armup_l > 0.63f)// = 0.5f;
                      {
                          angl_armup_l -= 0.02f;
                      }
                  //}
              }

              if (weapon_num != 2 && weapon_num != 1 || arm_timer > 100)
              {
                  //if (angl_armup_l_c > -1.5f || angl_armup_l_c < -1.6f)// = -1.55
                  //{
                      if (angl_armup_l_c > -1.3f)// = 0.5f;
                      {
                          angl_armup_l_c -= 0.02f;
                      }
                      else if (angl_armup_l_c < -1.4f)// = 0.5f;
                      {
                          angl_armup_l_c += 0.02f;
                      }
                  //}
              }

              if (weapon_num != 2 && weapon_num != 0 || arm_timer > 100)
              {
                  angl_armup_r_b = -0.1f;
                  //if (angl_armup_r > 0.5f || angl_armup_r < 0.3f)// = 0.4
                  //{
                      if (angl_armup_r < 0.6f)// = 0.5f;
                      {
                          angl_armup_r += 0.02f;
                      }
                      else if (angl_armup_r > 0.63f)// = 0.5f;
                      {
                          angl_armup_r -= 0.02f;
                      }
                  //}
              }
              if (weapon_num != 2 && weapon_num != 0 || arm_timer > 100)
              {
                  //if (angl_armup_r_c > -1.5f || angl_armup_r_c < -1.6f)// = -1.55
                  //{
                      if (angl_armup_r_c > -1.8f)// = 0.5f;
                      {
                          angl_armup_r_c -= 0.01f;
                      }
                      else if (angl_armup_r_c < -1.9f)// = 0.5f;
                      {
                          angl_armup_r_c += 0.02f;
                      }
                  //}
              }

              if (!GTA.Native.Function.Call<bool>("IS_CAR_IN_AIR_PROPER", zn_core))
              {
                  if (speed > 0.5f)
                  {
                      float a = speed;
                      a /= 250.0f;
                      if (angl_body01_b < 0.1f)// = 0.5f;
                      {
                          angl_body01_b += 0.01f;
                      }
                      if (angl_body02 < 0.1f)// = 0.5f;
                      {
                          angl_body02 += 0.01f;
                      }
                      if (angl_body01_b >= 0.12f)// = 0.5f;
                      {
                          angl_body01_b -= 0.01f;
                      }
                      if (angl_body02 >= 0.12f)// = 0.5f;
                      {
                          angl_body02 -= 0.01f;
                      }
                      if (!Game.isKeyPressed(System.Windows.Forms.Keys.S) && !GTA.Native.Function.Call<bool>("IS_BUTTON_PRESSED", 0, 5))
                      {
                          
                          if (WALK_flg == 0)
                          {
                              if (angl_legup_r_a < 0.5f)// = 0.3f;
                              {
                                  angl_legup_r_a += 0.06f + a;
                              }
                              if (angl_legup_r_b > 0.03f)
                              {
                                  angl_legup_r_b -= 0.01f + a;
                              }
                              if (angl_legup_l_a > -0.8f)
                              {
                                  angl_legup_l_a -= 0.08f + a;
                              }
                              if (angl_legup_l_b < -0.03f)
                              {
                                  angl_legup_l_b += 0.01f + a;
                              }
                              if (angl_foot_r_a > -0.5f)
                              {
                                  angl_foot_r_a -= 0.06f + a;
                              }
                              if (angl_foot_r_b < 0.0f)
                              {
                                  angl_foot_r_b += 0.01f + a;
                              }
                              if (angl_foot_l_a < 0.2f)
                              {
                                  angl_foot_l_a += 0.06f + a;
                              }
                              if (angl_foot_l_b > 0.0f)
                              {
                                  angl_foot_l_b -= 0.01f + a;
                              }
                              if (angl_legup_r_a >= 0.5f && angl_legup_l_a <= -0.8f)
                              {
                                  pos_body = 1.5f;
                                  pos_leg = 1.12f;
                                  WALK_flg = 1;
                              }
                          }
                          if (WALK_flg == 1)
                          {
                              if (angl_legup_r_a < 0.6f)// = 0.3f;
                              {
                                  angl_legup_r_a += 0.06f + a;
                              }
                              if (angl_legup_r_b > 0.03f)
                              {
                                  angl_legup_r_b -= 0.01f + a;
                              }
                              if (angl_legup_l_a < -0.5f)
                              {
                                  angl_legup_l_a += 0.06f + a;
                              }
                              if (angl_legup_l_b < -0.03f)
                              {
                                  angl_legup_l_b += 0.01f + a;
                              }
                              if (angl_foot_r_a < 0.0f)
                              {
                                  angl_foot_r_a += 0.06f + a;
                              }
                              if (angl_foot_r_b < 0.0f)
                              {
                                  angl_foot_r_b += 0.01f + a;
                              }
                              if (angl_foot_l_a < 0.5f)
                              {
                                  angl_foot_l_a += 0.06f + a;
                              }
                              if (angl_foot_l_b > 0.0f)
                              {
                                  angl_foot_l_b -= 0.01f + a;
                              }
                              if (angl_legup_r_a >= 0.6f && angl_legup_l_a >= -0.5f)
                              {
                                  WALK_flg = 2;
                                  pos_body = 1.53f;
                                  pos_leg = 1.12f;
                                  GTA.Native.Function.Call("PLAY_AUDIO_EVENT_FROM_VEHICLE", "DISTANT_SHOTGUN", zn_core);
                              }
                          }


                          if (WALK_flg == 2)
                          {
                              if (angl_legup_r_a > -0.8f)// = 0.3f;
                              {
                                  angl_legup_r_a -= 0.08f + a;
                              }
                              if (angl_legup_r_b > 0.03f)
                              {
                                  angl_legup_r_b -= 0.01f + a;
                              }
                              if (angl_legup_l_a < 0.5f)
                              {
                                  angl_legup_l_a += 0.06f + a;
                              }
                              if (angl_legup_l_b < -0.03f)
                              {
                                  angl_legup_l_b += 0.01f + a;
                              }
                              if (angl_foot_r_a < 0.2f)
                              {
                                  angl_foot_r_a += 0.06f + a;
                              }
                              if (angl_foot_r_b < 0.0f)
                              {
                                  angl_foot_r_b += 0.01f + a;
                              }
                              if (angl_foot_l_a > -0.5f)
                              {
                                  angl_foot_l_a -= 0.06f + a;
                              }
                              if (angl_foot_l_b > 0.0f)
                              {
                                  angl_foot_l_b -= 0.01f + a;
                              }
                              if (angl_legup_r_a <= -0.8 && angl_legup_l_a >= 0.5f)
                              {
                                  pos_body = 1.5f;
                                  pos_leg = 1.1f;
                                  WALK_flg = 3;
                              }
                          }
                          if (WALK_flg == 3)
                          {
                              if (angl_legup_r_a < -0.5f)// = 0.3f;
                              {
                                  angl_legup_r_a += 0.06f + a;
                              }
                              if (angl_legup_r_b > 0.03f)
                              {
                                  angl_legup_r_b -= 0.01f + a;
                              }
                              if (angl_legup_l_a < 0.6f)
                              {
                                  angl_legup_l_a += 0.06f + a;
                              }
                              if (angl_legup_l_b < -0.03f)
                              {
                                  angl_legup_l_b += 0.01f + a;
                              }
                              if (angl_foot_r_a < 0.5f)
                              {
                                  angl_foot_r_a += 0.06f + a;
                              }
                              if (angl_foot_r_b < 0.0f)
                              {
                                  angl_foot_r_b += 0.01f + a;
                              }
                              if (angl_foot_l_a < 0.0f)
                              {
                                  angl_foot_l_a += 0.06f + a;
                              }
                              if (angl_foot_l_b > 0.0f)
                              {
                                  angl_foot_l_b -= 0.01f + a;
                              }
                              if (angl_legup_r_a >= -0.5f && angl_legup_l_a >= 0.6f)
                              {
                                  WALK_flg = 0;
                                  pos_body = 1.53f;
                                  pos_leg = 1.12f;
                                  GTA.Native.Function.Call("PLAY_AUDIO_EVENT_FROM_VEHICLE", "DISTANT_SHOTGUN", zn_core);
                              }
                          }
                      }
                      #region back
                      else
                      {
                          if (angl_body01_b < 0.1f)// = 0.5f;
                          {
                              angl_body01_b += 0.01f;
                          }
                          if (angl_body02 < 0.1f)// = 0.5f;
                          {
                              angl_body02 += 0.01f;
                          }
                          if (WALK_flg == 0)
                          {
                              if (angl_legup_r_a < 0.8f)// = 0.3f;
                              {
                                  angl_legup_r_a += 0.08f + a;
                              }
                              if (angl_legup_r_b > 0.03f)
                              {
                                  angl_legup_r_b -= 0.01f + a;
                              }
                              if (angl_legup_l_a > -0.5f)
                              {
                                  angl_legup_l_a -= 0.06f + a;
                              }
                              if (angl_legup_l_b < -0.03f)
                              {
                                  angl_legup_l_b += 0.01f + a;
                              }
                              if (angl_foot_r_a > 0.0f)
                              {
                                  angl_foot_r_a -= 0.06f + a;
                              }
                              if (angl_foot_r_b < 0.0f)
                              {
                                  angl_foot_r_b += 0.01f + a;
                              }
                              if (angl_foot_l_a < 0.3f)
                              {
                                  angl_foot_l_a += 0.06f + a;
                              }
                              if (angl_foot_l_b > 0.0f)
                              {
                                  angl_foot_l_b -= 0.01f + a;
                              }
                              if (angl_legup_r_a >= 0.8f && angl_legup_l_a <= -0.5f)
                              {
                                  pos_body = 1.5f;
                                  pos_leg = 1.12f;
                                  WALK_flg = 1;
                              }
                          }
                          if (WALK_flg == 1)
                          {
                              if (angl_legup_r_a > 0.5f)// = 0.3f;
                              {
                                  angl_legup_r_a -= 0.05f + a;
                              }
                              else
                              {
                                  angl_legup_r_a = 0.5f;
                              }
                              if (angl_legup_r_b > 0.03f)
                              {
                                  angl_legup_r_b -= 0.01f + a;
                              }
                              if (angl_legup_l_a > -0.6f)
                              {
                                  angl_legup_l_a += 0.06f + a;
                              }
                              else
                              {
                                  angl_legup_l_a = -0.6f;
                              }
                              if (angl_legup_l_b < -0.03f)
                              {
                                  angl_legup_l_b += 0.01f + a;
                              }
                              if (angl_foot_r_a > -0.5f)
                              {
                                  angl_foot_r_a -= 0.06f + a;
                              }
                              if (angl_foot_r_b < 0.0f)
                              {
                                  angl_foot_r_b += 0.01f + a;
                              }
                              if (angl_foot_l_a < 0.6f)
                              {
                                  angl_foot_l_a += 0.06f + a;
                              }
                              if (angl_foot_l_b > 0.0f)
                              {
                                  angl_foot_l_b -= 0.01f + a;
                              }
                              if (angl_legup_r_a <= 0.5f && angl_legup_l_a >= -0.6f)
                              {
                                  pos_body = 1.53f;
                                  pos_leg = 1.12f;
                                  WALK_flg = 2;
                                  GTA.Native.Function.Call("PLAY_AUDIO_EVENT_FROM_VEHICLE", "DISTANT_SHOTGUN", zn_core);
                              }
                          }


                          if (WALK_flg == 2)
                          {
                              if (angl_legup_r_a > -0.5f)// = 0.3f;
                              {
                                  angl_legup_r_a -= 0.05f + a;
                              }
                              if (angl_legup_r_b > 0.03f)
                              {
                                  angl_legup_r_b -= 0.01f + a;
                              }
                              if (angl_legup_l_a < 0.8f)
                              {
                                  angl_legup_l_a += 0.06f + a;
                              }
                              if (angl_legup_l_b < -0.03f)
                              {
                                  angl_legup_l_b += 0.01f + a;
                              }
                              if (angl_foot_r_a < 0.3f)
                              {
                                  angl_foot_r_a += 0.06f + a;
                              }
                              if (angl_foot_r_b < 0.0f)
                              {
                                  angl_foot_r_b += 0.01f + a;
                              }
                              if (angl_foot_l_a > 0.0f)
                              {
                                  angl_foot_l_a -= 0.06f + a;
                              }
                              if (angl_foot_l_b > 0.0f)
                              {
                                  angl_foot_l_b -= 0.01f + a;
                              }
                              if (angl_legup_r_a <= -0.5f && angl_legup_l_a >= 0.8f)
                              {
                                  pos_body = 1.5f;
                                  pos_leg = 1.12f;
                                  WALK_flg = 3;
                              }
                          }

                          if (WALK_flg == 3)
                          {
                              if (angl_legup_r_a > -0.6f)// = 0.3f;
                              {
                                  angl_legup_r_a -= 0.05f + a;
                              }
                              if (angl_legup_r_b > 0.03f)
                              {
                                  angl_legup_r_b -= 0.01f + a;
                              }
                              if (angl_legup_l_a > 0.5f)
                              {
                                  angl_legup_l_a -= 0.06f + a;
                              }
                              if (angl_legup_l_b < -0.03f)
                              {
                                  angl_legup_l_b += 0.01f + a;
                              }
                              if (angl_foot_r_a < 0.6f)
                              {
                                  angl_foot_r_a += 0.06f + a;
                              }
                              if (angl_foot_r_b < 0.0f)
                              {
                                  angl_foot_r_b += 0.01f + a;
                              }
                              if (angl_foot_l_a > -0.5f)
                              {
                                  angl_foot_l_a -= 0.06f + a;
                              }
                              if (angl_foot_l_b > 0.0f)
                              {
                                  angl_foot_l_b -= 0.01f + a;
                              }
                              if (angl_legup_r_a <= -0.6f && angl_legup_l_a <= 0.5f)
                              {
                                  pos_body = 1.53f;
                                  pos_leg = 1.12f;
                                  WALK_flg = 0;
                                  GTA.Native.Function.Call("PLAY_AUDIO_EVENT_FROM_VEHICLE", "DISTANT_SHOTGUN", zn_core);
                              }
                          }
                      }
                      #endregion
                  }

                  else
                  {
                      WALK_flg = 0;
                      if (angl_body01_b > 0.0f)// = 0.5f;
                      {
                          angl_body01_b -= 0.01f;
                      }

                      if (angl_body02 > 0.0f)// = 0.5f;
                      {
                          angl_body02 -= 0.01f;
                      }

                      if (angl_legup_r_a > 0.0f)// = 0.3f;
                      {
                          angl_legup_r_a -= 0.03f;
                      }
                      else if (angl_legup_r_a < 0.0f)// = 0.3f;
                      {
                          angl_legup_r_a += 0.03f;
                      }
                      if (angl_legup_r_b < 0.05f)
                      {
                          angl_legup_r_b += 0.01f;
                      }
                      if (angl_legup_l_a > 0.0f)
                      {
                          angl_legup_l_a -= 0.03f;
                      }
                      else if (angl_legup_l_a < 0.0f)// = 0.3f;
                      {
                          angl_legup_l_a += 0.03f;
                      }
                      if (angl_legup_l_b > -0.05f)
                      {
                          angl_legup_l_b -= 0.01f;
                      }
                      if (angl_foot_r_a < 0.0f)
                      {
                          angl_foot_r_a += 0.03f;
                      }
                      else if (angl_foot_r_a > 0.0f)
                      {
                          angl_foot_r_a -= 0.03f;
                      }
                      if (angl_foot_r_b < 0.0f)
                      {
                          angl_foot_r_b += 0.01f;
                      }
                      if (angl_foot_l_a < 0.0f)
                      {
                          angl_foot_l_a += 0.03f;
                      }
                      else if (angl_foot_l_a > 0.0f)
                      {
                          angl_foot_l_a -= 0.03f;
                      }
                      if (angl_foot_l_b > 0.0f)
                      {
                          angl_foot_l_b -= 0.01f;
                      }


                      if (angl_legup_r_a < 0.1f && angl_legup_r_a > -0.1f)
                      {
                          angl_legup_r_a = 0.0f;
                      }
                      if (angl_legup_l_a < 0.1f && angl_legup_l_a > -0.1f)
                      {
                          angl_legup_l_a = 0.0f;
                      }
                      if (angl_foot_r_a < 0.1f && angl_foot_r_a > -0.1f)
                      {
                          angl_foot_r_a = 0.0f;
                      }
                      if (angl_foot_l_a < 0.1f && angl_foot_l_a > -0.1f)
                      {
                          angl_foot_l_a = 0.0f;
                      }





                  }


                  GTA.Native.Function.Call("ATTACH_OBJECT_TO_CAR", zn_legup_l, zn_core, 0, -0.7f, 0.0f, pos_leg, angl_legup_l_a, angl_legup_l_b, 135.02f);  //o x x
                  GTA.Native.Function.Call("ATTACH_OBJECT_TO_CAR", zn_legup_r, zn_core, 0, 0.7f, 0.0f, pos_leg, angl_legup_r_a, angl_legup_r_b, 135.02f); //o x x
                  GTA.Native.Function.Call("ATTACH_OBJECT_TO_OBJECT", zn_foot_l, zn_legup_l, 0, 0.0f, 0.0f, -1.5f, angl_foot_l_a, angl_foot_l_b, 0.1f);  //o x x
                  GTA.Native.Function.Call("ATTACH_OBJECT_TO_OBJECT", zn_foot_r, zn_legup_r, 0, 0.0f, 0.0f, -1.5f, angl_foot_r_a, angl_foot_r_b, -0.1f); //o x x
                  GTA.Native.Function.Call("ATTACH_OBJECT_TO_CAR", zn_body02, zn_core, 0, 0.0f, 0.0f, pos_body, angl_body02, 0.0f, 135.02f);
                  GTA.Native.Function.Call("ATTACH_OBJECT_TO_CAR", zn_body01, zn_core, 0, 0.0f, pos_body01, pos_body, angl_body01_b, 0.0f, angl_body01);
                  GTA.Native.Function.Call("ATTACH_OBJECT_TO_OBJECT", zn_armup_l, zn_body01, 0, 1.1f, pos_armup_l, 0.6f, angl_armup_l_b, angl_armup_l, angl_armup_l_c);  //o x x
                  GTA.Native.Function.Call("ATTACH_OBJECT_TO_OBJECT", zn_armup_r, zn_body01, 0, -1.1f, pos_armup_r, 0.6f, angl_armup_r_b, angl_armup_r, angl_armup_r_c); //o x x
              }
          }
          #endregion

          if (GTA.Native.Function.Call<bool>("IS_CAR_IN_AIR_PROPER", zn_core))
          {
             
              //float angl_body02 = 0.0f;
              
              
              float angl_legup_r_a = 0.4f;
              float angl_legup_l_a = 0.4f;
              float angl_legup_r_b = 0.1f;
              float angl_legup_l_b = -0.1f;
              float angl_foot_r_a = 0.4f;
              float angl_foot_l_a = 0.4f;
              float angl_foot_r_b = 0.0f;
              float angl_foot_l_b = 0.0f;

              GTA.Native.Function.Call("ATTACH_OBJECT_TO_CAR", zn_legup_l, zn_core, 0, -0.7f, 0.0f, pos_leg, angl_legup_l_a, angl_legup_l_b, 135.02f);  //o x x
              GTA.Native.Function.Call("ATTACH_OBJECT_TO_CAR", zn_legup_r, zn_core, 0, 0.7f, 0.0f, pos_leg, angl_legup_r_a, angl_legup_r_b, 135.02f); //o x x
              GTA.Native.Function.Call("ATTACH_OBJECT_TO_OBJECT", zn_foot_l, zn_legup_l, 0, 0.0f, 0.0f, -1.5f, angl_foot_l_a, angl_foot_l_b, 0.1f);  //o x x
              GTA.Native.Function.Call("ATTACH_OBJECT_TO_OBJECT", zn_foot_r, zn_legup_r, 0, 0.0f, 0.0f, -1.5f, angl_foot_r_a, angl_foot_r_b, -0.1f); //o x x
              GTA.Native.Function.Call("ATTACH_OBJECT_TO_CAR", zn_body02, zn_core, 0, 0.0f, 0.0f, pos_body, angl_body02, 0.0f, 135.02f);
              GTA.Native.Function.Call("ATTACH_OBJECT_TO_CAR", zn_body01, zn_core, 0, 0.0f, pos_body01, pos_body, angl_body01_b, 0.0f, angl_body01);
              GTA.Native.Function.Call("ATTACH_OBJECT_TO_OBJECT", zn_armup_l, zn_body01, 0, 1.1f, pos_armup_l, 0.6f, angl_armup_l_b, angl_armup_l, angl_armup_l_c);  //o x x
              GTA.Native.Function.Call("ATTACH_OBJECT_TO_OBJECT", zn_armup_r, zn_body01, 0, -1.1f, pos_armup_r, 0.6f, angl_armup_r_b, angl_armup_r, angl_armup_r_c); //o x x


              if (GTA.Native.Function.Call<bool>("IS_CAR_UPSIDEDOWN", zn_core) && GTA.Native.Function.Call<bool>("IS_CAR_IN_AIR_PROPER", zn_core))
              {
                  
                 // GTA.Native.Function.Call("SET_CAR_HEADING", zn_core, angle.ToInputParameter());
              }
          }
      }


      private void Wanzer_GUN_FIRE()
      {
          GTA.Native.Pointer speed = new GTA.Native.Pointer(typeof(float));
          GTA.Native.Function.Call("GET_CAR_SPEED", zn_core, speed);
          #region GUN_FIRE

          if (Game.isKeyPressed(System.Windows.Forms.Keys.LButton) || GTA.Native.Function.Call<bool>("IS_BUTTON_PRESSED", 0, 4) || fire_timer >= 1 || auto_attack > 0)
          {
              if (auto_attack == 0)
              {
                  int rnd = cRandom.Next(28);
                  if (rnd == 10)
                  {
                      rnd = cRandom.Next(20);
                      if (rnd == 11)
                      {
                          Player.WantedLevel += 1;
                      }
                  }
              }

              GTA.Native.Pointer x = new GTA.Native.Pointer(typeof(float));
              GTA.Native.Pointer y = new GTA.Native.Pointer(typeof(float));
              GTA.Native.Pointer z = new GTA.Native.Pointer(typeof(float));
              GTA.Native.Pointer x2 = new GTA.Native.Pointer(typeof(float));
              GTA.Native.Pointer y2 = new GTA.Native.Pointer(typeof(float));
              GTA.Native.Pointer z2 = new GTA.Native.Pointer(typeof(float));

              speed /= 4.0f;
              speed += 2.0f;
              fire_timer += 1;

              if (weapon_num == 0 && fire_timer == 1)
              {
                  GTA.Native.Function.Call("GET_OFFSET_FROM_OBJECT_IN_WORLD_COORDS", zn_armup_r, speed.ToInputParameter(), 0.5f, -0.1f, x, y, z);
                  float c = (float)(cRandom.Next(-15, 15));
                  float d = (float)(cRandom.Next(-15, 15));
                  GTA.Native.Function.Call("GET_OFFSET_FROM_OBJECT_IN_WORLD_COORDS", zn_armup_r, 200.0f, c, d, x2, y2, z2);
                  pos_armup_r = 0.15f;
                  pos_body01 = 0.05f;
                  GTA.Native.Function.Call("ATTACH_OBJECT_TO_OBJECT", zn_armup_r, zn_body01, 0, -1.1f, pos_armup_r, 0.6f, angl_armup_r_b, angl_armup_r, angl_armup_r_c);  //o x x
                  GTA.Native.Function.Call("ATTACH_OBJECT_TO_CAR", zn_body01, zn_core, 0, 0.0f, pos_body01, 1.5f, angl_body01_b, 0.0f, angl_body01);
                  GTA.Native.Function.Call("FIRE_SINGLE_BULLET", x.ToInputParameter(), y.ToInputParameter(), z.ToInputParameter(), x2.ToInputParameter(), y2.ToInputParameter(), z2.ToInputParameter(), 300.0f);
                  GTA.Native.Function.Call("PLAY_AUDIO_EVENT_FROM_VEHICLE", "DISTANT_DESERT_EAGLE", zn_core); //DISTANT_DESERT_EAGLE DISTANT_SHOTGUN //DISTANT_SNIPER
                  GTA.Native.Function.Call("TRIGGER_PTFX_ON_OBJ", "muz_pistol_small", zn_armup_r, 3.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 4.0f); //muz_pistol_small

                  if (bullet_range_r == 0.0f)
                  {
                      bullet_range_r = 4.0f;
                  }
              }
              if (weapon_num == 0 && fire_timer >= 4)
              {
                  pos_armup_r = 0.0f;
                  pos_body01 = 0.0f;
                  GTA.Native.Function.Call("ATTACH_OBJECT_TO_OBJECT", zn_armup_r, zn_body01, 0, -1.1f, pos_armup_r, 0.6f, angl_armup_r_b, angl_armup_r, angl_armup_r_c);  //o x x
                  GTA.Native.Function.Call("ATTACH_OBJECT_TO_CAR", zn_body01, zn_core, 0, 0.0f, pos_body01, 1.5f, angl_body01_b, 0.0f, angl_body01);
                  fire_timer = 0;
              }

              if (weapon_num == 1 && fire_timer == 1)
              {
                  GTA.Native.Function.Call("GET_OFFSET_FROM_OBJECT_IN_WORLD_COORDS", zn_armup_l, speed.ToInputParameter(), -0.5f, -0.1f, x, y, z);
                  float c = (float)(cRandom.Next(-15, 15));
                  float d = (float)(cRandom.Next(-15, 15));
                  GTA.Native.Function.Call("GET_OFFSET_FROM_OBJECT_IN_WORLD_COORDS", zn_armup_l, 200.0f, c, d, x2, y2, z2);
                  pos_armup_l = 0.15f;
                  pos_body01 = 0.05f;
                  GTA.Native.Function.Call("ATTACH_OBJECT_TO_OBJECT", zn_armup_l, zn_body01, 0, 1.1f, pos_armup_l, 0.6f, angl_armup_l_b, angl_armup_l, angl_armup_l_c); //o x x
                  GTA.Native.Function.Call("ATTACH_OBJECT_TO_CAR", zn_body01, zn_core, 0, 0.0f, pos_body01, 1.5f, angl_body01_b, 0.0f, angl_body01);
                  GTA.Native.Function.Call("FIRE_SINGLE_BULLET", x.ToInputParameter(), y.ToInputParameter(), z.ToInputParameter(), x2.ToInputParameter(), y2.ToInputParameter(), z2.ToInputParameter(), 300.0f);
                  GTA.Native.Function.Call("PLAY_AUDIO_EVENT_FROM_VEHICLE", "DISTANT_SNIPER", zn_core); //DISTANT_DESERT_EAGLE DISTANT_SHOTGUN //DISTANT_SNIPER
                  GTA.Native.Function.Call("TRIGGER_PTFX_ON_OBJ", "muz_pistol_small", zn_armup_l, 3.5f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 4.0f); //muz_pistol_small
                  if (bullet_range_l == 0.0f)
                  {
                      bullet_range_l = 4.0f;
                  }
              }
              if (weapon_num == 1 && fire_timer >= 4)
              {
                  pos_armup_l = 0.0f;
                  pos_body01 = 0.0f;
                  GTA.Native.Function.Call("ATTACH_OBJECT_TO_OBJECT", zn_armup_l, zn_body01, 0, 1.1f, pos_armup_l, 0.6f, angl_armup_l_b, angl_armup_l, angl_armup_l_c); //o x x
                  GTA.Native.Function.Call("ATTACH_OBJECT_TO_CAR", zn_body01, zn_core, 0, 0.0f, pos_body01, 1.5f, angl_body01_b, 0.0f, angl_body01);
                  fire_timer = 0;
              }

              if (weapon_num == 2 && fire_timer == 1)
              {
                  GTA.Native.Function.Call("GET_OFFSET_FROM_OBJECT_IN_WORLD_COORDS", zn_armup_r, speed.ToInputParameter(), 0.5f, -0.1f, x, y, z);
                  float c = (float)(cRandom.Next(-15, 15));
                  float d = (float)(cRandom.Next(-15, 15));
                  GTA.Native.Function.Call("GET_OFFSET_FROM_OBJECT_IN_WORLD_COORDS", zn_armup_r, 55.0f, c, d, x2, y2, z2);
                  GTA.Native.Function.Call("FIRE_SINGLE_BULLET", x.ToInputParameter(), y.ToInputParameter(), z.ToInputParameter(), x2.ToInputParameter(), y2.ToInputParameter(), z2.ToInputParameter(), 100.0f);
                  GTA.Native.Function.Call("PLAY_AUDIO_EVENT_FROM_VEHICLE", "DISTANT_DESERT_EAGLE", zn_core); //DISTANT_DESERT_EAGLE DISTANT_SHOTGUN //DISTANT_SNIPER //GENERAL_MELEE_WOODEN_BAT_PED
                  GTA.Native.Function.Call("TRIGGER_PTFX_ON_OBJ", "muz_pistol_small", zn_armup_r, 3.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 4.0f); //muz_pistol_small
                  GTA.Native.Function.Call("GET_OFFSET_FROM_OBJECT_IN_WORLD_COORDS", zn_armup_l, speed.ToInputParameter(), -0.5f, -0.1f, x, y, z);
                  c = (float)(cRandom.Next(-4, 4));
                  d = (float)(cRandom.Next(-4, 4));
                  GTA.Native.Function.Call("GET_OFFSET_FROM_OBJECT_IN_WORLD_COORDS", zn_armup_l, 55.0f, c, d, x2, y2, z2);
                  GTA.Native.Function.Call("FIRE_SINGLE_BULLET", x.ToInputParameter(), y.ToInputParameter(), z.ToInputParameter(), x2.ToInputParameter(), y2.ToInputParameter(), z2.ToInputParameter(), 100.0f);
                  GTA.Native.Function.Call("PLAY_AUDIO_EVENT_FROM_VEHICLE", "DISTANT_SNIPER", zn_core); //DISTANT_DESERT_EAGLE DISTANT_SHOTGUN //DISTANT_SNIPER
                  GTA.Native.Function.Call("TRIGGER_PTFX_ON_OBJ", "muz_pistol_small", zn_armup_l, 3.5f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 4.0f); //muz_pistol_small
                  pos_armup_r = 0.15f;
                  GTA.Native.Function.Call("ATTACH_OBJECT_TO_OBJECT", zn_armup_r, zn_body01, 0, -1.1f, pos_armup_r, 0.6f, angl_armup_r_b, angl_armup_r, angl_armup_r_c);  //o x x
                  pos_armup_l = 0.15f;
                  pos_body01 = 0.05f;
                  GTA.Native.Function.Call("ATTACH_OBJECT_TO_OBJECT", zn_armup_l, zn_body01, 0, 1.1f, pos_armup_l, 0.6f, angl_armup_l_b, angl_armup_l, angl_armup_l_c); //o x x
                  GTA.Native.Function.Call("ATTACH_OBJECT_TO_CAR", zn_body01, zn_core, 0, 0.0f, pos_body01, 1.5f, angl_body01_b, 0.0f, angl_body01);
                  if (bullet_range_r == 0.0f)
                  {
                      bullet_range_r = 4.0f;
                  }
                  if (bullet_range_l == 0.0f)
                  {
                      bullet_range_l = 4.0f;
                  }
              }
              if (weapon_num == 2 && fire_timer >= 4)
              {
                  pos_armup_r = 0.0f;
                  GTA.Native.Function.Call("ATTACH_OBJECT_TO_OBJECT", zn_armup_r, zn_body01, 0, -1.1f, pos_armup_r, 0.6f, angl_armup_r_b, angl_armup_r, angl_armup_r_c);  //o x x
                  pos_armup_l = 0.0f;
                  pos_body01 = 0.0f;
                  GTA.Native.Function.Call("ATTACH_OBJECT_TO_OBJECT", zn_armup_l, zn_body01, 0, 1.1f, pos_armup_l, 0.6f, angl_armup_l_b, angl_armup_l, angl_armup_l_c); //o x x
                  GTA.Native.Function.Call("ATTACH_OBJECT_TO_CAR", zn_body01, zn_core, 0, 0.0f, pos_body01, 1.5f, angl_body01_b, 0.0f, angl_body01);
                  fire_timer = 0;
              }
          }

          //rocket
          if (weapon_num == 3 && fire_timer == 1)
          {

              zn_rock.Delete();

              zn_rock = World.CreateObject("cj_rpg_rocket", Player.Character.Position.Around(100.5F));
              wep_timer = 0;


          }

          if (fire_timer < 10 && fire_timer >= 2 && GTA.Native.Function.Call<bool>("DOES_OBJECT_EXIST", zn_rock))
          {
              wep_timer = 1;
              GTA.Native.Function.Call("MARK_OBJECT_AS_NO_LONGER_NEEDED", zn_rock);


              if (rock_num == 0)
              {
                  GTA.Native.Function.Call("ATTACH_OBJECT_TO_OBJECT", zn_rock, zn_body01, 0, -2.0f, 0.0f, 1.0f, 0.0f, 0.0f, 90.0f); //o x x
                  rock_num = 1;
              }
              else
              {
                  GTA.Native.Function.Call("ATTACH_OBJECT_TO_OBJECT", zn_rock, zn_body01, 0, 2.0f, 0.0f, 1.0f, 0.0f, 0.0f, 90.0f); //o x x
                  rock_num = 0;
              }
              GTA.Native.Function.Call("PLAY_AUDIO_EVENT_FROM_OBJECT", "DISTANT_SNIPER", zn_rock);
              GTA.Native.Function.Call("TRIGGER_PTFX_ON_OBJ", "muz_pistol_small", zn_rock, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 12.0f);
              fire_timer = 10;
          }
          if (fire_timer >= 10 && GTA.Native.Function.Call<bool>("DOES_OBJECT_EXIST", zn_rock) && GTA.Native.Function.Call<bool>("IS_OBJECT_ATTACHED", zn_rock))
          {
              GTA.Native.Pointer x = new GTA.Native.Pointer(typeof(float));
              GTA.Native.Pointer y = new GTA.Native.Pointer(typeof(float));
              GTA.Native.Pointer z = new GTA.Native.Pointer(typeof(float));
              GTA.Native.Function.Call("GET_OFFSET_FROM_CAR_IN_WORLD_COORDS", zn_core, 0.0f, 0.0f, -6.0f, x, y, z);
              Vector3 startPosition = GetStartPosition();


              float x2 = startPosition.X;
              float y2 = startPosition.Y;
              float z2 = startPosition.Z;
              float x3 = x;
              float y3 = y;
              float z3 = z;
              x2 -= x3;
              y2 -= y3;
              z2 -= z3;
              x2 *= 2.0f;
              y2 *= 2.0f;
              z2 += 1.0f;

              x99 = x2;
              y99 = y2;
              z99 = z2;

              Wait(10);
              GTA.Native.Function.Call("DETACH_OBJECT", zn_rock, zn_body01); //o x x
              GTA.Native.Function.Call("SET_OBJECT_INITIAL_VELOCITY", zn_rock, x2, y2, z2);
              //GTA.Native.Function.Call("APPLY_FORCE_TO_OBJECT", zn_rock, 1, 0.0f, 50.0f, 10.0f, 0.0f, 0.0f, 0.0f, 1, 1, 1, 1);

              Wait(10);
              GTA.Native.Function.Call("GET_OBJECT_HEADING", zn_rock, rock_angle);
              
              fire_timer = 100;
          }
          if (fire_timer >= 100 && GTA.Native.Function.Call<bool>("DOES_OBJECT_EXIST", zn_rock))
          {
              GTA.Native.Function.Call("TRIGGER_PTFX_ON_OBJ", "muz_pistol_small", zn_rock, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 7.0f);
              GTA.Native.Function.Call("PLAY_AUDIO_EVENT_FROM_OBJECT", "DISTANT_DESERT_EAGLE", zn_rock);

              GTA.Native.Function.Call("SET_OBJECT_INITIAL_VELOCITY", zn_rock, x99, y99, z99);

              GTA.Native.Pointer angle = new GTA.Native.Pointer(typeof(float));
              GTA.Native.Function.Call("GET_OBJECT_HEADING", zn_rock, angle);
              float r = rock_angle;
              angle -= r;
              if (angle > 10.0f || angle < -10.0f)
              {
                  GTA.Native.Pointer x = new GTA.Native.Pointer(typeof(float));
                  GTA.Native.Pointer y = new GTA.Native.Pointer(typeof(float));
                  GTA.Native.Pointer z = new GTA.Native.Pointer(typeof(float));
                  GTA.Native.Function.Call("GET_OFFSET_FROM_OBJECT_IN_WORLD_COORDS", zn_rock, 0.0f, 0.0f, 0.0f, x, y, z);
                  GTA.Native.Function.Call("ADD_EXPLOSION", x.ToInputParameter(), y.ToInputParameter(), z.ToInputParameter(), 0, 10.0f, 1, 0, 0);

                  
                  fire_timer = 0;
                  wep_timer = 100;



                  pd1 = World.GetPeds(zn_rock.GetOffsetPosition(new Vector3(0.0f, 0.0f, 0.0f)), 6.0f, 2);
                  pd1_cnt = 0;
                  for (int length = pd1.Length; pd1_cnt < length; pd1_cnt++)
                  {
                      if (!Exists(pd1[pd1_cnt])) { continue; }
                      if (Exists(pd1[pd1_cnt]) == true && pd1[pd1_cnt].isAlive == true && pd1[pd1_cnt] != Player.Character && pd1[pd1_cnt].Money != 500)
                      {
                          GTA.Native.Function.Call("SET_CHAR_ONLY_DAMAGED_BY_PLAYER", pd1[pd1_cnt], 0);
                      }
                  }
                  zn_rock.Delete();


              }
          }
          if (fire_timer >= 140 && GTA.Native.Function.Call<bool>("DOES_OBJECT_EXIST", zn_rock))
          {
              GTA.Native.Pointer x = new GTA.Native.Pointer(typeof(float));
              GTA.Native.Pointer y = new GTA.Native.Pointer(typeof(float));
              GTA.Native.Pointer z = new GTA.Native.Pointer(typeof(float));
              GTA.Native.Function.Call("GET_OFFSET_FROM_OBJECT_IN_WORLD_COORDS", zn_rock, 0.0f, 0.0f, 0.0f, x, y, z);
              GTA.Native.Function.Call("ADD_EXPLOSION", x.ToInputParameter(), y.ToInputParameter(), z.ToInputParameter(), 0, 10.0f, 1, 0, 0);

              
              fire_timer = 0;
              wep_timer = 100;


              pd1 = World.GetPeds(zn_rock.GetOffsetPosition(new Vector3(0.0f, 0.0f, 0.0f)), 6.0f, 2);
              pd1_cnt = 0;
              for (int length = pd1.Length; pd1_cnt < length; pd1_cnt++)
              {
                  if (!Exists(pd1[pd1_cnt])) { continue; }
                  if (Exists(pd1[pd1_cnt]) == true && pd1[pd1_cnt].isAlive == true && pd1[pd1_cnt] != Player.Character && pd1[pd1_cnt].Money != 500)
                  {
                      GTA.Native.Function.Call("SET_CHAR_ONLY_DAMAGED_BY_PLAYER", pd1[pd1_cnt], 0);
                  }
              }
              zn_rock.Delete();

          }
          //rocket


          GTA.Native.Function.Call("GET_CAR_SPEED", zn_core, speed);
          float a = speed;
          a /= 1.5f;

          if (bullet_range_r != 0.0f)
          {
              bullet_range_r += a;
              GTA.Native.Function.Call("GET_OFFSET_FROM_OBJECT_IN_WORLD_COORDS", zn_armup_r, bullet_range_r, -0.5f, -0.5f, bullet_x, bullet_y, bullet_z);
              bullet_range_r += 1.0f;
              GTA.Native.Function.Call("GET_OFFSET_FROM_OBJECT_IN_WORLD_COORDS", zn_armup_r, bullet_range_r, 0.5f, 0.5f, bullet_x2, bullet_y2, bullet_z2);
              if (GTA.Native.Function.Call<bool>("IS_AREA_OCCUPIED", bullet_x.ToInputParameter(), bullet_y.ToInputParameter(), bullet_z.ToInputParameter(), bullet_x2.ToInputParameter(), bullet_y2.ToInputParameter(), bullet_z2.ToInputParameter(), 0, 1, 1, 1, 1)) //p,c,o?,o,?
              {
                  GTA.Native.Function.Call("GET_OFFSET_FROM_OBJECT_IN_WORLD_COORDS", zn_armup_r, bullet_range_r, 0.0f, 0.0f, bullet_x2, bullet_y2, bullet_z2);
                  GTA.Native.Function.Call("ADD_EXPLOSION", bullet_x2.ToInputParameter(), bullet_y2.ToInputParameter(), bullet_z2.ToInputParameter(), 0, 10.0f, 1, 0, 0);
                  bullet_range_r = 0.0f;



                  pd1 = World.GetPeds(zn_armup_r.GetOffsetPosition(new Vector3(bullet_range_r, 0.0f, 0.0f)), 6.0f, 2);
                  pd1_cnt = 0;
                  for (int length = pd1.Length; pd1_cnt < length; pd1_cnt++)
                  {
                      if (!Exists(pd1[pd1_cnt])) { continue; }
                      if (Exists(pd1[pd1_cnt]) == true && pd1[pd1_cnt].isAlive == true && pd1[pd1_cnt] != Player.Character && pd1[pd1_cnt].Money != 500)
                      {
                          GTA.Native.Function.Call("SET_CHAR_ONLY_DAMAGED_BY_PLAYER", pd1[pd1_cnt], 0);
                      }
                  }



              }
              else
              {
                  GTA.Native.Function.Call("GET_OFFSET_FROM_OBJECT_IN_WORLD_COORDS", zn_armup_r, bullet_range_r, -0.5f, -0.5f, bullet_x, bullet_y, bullet_z);
                  bullet_range_r += 1.0f;
                  GTA.Native.Function.Call("GET_OFFSET_FROM_OBJECT_IN_WORLD_COORDS", zn_armup_r, bullet_range_r, 0.5f, 0.5f, bullet_x2, bullet_y2, bullet_z2);
                  if (GTA.Native.Function.Call<bool>("IS_AREA_OCCUPIED", bullet_x.ToInputParameter(), bullet_y.ToInputParameter(), bullet_z.ToInputParameter(), bullet_x2.ToInputParameter(), bullet_y2.ToInputParameter(), bullet_z2.ToInputParameter(), 0, 1, 1, 1, 1)) //p,c,o?,o,?
                  {
                      GTA.Native.Function.Call("GET_OFFSET_FROM_OBJECT_IN_WORLD_COORDS", zn_armup_r, bullet_range_r, 0.0f, 0.0f, bullet_x2, bullet_y2, bullet_z2);
                      GTA.Native.Function.Call("ADD_EXPLOSION", bullet_x2.ToInputParameter(), bullet_y2.ToInputParameter(), bullet_z2.ToInputParameter(), 1, 10.0f, 1, 0, 0);
                      bullet_range_r = 0.0f;


                      pd1 = World.GetPeds(zn_armup_r.GetOffsetPosition(new Vector3(bullet_range_r, 0.0f, 0.0f)), 6.0f, 2);
                      pd1_cnt = 0;
                      for (int length = pd1.Length; pd1_cnt < length; pd1_cnt++)
                      {
                          if (!Exists(pd1[pd1_cnt])) { continue; }
                          if (Exists(pd1[pd1_cnt]) == true && pd1[pd1_cnt].isAlive == true && pd1[pd1_cnt] != Player.Character && pd1[pd1_cnt].Money != 500)
                          {
                              GTA.Native.Function.Call("SET_CHAR_ONLY_DAMAGED_BY_PLAYER", pd1[pd1_cnt], 0);
                          }
                      }

                  }
                  else
                  {
                      GTA.Native.Function.Call("GET_OFFSET_FROM_OBJECT_IN_WORLD_COORDS", zn_armup_r, bullet_range_r, -0.5f, -0.5f, bullet_x, bullet_y, bullet_z);
                      bullet_range_r += 1.0f;
                      GTA.Native.Function.Call("GET_OFFSET_FROM_OBJECT_IN_WORLD_COORDS", zn_armup_r, bullet_range_r, 0.5f, 0.5f, bullet_x2, bullet_y2, bullet_z2);
                      if (GTA.Native.Function.Call<bool>("IS_AREA_OCCUPIED", bullet_x.ToInputParameter(), bullet_y.ToInputParameter(), bullet_z.ToInputParameter(), bullet_x2.ToInputParameter(), bullet_y2.ToInputParameter(), bullet_z2.ToInputParameter(), 0, 1, 1, 1, 1)) //p,c,o?,o,?
                      {
                          GTA.Native.Function.Call("GET_OFFSET_FROM_OBJECT_IN_WORLD_COORDS", zn_armup_r, bullet_range_r, 0.0f, 0.0f, bullet_x2, bullet_y2, bullet_z2);
                          GTA.Native.Function.Call("ADD_EXPLOSION", bullet_x2.ToInputParameter(), bullet_y2.ToInputParameter(), bullet_z2.ToInputParameter(), 1, 10.0f, 1, 0, 0);
                          bullet_range_r = 0.0f;


                          pd1 = World.GetPeds(zn_armup_r.GetOffsetPosition(new Vector3(bullet_range_r, 0.0f, 0.0f)), 6.0f, 2);
                          pd1_cnt = 0;
                          for (int length = pd1.Length; pd1_cnt < length; pd1_cnt++)
                          {
                              if (!Exists(pd1[pd1_cnt])) { continue; }
                              if (Exists(pd1[pd1_cnt]) == true && pd1[pd1_cnt].isAlive == true && pd1[pd1_cnt] != Player.Character && pd1[pd1_cnt].Money != 500)
                              {
                                  GTA.Native.Function.Call("SET_CHAR_ONLY_DAMAGED_BY_PLAYER", pd1[pd1_cnt], 0);
                              }
                          }

                      }
                      else
                      {
                          GTA.Native.Function.Call("GET_OFFSET_FROM_OBJECT_IN_WORLD_COORDS", zn_armup_r, bullet_range_r, -0.5f, -0.5f, bullet_x, bullet_y, bullet_z);
                          bullet_range_r += 1.0f;
                          GTA.Native.Function.Call("GET_OFFSET_FROM_OBJECT_IN_WORLD_COORDS", zn_armup_r, bullet_range_r, 0.5f, 0.5f, bullet_x2, bullet_y2, bullet_z2);
                          if (GTA.Native.Function.Call<bool>("IS_AREA_OCCUPIED", bullet_x.ToInputParameter(), bullet_y.ToInputParameter(), bullet_z.ToInputParameter(), bullet_x2.ToInputParameter(), bullet_y2.ToInputParameter(), bullet_z2.ToInputParameter(), 0, 1, 1, 1, 1)) //p,c,o?,o,?
                          {
                              GTA.Native.Function.Call("GET_OFFSET_FROM_OBJECT_IN_WORLD_COORDS", zn_armup_r, bullet_range_r, 0.0f, 0.0f, bullet_x2, bullet_y2, bullet_z2);
                              GTA.Native.Function.Call("ADD_EXPLOSION", bullet_x2.ToInputParameter(), bullet_y2.ToInputParameter(), bullet_z2.ToInputParameter(), 1, 10.0f, 1, 0, 0);
                              bullet_range_r = 0.0f;


                              pd1 = World.GetPeds(zn_armup_r.GetOffsetPosition(new Vector3(bullet_range_r, 0.0f, 0.0f)), 6.0f, 2);
                              pd1_cnt = 0;
                              for (int length = pd1.Length; pd1_cnt < length; pd1_cnt++)
                              {
                                  if (!Exists(pd1[pd1_cnt])) { continue; }
                                  if (Exists(pd1[pd1_cnt]) == true && pd1[pd1_cnt].isAlive == true && pd1[pd1_cnt] != Player.Character && pd1[pd1_cnt].Money != 500)
                                  {
                                      GTA.Native.Function.Call("SET_CHAR_ONLY_DAMAGED_BY_PLAYER", pd1[pd1_cnt], 0);
                                  }
                              }

                          }
                          
                      }
                  }
              }
          }

          if (bullet_range_r >= 100.0f)
          {
              bullet_range_r = 0.0f;
          }

          if (bullet_range_l != 0.0f)
          {
              bullet_range_l += a;
              GTA.Native.Function.Call("GET_OFFSET_FROM_OBJECT_IN_WORLD_COORDS", zn_armup_l, bullet_range_l, -0.5f, -0.5f, bullet_x3, bullet_y3, bullet_z3);
              bullet_range_l += 1.0f;
              GTA.Native.Function.Call("GET_OFFSET_FROM_OBJECT_IN_WORLD_COORDS", zn_armup_l, bullet_range_l, 0.5f, 0.5f, bullet_x4, bullet_y4, bullet_z4);
              if (GTA.Native.Function.Call<bool>("IS_AREA_OCCUPIED", bullet_x3.ToInputParameter(), bullet_y3.ToInputParameter(), bullet_z3.ToInputParameter(), bullet_x4.ToInputParameter(), bullet_y4.ToInputParameter(), bullet_z4.ToInputParameter(), 0, 1, 1, 1, 1)) //p,c,o?,o,?
              {
                  GTA.Native.Function.Call("GET_OFFSET_FROM_OBJECT_IN_WORLD_COORDS", zn_armup_l, bullet_range_l, 0.0f, 0.0f, bullet_x3, bullet_y3, bullet_z3);
                  GTA.Native.Function.Call("ADD_EXPLOSION", bullet_x3.ToInputParameter(), bullet_y3.ToInputParameter(), bullet_z3.ToInputParameter(), 0, 10.0f, 1, 0, 0);
                  bullet_range_l = 0.0f;


                  pd1 = World.GetPeds(zn_armup_l.GetOffsetPosition(new Vector3(bullet_range_l, 0.0f, 0.0f)), 6.0f, 2);
                  pd1_cnt = 0;
                  for (int length = pd1.Length; pd1_cnt < length; pd1_cnt++)
                  {
                      if (!Exists(pd1[pd1_cnt])) { continue; }
                      if (Exists(pd1[pd1_cnt]) == true && pd1[pd1_cnt].isAlive == true && pd1[pd1_cnt] != Player.Character && pd1[pd1_cnt].Money != 500)
                      {
                          GTA.Native.Function.Call("SET_CHAR_ONLY_DAMAGED_BY_PLAYER", pd1[pd1_cnt], 0);
                      }
                  }

              }
              else
              {
                  GTA.Native.Function.Call("GET_OFFSET_FROM_OBJECT_IN_WORLD_COORDS", zn_armup_l, bullet_range_l, -0.5f, -0.5f, bullet_x3, bullet_y3, bullet_z3);
                  bullet_range_l += 1.0f;
                  GTA.Native.Function.Call("GET_OFFSET_FROM_OBJECT_IN_WORLD_COORDS", zn_armup_l, bullet_range_l, 0.5f, 0.5f, bullet_x4, bullet_y4, bullet_z4);
                  if (GTA.Native.Function.Call<bool>("IS_AREA_OCCUPIED", bullet_x3.ToInputParameter(), bullet_y3.ToInputParameter(), bullet_z3.ToInputParameter(), bullet_x4.ToInputParameter(), bullet_y4.ToInputParameter(), bullet_z4.ToInputParameter(), 0, 1, 1, 1, 1)) //p,c,o?,o,?
                  {
                      GTA.Native.Function.Call("GET_OFFSET_FROM_OBJECT_IN_WORLD_COORDS", zn_armup_l, bullet_range_l, 0.0f, 0.0f, bullet_x3, bullet_y3, bullet_z3);
                      GTA.Native.Function.Call("ADD_EXPLOSION", bullet_x3.ToInputParameter(), bullet_y3.ToInputParameter(), bullet_z3.ToInputParameter(), 1, 10.0f, 1, 0, 0);
                      bullet_range_l = 0.0f;



                      pd1 = World.GetPeds(zn_armup_l.GetOffsetPosition(new Vector3(bullet_range_l, 0.0f, 0.0f)), 6.0f, 2);
                      pd1_cnt = 0;
                      for (int length = pd1.Length; pd1_cnt < length; pd1_cnt++)
                      {
                          if (!Exists(pd1[pd1_cnt])) { continue; }
                          if (Exists(pd1[pd1_cnt]) == true && pd1[pd1_cnt].isAlive == true && pd1[pd1_cnt] != Player.Character && pd1[pd1_cnt].Money != 500)
                          {
                              GTA.Native.Function.Call("SET_CHAR_ONLY_DAMAGED_BY_PLAYER", pd1[pd1_cnt], 0);
                          }
                      }


                  }
                  else
                  {
                      GTA.Native.Function.Call("GET_OFFSET_FROM_OBJECT_IN_WORLD_COORDS", zn_armup_l, bullet_range_l, -0.5f, -0.5f, bullet_x3, bullet_y3, bullet_z3);
                      bullet_range_l += 1.0f;
                      GTA.Native.Function.Call("GET_OFFSET_FROM_OBJECT_IN_WORLD_COORDS", zn_armup_l, bullet_range_l, 0.5f, 0.5f, bullet_x4, bullet_y4, bullet_z4);
                      if (GTA.Native.Function.Call<bool>("IS_AREA_OCCUPIED", bullet_x3.ToInputParameter(), bullet_y3.ToInputParameter(), bullet_z3.ToInputParameter(), bullet_x4.ToInputParameter(), bullet_y4.ToInputParameter(), bullet_z4.ToInputParameter(), 0, 1, 1, 1, 1)) //p,c,o?,o,?
                      {
                          GTA.Native.Function.Call("GET_OFFSET_FROM_OBJECT_IN_WORLD_COORDS", zn_armup_l, bullet_range_l, 0.0f, 0.0f, bullet_x3, bullet_y3, bullet_z3);
                          GTA.Native.Function.Call("ADD_EXPLOSION", bullet_x3.ToInputParameter(), bullet_y3.ToInputParameter(), bullet_z3.ToInputParameter(), 1, 10.0f, 1, 0, 0);
                          bullet_range_l = 0.0f;



                          pd1 = World.GetPeds(zn_armup_l.GetOffsetPosition(new Vector3(bullet_range_l, 0.0f, 0.0f)), 6.0f, 2);
                          pd1_cnt = 0;
                          for (int length = pd1.Length; pd1_cnt < length; pd1_cnt++)
                          {
                              if (!Exists(pd1[pd1_cnt])) { continue; }
                              if (Exists(pd1[pd1_cnt]) == true && pd1[pd1_cnt].isAlive == true && pd1[pd1_cnt] != Player.Character && pd1[pd1_cnt].Money != 500)
                              {
                                  GTA.Native.Function.Call("SET_CHAR_ONLY_DAMAGED_BY_PLAYER", pd1[pd1_cnt], 0);
                              }
                          }


                      }
                      else
                      {
                          GTA.Native.Function.Call("GET_OFFSET_FROM_OBJECT_IN_WORLD_COORDS", zn_armup_l, bullet_range_l, -0.5f, -0.5f, bullet_x3, bullet_y3, bullet_z3);
                          bullet_range_l += 1.0f;
                          GTA.Native.Function.Call("GET_OFFSET_FROM_OBJECT_IN_WORLD_COORDS", zn_armup_l, bullet_range_l, 0.5f, 0.5f, bullet_x4, bullet_y4, bullet_z4);
                          if (GTA.Native.Function.Call<bool>("IS_AREA_OCCUPIED", bullet_x3.ToInputParameter(), bullet_y3.ToInputParameter(), bullet_z3.ToInputParameter(), bullet_x4.ToInputParameter(), bullet_y4.ToInputParameter(), bullet_z4.ToInputParameter(), 0, 1, 1, 1, 1)) //p,c,o?,o,?
                          {
                              GTA.Native.Function.Call("GET_OFFSET_FROM_OBJECT_IN_WORLD_COORDS", zn_armup_l, bullet_range_l, 0.0f, 0.0f, bullet_x3, bullet_y3, bullet_z3);
                              GTA.Native.Function.Call("ADD_EXPLOSION", bullet_x3.ToInputParameter(), bullet_y3.ToInputParameter(), bullet_z3.ToInputParameter(), 1, 10.0f, 1, 0, 0);
                              bullet_range_l = 0.0f;



                              pd1 = World.GetPeds(zn_armup_l.GetOffsetPosition(new Vector3(bullet_range_l, 0.0f, 0.0f)), 6.0f, 2);
                              pd1_cnt = 0;
                              for (int length = pd1.Length; pd1_cnt < length; pd1_cnt++)
                              {
                                  if (!Exists(pd1[pd1_cnt])) { continue; }
                                  if (Exists(pd1[pd1_cnt]) == true && pd1[pd1_cnt].isAlive == true && pd1[pd1_cnt] != Player.Character && pd1[pd1_cnt].Money != 500)
                                  {
                                      GTA.Native.Function.Call("SET_CHAR_ONLY_DAMAGED_BY_PLAYER", pd1[pd1_cnt], 0);
                                  }
                              }


                          }
                          else
                          {
                              GTA.Native.Function.Call("GET_OFFSET_FROM_OBJECT_IN_WORLD_COORDS", zn_armup_l, bullet_range_l, -0.5f, -0.5f, bullet_x3, bullet_y3, bullet_z3);
                              bullet_range_l += 1.0f;
                              GTA.Native.Function.Call("GET_OFFSET_FROM_OBJECT_IN_WORLD_COORDS", zn_armup_l, bullet_range_l, 0.5f, 0.5f, bullet_x4, bullet_y4, bullet_z4);
                              if (GTA.Native.Function.Call<bool>("IS_AREA_OCCUPIED", bullet_x3.ToInputParameter(), bullet_y3.ToInputParameter(), bullet_z3.ToInputParameter(), bullet_x4.ToInputParameter(), bullet_y4.ToInputParameter(), bullet_z4.ToInputParameter(), 0, 1, 1, 1, 1)) //p,c,o?,o,?
                              {
                                  GTA.Native.Function.Call("GET_OFFSET_FROM_OBJECT_IN_WORLD_COORDS", zn_armup_l, bullet_range_l, 0.0f, 0.0f, bullet_x3, bullet_y3, bullet_z3);
                                  GTA.Native.Function.Call("ADD_EXPLOSION", bullet_x3.ToInputParameter(), bullet_y3.ToInputParameter(), bullet_z3.ToInputParameter(), 1, 10.0f, 1, 0, 0);
                                  bullet_range_l = 0.0f;


                                  pd1 = World.GetPeds(zn_armup_l.GetOffsetPosition(new Vector3(bullet_range_l, 0.0f, 0.0f)), 6.0f, 2);
                                  pd1_cnt = 0;
                                  for (int length = pd1.Length; pd1_cnt < length; pd1_cnt++)
                                  {
                                      if (!Exists(pd1[pd1_cnt])) { continue; }
                                      if (Exists(pd1[pd1_cnt]) == true && pd1[pd1_cnt].isAlive == true && pd1[pd1_cnt] != Player.Character && pd1[pd1_cnt].Money != 500)
                                      {
                                          GTA.Native.Function.Call("SET_CHAR_ONLY_DAMAGED_BY_PLAYER", pd1[pd1_cnt], 0);
                                      }
                                  }


                              }
                              

                          }
                      }
                  }
              }
          }

          if (bullet_range_l >= 100.0f)
          {
              bullet_range_l = 0.0f;
          }
          

          #endregion
      }

      private void Wanzer_Aim()
      {
          #region AIM
          if //(DASH_flg == 1 && Game.isKeyPressed(System.Windows.Forms.Keys.LButton) || DASH_flg == 1 && GTA.Native.Function.Call<bool>("IS_BUTTON_PRESSED", 0, 4))
              //|| DASH_flg == 0 && Game.isKeyPressed(System.Windows.Forms.Keys.RButton) || DASH_flg == 0 && GTA.Native.Function.Call<bool>("IS_BUTTON_PRESSED", 0, 6))
              (Game.isKeyPressed(System.Windows.Forms.Keys.LButton) || GTA.Native.Function.Call<bool>("IS_BUTTON_PRESSED", 0, 4) || auto_attack > 0)
          {
              arm_timer = 0;
              //Vector3 startPosition = GetStartPosition();
              //GTA.Native.Function.Call(TRIGGER_PTFX, setting.TrajectoryEffect, startPosition.X, startPosition.Y, startPosition.Z, 0, 0, 0, 5.0f);
              //Light(System.Drawing.Blue, 3.0f, 3.0f, startPosition.X, startPosition.Y, startPosition.Z);
              //GTA.Native.Function.Call("START_PTFX", "ped_smoke_exhale", startPosition.X, startPosition.Y, startPosition.Z, 0.0f, 0.0f, 0.0f, 5.1f);


              Vector3 startPosition = GetStartPosition();
              //double rotX = Game.CurrentCamera.Rotation.X * TO_RADIAN;
              //double rotZ = Game.CurrentCamera.Rotation.Z * TO_RADIAN;
              //Game.CurrentCamera.Position + new Vector3((float)(Math.Sin(-rotZ) * Math.Cos(rotX)), (float)(Math.Cos(rotZ) * Math.Cos(rotX)), (float)Math.Sin(rotX)) * 50 - startPosition;
              //AddExplosion(startPosition);
              ////////////GTA.Native.Function.Call("ADD_EXPLOSION", startPosition.X, startPosition.Y, startPosition.Z, 0, 1.0f, 0, 0, 1.0f);

              GTA.Native.Pointer x = new GTA.Native.Pointer(typeof(float));
              GTA.Native.Pointer y = new GTA.Native.Pointer(typeof(float));
              GTA.Native.Pointer z = new GTA.Native.Pointer(typeof(float));
              GTA.Native.Pointer x2 = new GTA.Native.Pointer(typeof(float));
              GTA.Native.Pointer y2 = new GTA.Native.Pointer(typeof(float));
              GTA.Native.Pointer z2 = new GTA.Native.Pointer(typeof(float));
              GTA.Native.Pointer dist = new GTA.Native.Pointer(typeof(float));
              GTA.Native.Pointer dist2 = new GTA.Native.Pointer(typeof(float));



              GTA.Native.Function.Call("GET_OFFSET_FROM_OBJECT_IN_WORLD_COORDS", zn_body01, 4.0f, -50.0f, 0.0f, x, y, z);
              GTA.Native.Function.Call("GET_DISTANCE_BETWEEN_COORDS_2D", x.ToInputParameter(), y.ToInputParameter(), startPosition.X, startPosition.Y, dist);

              double rotX = Game.CurrentCamera.Rotation.X;
              if (dist >= 10.0f && rotX > 0.0f || dist >= 15.0f && rotX > -30.0f || dist >= 20.0f && rotX > -45.0f)
              {
                  float a = dist;
                  a /= 120.0f;
                  float b = angl_body01;
                  GTA.Native.Function.Call("GET_OFFSET_FROM_OBJECT_IN_WORLD_COORDS", zn_body01, 3.5f, -50.0f, 0.0f, x, y, z);
                  GTA.Native.Function.Call("GET_DISTANCE_BETWEEN_COORDS_2D", x.ToInputParameter(), y.ToInputParameter(), startPosition.X, startPosition.Y, dist);
                  GTA.Native.Function.Call("GET_OFFSET_FROM_OBJECT_IN_WORLD_COORDS", zn_body01, 4.7f, -50.0f, 0.0f, x2, y2, z2);
                  GTA.Native.Function.Call("GET_DISTANCE_BETWEEN_COORDS_2D", x2.ToInputParameter(), y2.ToInputParameter(), startPosition.X, startPosition.Y, dist2);

                  if (dist > dist2)
                  {
                      angl_body01 += a;
                      GTA.Native.Function.Call("ATTACH_OBJECT_TO_CAR", zn_body01, zn_core, 0, 0.0f, pos_body01, 1.5f, angl_body01_b, 0.0f, angl_body01);
                  }
                  else
                  {
                      angl_body01 -= a;
                      GTA.Native.Function.Call("ATTACH_OBJECT_TO_CAR", zn_body01, zn_core, 0, 0.0f, pos_body01, 1.5f, angl_body01_b, 0.0f, angl_body01);
                  }
              }


              if (weapon_num == 0 || weapon_num == 2)
              {
                  angl_armup_r_b = 0.0f;
                  angl_armup_r_c = -1.55f; //-1.55
                  GTA.Native.Function.Call("GET_OFFSET_FROM_OBJECT_IN_WORLD_COORDS", zn_armup_r, 55.0f, 9.0f, -9.0f, x, y, z);
                  //GTA.Native.Function.Call("ADD_EXPLOSION", x.ToInputParameter(), y.ToInputParameter(), z.ToInputParameter(), 0, 1.0f, 0, 0, 1.0f);
                  GTA.Native.Function.Call("GET_DISTANCE_BETWEEN_COORDS_3D", x.ToInputParameter(), y.ToInputParameter(), z.ToInputParameter(), startPosition.X, startPosition.Y, startPosition.Z, dist);
                  if (dist >= 20.0f && rotX > -40.0f || dist >= 25.0f && rotX > -50.0f)
                  {
                      float a = dist;
                      a /= 300.0f;
                      if (a > 0.3f)
                      {
                          a = 0.3f;
                      }
                      float b = angl_armup_r;
                      GTA.Native.Function.Call("GET_OFFSET_FROM_OBJECT_IN_WORLD_COORDS", zn_armup_r, 55.0f, 9.0f, -8.5f, x, y, z);
                      GTA.Native.Function.Call("GET_DISTANCE_BETWEEN_COORDS_3D", x.ToInputParameter(), y.ToInputParameter(), z.ToInputParameter(), startPosition.X, startPosition.Y, startPosition.Z, dist);
                      GTA.Native.Function.Call("GET_OFFSET_FROM_OBJECT_IN_WORLD_COORDS", zn_armup_r, 55.0f, 9.0f, -9.5f, x2, y2, z2);
                      GTA.Native.Function.Call("GET_DISTANCE_BETWEEN_COORDS_3D", x2.ToInputParameter(), y2.ToInputParameter(), z2.ToInputParameter(), startPosition.X, startPosition.Y, startPosition.Z, dist2);

                      if (dist > dist2)
                      {
                          angl_armup_r += a;
                          if (angl_armup_r > 3.2f)
                          {
                              angl_armup_r = 3.2f;
                              GTA.Native.Function.Call("ATTACH_OBJECT_TO_OBJECT", zn_armup_r, zn_body01, 0, -1.1f, pos_armup_r, 0.6f, angl_armup_r_b, angl_armup_r, angl_armup_r_c);  //o x x
                          }
                          else if (angl_armup_r > 3.9f)
                          {
                              angl_armup_r = 3.9f;
                              GTA.Native.Function.Call("ATTACH_OBJECT_TO_OBJECT", zn_armup_r, zn_body01, 0, -1.1f, pos_armup_r, 0.6f, angl_armup_r_b, angl_armup_r, angl_armup_r_c);  //o x x
                          }
                          else if (angl_armup_r < -0.3f)
                          {
                              angl_armup_r = -0.3f;
                              GTA.Native.Function.Call("ATTACH_OBJECT_TO_OBJECT", zn_armup_r, zn_body01, 0, -1.1f, pos_armup_r, 0.6f, angl_armup_r_b, angl_armup_r, angl_armup_r_c);  //o x x
                          }
                          else
                          {
                              GTA.Native.Function.Call("ATTACH_OBJECT_TO_OBJECT", zn_armup_r, zn_body01, 0, -1.1f, pos_armup_r, 0.6f, angl_armup_r_b, angl_armup_r, angl_armup_r_c);  //o x x
                          }
                          if (angl_body01_b >= 0.5f && !GTA.Native.Function.Call<bool>("IS_CAR_IN_AIR_PROPER", zn_core))
                          {
                              angl_armup_r -= 0.2f;
                              GTA.Native.Function.Call("ATTACH_OBJECT_TO_OBJECT", zn_armup_r, zn_body01, 0, -1.1f, pos_armup_r, 0.6f, angl_armup_r_b, angl_armup_r, angl_armup_r_c);  //o x x
                          }
                      }
                      else
                      {
                          angl_armup_r -= a;
                          if (angl_armup_r > 3.2f)
                          {
                              angl_armup_r = 3.2f;
                              GTA.Native.Function.Call("ATTACH_OBJECT_TO_OBJECT", zn_armup_r, zn_body01, 0, -1.1f, pos_armup_r, 0.6f, angl_armup_r_b, angl_armup_r, angl_armup_r_c);  //o x x
                          }
                          else if (angl_armup_r > 3.9f)
                          {
                              angl_armup_r = 3.9f;
                              GTA.Native.Function.Call("ATTACH_OBJECT_TO_OBJECT", zn_armup_r, zn_body01, 0, -1.1f, pos_armup_r, 0.6f, angl_armup_r_b, angl_armup_r, angl_armup_r_c);  //o x x
                          }
                          else if (angl_armup_r < -0.3f)
                          {
                              angl_armup_r = -0.3f;
                              GTA.Native.Function.Call("ATTACH_OBJECT_TO_OBJECT", zn_armup_r, zn_body01, 0, -1.1f, pos_armup_r, 0.6f, angl_armup_r_b, angl_armup_r, angl_armup_r_c);  //o x x
                          }
                          else
                          {
                              GTA.Native.Function.Call("ATTACH_OBJECT_TO_OBJECT", zn_armup_r, zn_body01, 0, -1.1f, pos_armup_r, 0.6f, angl_armup_r_b, angl_armup_r, angl_armup_r_c);  //o x x
                          }
                          if (angl_body01_b >= 0.5f && !GTA.Native.Function.Call<bool>("IS_CAR_IN_AIR_PROPER", zn_core))
                          {
                              angl_armup_r -= 0.2f;
                              GTA.Native.Function.Call("ATTACH_OBJECT_TO_OBJECT", zn_armup_r, zn_body01, 0, -1.1f, pos_armup_r, 0.6f, angl_armup_r_b, angl_armup_r, angl_armup_r_c);  //o x x
                          }
                      }

                  }
              }

              if (weapon_num == 1 || weapon_num == 2)
              {
                  angl_armup_l_b = 0.0f;
                  angl_armup_l_c = -1.55f; //-1.55
                  GTA.Native.Function.Call("GET_OFFSET_FROM_OBJECT_IN_WORLD_COORDS", zn_armup_l, 55.0f, 5.0f, -9.0f, x, y, z);
                  //GTA.Native.Function.Call("3", x.ToInputParameter(), y.ToInputParameter(), z.ToInputParameter(), 0, 1.0f, 0, 0, 1.0f);
                  GTA.Native.Function.Call("GET_DISTANCE_BETWEEN_COORDS_3D", x.ToInputParameter(), y.ToInputParameter(), z.ToInputParameter(), startPosition.X, startPosition.Y, startPosition.Z, dist);
                  if (dist >= 20.0f && rotX > -40.0f || dist >= 25.0f && rotX > -50.0f)
                  {
                      float a = dist;
                      a /= 300.0f;
                      if (a > 0.3f)
                      {
                          a = 0.3f;
                      }
                      float b = angl_armup_l;
                      GTA.Native.Function.Call("GET_OFFSET_FROM_OBJECT_IN_WORLD_COORDS", zn_armup_l, 55.0f, 5.0f, -8.5f, x, y, z);
                      GTA.Native.Function.Call("GET_DISTANCE_BETWEEN_COORDS_3D", x.ToInputParameter(), y.ToInputParameter(), z.ToInputParameter(), startPosition.X, startPosition.Y, startPosition.Z, dist);
                      GTA.Native.Function.Call("GET_OFFSET_FROM_OBJECT_IN_WORLD_COORDS", zn_armup_l, 55.0f, 5.0, -9.5f, x2, y2, z2);
                      GTA.Native.Function.Call("GET_DISTANCE_BETWEEN_COORDS_3D", x2.ToInputParameter(), y2.ToInputParameter(), z2.ToInputParameter(), startPosition.X, startPosition.Y, startPosition.Z, dist2);

                      if (dist > dist2)
                      {
                          angl_armup_l += a;
                          if (angl_armup_l > 3.2f)
                          {
                              angl_armup_l = 3.2f;
                              GTA.Native.Function.Call("ATTACH_OBJECT_TO_OBJECT", zn_armup_l, zn_body01, 0, 1.1f, pos_armup_l, 0.6f, angl_armup_l_b, angl_armup_l, angl_armup_l_c);  //o x x
                          }
                          else if (angl_armup_l > 3.9f)
                          {
                              angl_armup_l = 3.9f;
                              GTA.Native.Function.Call("ATTACH_OBJECT_TO_OBJECT", zn_armup_l, zn_body01, 0, 1.1f, pos_armup_l, 0.6f, angl_armup_l_b, angl_armup_l, angl_armup_l_c);  //o x x
                          }
                          else
                              if (angl_armup_l < -0.3f)
                              {
                                  angl_armup_l = -0.3f;
                                  GTA.Native.Function.Call("ATTACH_OBJECT_TO_OBJECT", zn_armup_l, zn_body01, 0, 1.1f, pos_armup_l, 0.6f, angl_armup_l_b, angl_armup_l, angl_armup_l_c);  //o x x
                              }
                              else
                              {
                                  GTA.Native.Function.Call("ATTACH_OBJECT_TO_OBJECT", zn_armup_l, zn_body01, 0, 1.1f, pos_armup_l, 0.6f, angl_armup_l_b, angl_armup_l, angl_armup_l_c);  //o x x
                              }
                          if (angl_body01_b >= 0.5f && !GTA.Native.Function.Call<bool>("IS_CAR_IN_AIR_PROPER", zn_core))
                          {
                              angl_armup_l -= 0.2f;
                              GTA.Native.Function.Call("ATTACH_OBJECT_TO_OBJECT", zn_armup_l, zn_body01, 0, 1.1f, pos_armup_l, 0.6f, angl_armup_l_b, angl_armup_l, angl_armup_l_c);  //o x x
                          }
                      }
                      else
                      {
                          angl_armup_l -= a;
                          if (angl_armup_l > 3.2f)
                          {
                              angl_armup_l = 3.2f;
                              GTA.Native.Function.Call("ATTACH_OBJECT_TO_OBJECT", zn_armup_l, zn_body01, 0, 1.1f, pos_armup_l, 0.6f, angl_armup_l_b, angl_armup_l, angl_armup_l_c);  //o x x
                          }
                          else if (angl_armup_l > 3.9f)
                          {
                              angl_armup_l = 3.9f;
                              GTA.Native.Function.Call("ATTACH_OBJECT_TO_OBJECT", zn_armup_l, zn_body01, 0, 1.1f, pos_armup_l, 0.6f, angl_armup_l_b, angl_armup_l, angl_armup_l_c);  //o x x
                          }
                          else if (angl_armup_l < -0.3f)
                          {
                              angl_armup_l = -0.3f;
                              GTA.Native.Function.Call("ATTACH_OBJECT_TO_OBJECT", zn_armup_l, zn_body01, 0, 1.1f, pos_armup_l, 0.6f, angl_armup_l_b, angl_armup_l, angl_armup_l_c);  //o x x
                          }
                          else
                          {
                              GTA.Native.Function.Call("ATTACH_OBJECT_TO_OBJECT", zn_armup_l, zn_body01, 0, 1.1f, pos_armup_l, 0.6f, angl_armup_l_b, angl_armup_l, angl_armup_l_c);  //o x x
                          }
                          if (angl_body01_b >= 0.5f && !GTA.Native.Function.Call<bool>("IS_CAR_IN_AIR_PROPER", zn_core))
                          {
                              angl_armup_l -= 0.2f;
                              GTA.Native.Function.Call("ATTACH_OBJECT_TO_OBJECT", zn_armup_l, zn_body01, 0, 1.1f, pos_armup_l, 0.6f, angl_armup_l_b, angl_armup_l, angl_armup_l_c);  //o x x
                          }
                      }

                  }
              }
          }
          else
          {
              arm_timer += 1;
          }
          #endregion
      }

      Vector3 GetStartPosition()
      {
          double rotX = Game.CurrentCamera.Rotation.X * TO_RADIAN;
          double rotZ = Game.CurrentCamera.Rotation.Z * TO_RADIAN;
          //return Player.Character.GetBonePosition(Bone.LeftHand) + new Vector3((float)(Math.Sin(-rotZ) * Math.Cos(rotX)), (float)(Math.Cos(rotZ) * Math.Cos(rotX)), (float)Math.Sin(rotX) + 0.1f);
          return Game.CurrentCamera.Position + new Vector3((float)(Math.Sin(-rotZ) * Math.Cos(rotX)), (float)(Math.Cos(rotZ) * Math.Cos(rotX)), (float)Math.Sin(rotX)) * 50;
      }

      private void Wanzer_Make()
      {
          #region Wanzer_Make

          zn_armup_l.Delete();
          zn_armup_r.Delete();
          zn_legup_l.Delete();
          zn_legup_r.Delete();
          zn_foot_l.Delete();
          zn_foot_r.Delete();
          zn_body01.Delete();
          zn_body02.Delete();
          zn_core.Delete();

          Game.DisplayText("wanzer making...1%", 3000);

          Wait(100);

          zn_armup_l = World.CreateObject("GB_candlestik01", Player.Character.Position.Around(100.5F));
          Wait(100);
          Game.DisplayText("wanzer making...5%", 3000);
          zn_armup_r = World.CreateObject("GB_comb01", Player.Character.Position.Around(100.5F));
          Wait(200);
          zn_foot_l = World.CreateObject("GB_hairdry02", Player.Character.Position.Around(100.5F));
          Wait(300);
          zn_foot_r = World.CreateObject("GB_hairdry02", Player.Character.Position.Around(100.5F));
          Wait(400);
          zn_legup_l = World.CreateObject("GB_cycler01", Player.Character.Position.Around(100.5F));
          Wait(500);
          zn_legup_r = World.CreateObject("GB_dumbbells", Player.Character.Position.Around(100.5F));
          Wait(600);

          Game.DisplayText("wanzer making...30%", 3000);
          
          while (!GTA.Native.Function.Call<bool>("DOES_OBJECT_EXIST", zn_armup_l)
             || !GTA.Native.Function.Call<bool>("DOES_OBJECT_EXIST", zn_armup_r)
             || !GTA.Native.Function.Call<bool>("DOES_OBJECT_EXIST", zn_legup_l)
             || !GTA.Native.Function.Call<bool>("DOES_OBJECT_EXIST", zn_legup_r)
             || !GTA.Native.Function.Call<bool>("DOES_OBJECT_EXIST", zn_foot_l)
             || !GTA.Native.Function.Call<bool>("DOES_OBJECT_EXIST", zn_foot_r))
          {
              Wait(0);
          }
          GTA.Native.Function.Call("SET_OBJECT_PROOFS", zn_armup_l, 1, 1, 1, 1, 1);
          GTA.Native.Function.Call("SET_OBJECT_PROOFS", zn_armup_r, 1, 1, 1, 1, 1);
          GTA.Native.Function.Call("SET_OBJECT_PROOFS", zn_legup_l, 1, 1, 1, 1, 1);
          GTA.Native.Function.Call("SET_OBJECT_PROOFS", zn_legup_r, 1, 1, 1, 1, 1);
          GTA.Native.Function.Call("SET_OBJECT_PROOFS", zn_foot_l, 1, 1, 1, 1, 1);
          GTA.Native.Function.Call("SET_OBJECT_PROOFS", zn_foot_r, 1, 1, 1, 1, 1);

          //Wait(200);

          GTA.Native.Function.Call("MARK_OBJECT_AS_NO_LONGER_NEEDED", zn_armup_l);
          GTA.Native.Function.Call("MARK_OBJECT_AS_NO_LONGER_NEEDED", zn_armup_r);
          GTA.Native.Function.Call("MARK_OBJECT_AS_NO_LONGER_NEEDED", zn_legup_l);
          GTA.Native.Function.Call("MARK_OBJECT_AS_NO_LONGER_NEEDED", zn_legup_r);
          GTA.Native.Function.Call("MARK_OBJECT_AS_NO_LONGER_NEEDED", zn_foot_l);
          GTA.Native.Function.Call("MARK_OBJECT_AS_NO_LONGER_NEEDED", zn_foot_r);

          Wait(500);

          zn_body01 = World.CreateObject("GB_MAKEUPbag01", Player.Character.Position.Around(100.5F));
          Wait(100);
          zn_body02 = World.CreateObject("GB_abductor", Player.Character.Position.Around(100.5F));
          Wait(200);

          Game.DisplayText("wanzer making...70%", 3000);

          while (!GTA.Native.Function.Call<bool>("DOES_OBJECT_EXIST", zn_body01)
             || !GTA.Native.Function.Call<bool>("DOES_OBJECT_EXIST", zn_body02))
          {
              Wait(0);
          }
          GTA.Native.Function.Call("SET_OBJECT_PROOFS", zn_body01, 1, 1, 1, 1, 1);
          GTA.Native.Function.Call("SET_OBJECT_PROOFS", zn_body02, 1, 1, 1, 1, 1);

          
          GTA.Native.Function.Call("MARK_OBJECT_AS_NO_LONGER_NEEDED", zn_body01);
          GTA.Native.Function.Call("MARK_OBJECT_AS_NO_LONGER_NEEDED", zn_body02);

          Wait(500);
          zn_core = World.CreateVehicle("Patriot", Player.Character.Position.Around(100.5F)); //Patrio
          Wait(800);

          Game.DisplayText("wanzer making...99%", 3000);

          while (!GTA.Native.Function.Call<bool>("DOES_VEHICLE_EXIST", zn_core))
          {
              Wait(0);
          }
          GTA.Native.Function.Call("SET_CAR_VISIBLE", zn_core, 0);
          GTA.Native.Function.Call("SET_CAR_STRONG", zn_core, 1);
          GTA.Native.Function.Call("SET_CAR_PROOFS", zn_core, 1, 1, 1, 1, 1);
          GTA.Native.Function.Call("LOCK_CAR_DOORS", zn_core, 2);
          GTA.Native.Function.Call("MARK_CAR_AS_CONVOY_CAR", zn_core, 1);

          pos_body = 1.5f;
          pos_leg = 1.1f;
          pos_armup_r = 0.0f;
          pos_armup_l = 0.0f;
          angl_body01 = 135.02f;
          angl_body01_b = 0.3f;
          angl_body02 = 0.3f;
          angl_armup_r = 0.4f;
          angl_armup_l = 0.4f;
          angl_armup_r_b = 0.0f;
          angl_armup_l_b = 0.0f;
          angl_armup_r_c = -1.55f;
          angl_armup_l_c = -1.55f;
          angl_legup_r_a = 0.7f;
          angl_legup_l_a = -0.7f;
          angl_legup_r_b = 0.0f;
          angl_legup_l_b = 0.0f;
          angl_foot_r_a = -0.7f;
          angl_foot_l_a = 0.7f;
          angl_foot_r_b = 0.0f;
          angl_foot_l_b = 0.0f;



          GTA.Native.Function.Call("ATTACH_OBJECT_TO_OBJECT", zn_armup_l, zn_body01, 0, 1.1f, pos_armup_l, 0.6f, angl_armup_l_b, angl_armup_l, angl_armup_l_c);  //o x x
          GTA.Native.Function.Call("ATTACH_OBJECT_TO_OBJECT", zn_armup_r, zn_body01, 0, -1.1f, pos_armup_r, 0.6f, angl_armup_r_b, angl_armup_r, angl_armup_r_c); //o x x
          Wait(100);
          GTA.Native.Function.Call("ATTACH_OBJECT_TO_OBJECT", zn_foot_l, zn_legup_l, 0, 0.0f, 0.0f, -1.5f, angl_foot_l_a, angl_foot_l_b, 0.1f);  //o x x
          GTA.Native.Function.Call("ATTACH_OBJECT_TO_OBJECT", zn_foot_r, zn_legup_r, 0, 0.0f, 0.0f, -1.5f, angl_foot_r_a, angl_foot_r_b, -0.1f); //o x x
          Wait(100);
          GTA.Native.Function.Call("ATTACH_OBJECT_TO_CAR", zn_legup_l, zn_core, 0, -0.7f, 0.0f, 1.1f, angl_legup_l_a, angl_legup_l_b, 135.02f);  //o x x
          GTA.Native.Function.Call("ATTACH_OBJECT_TO_CAR", zn_legup_r, zn_core, 0, 0.7f, 0.0f, 1.1f, angl_legup_r_a, angl_legup_r_b, 135.02f); //o x x
          Wait(100);
          GTA.Native.Function.Call("ATTACH_OBJECT_TO_CAR", zn_body02, zn_core, 0, 0.0f, 0.0f, 1.5f, angl_body02, 0.0f, 135.02f);
          GTA.Native.Function.Call("ATTACH_OBJECT_TO_CAR", zn_body01, zn_core, 0, 0.0f, pos_body01, 1.5f, angl_body01_b, 0.0f, angl_body01);

          if (GTA.Native.Function.Call<bool>("DOES_VEHICLE_EXIST", zn_core) && !GTA.Native.Function.Call<bool>("IS_CAR_DEAD", zn_core)
              && !GTA.Native.Function.Call<bool>("DOES_BLIP_EXIST", zn_blip))
          {
              zn_blip = GTA.Blip.AddBlip(zn_core);
              zn_blip.Name = "WANZER";
              //Blip exampleblip = GTA.Blip.AddBlip(zn_core);
          }


          if (GTA.Native.Function.Call<bool>("IS_CHAR_IN_AREA_3D", Player.Character, 494.597f, 1285.141f, -90.89f, 694.597f, 1485.141f, 110.89f))
          {
              GTA.Native.Function.Call("SET_CAR_COORDINATES", zn_core, 594.597f, 1385.141f, 10.89f);
              GTA.Native.Function.Call("SET_CAR_HEADING", zn_core, 90.0f);
          }
          if (GTA.Native.Function.Call<bool>("IS_CHAR_IN_AREA_3D", Player.Character, 800.353f, -608.049f, -85.006f, 1000.353f, -408.049f, 115.006f))
          {
              GTA.Native.Function.Call("SET_CAR_COORDINATES", zn_core, 900.353f, -508.049f, 15.006f);
              GTA.Native.Function.Call("SET_CAR_HEADING", zn_core, 270.0f);
          }
          if (GTA.Native.Function.Call<bool>("IS_CHAR_IN_AREA_3D", Player.Character, -521.959f, 1387.988f, -90.606f, -321.959f, 1587.988f, 118.606f))
          {
              GTA.Native.Function.Call("SET_CAR_COORDINATES", zn_core, -421.959f, 1487.988f, 18.606f);
              GTA.Native.Function.Call("SET_CAR_HEADING", zn_core, 0.0f);
          }
          if (GTA.Native.Function.Call<bool>("IS_CHAR_IN_AREA_3D", Player.Character, 13.209f, 738.872f, -90.476f, 213.209f, 938.872f, 114.476f))
          {
              GTA.Native.Function.Call("SET_CAR_COORDINATES", zn_core, 113.209f, 838.872f, 14.476f);
              GTA.Native.Function.Call("SET_CAR_HEADING", zn_core, 270.0f);
          }
          if (GTA.Native.Function.Call<bool>("IS_CHAR_IN_AREA_3D", Player.Character, -1057.202f, 795.272f, -90.424f, -857.202f, 995.272f, 113.424f))
          {
              GTA.Native.Function.Call("SET_CAR_COORDINATES", zn_core, -957.202f, 895.272f, 13.424f);
              GTA.Native.Function.Call("SET_CAR_HEADING", zn_core, 0.0f);
          }

          //tlad
          if (GTA.Native.Function.Call<bool>("IS_CHAR_IN_AREA_3D", Player.Character, -1827.169f, 263.704f, 0.191, -1627.169f, 463.704f, 100.191f))
          {
              GTA.Native.Function.Call("SET_CAR_COORDINATES", zn_core, -1727.169f, 363.704f, 25.191f);
              GTA.Native.Function.Call("SET_CAR_HEADING", zn_core, 315.0f);
          }

          if (GTA.Native.Function.Call<bool>("IS_CHAR_IN_AREA_3D", Player.Character, -2041.986f, -128.879f, -20.423f, -1841.986f, -28.879f, 100.423f))
          {
              GTA.Native.Function.Call("SET_CAR_COORDINATES", zn_core, -1941.986f, -78.879f, 6.423f);
              GTA.Native.Function.Call("SET_CAR_HEADING", zn_core, 180.0f);
          }
          //


          //tbogt
          if (GTA.Native.Function.Call<bool>("IS_CHAR_IN_AREA_3D", Player.Character, -489.024f, 1331.316f, 0.741f, -389.024f, 1431.316f, 60.741f))
          {
              GTA.Native.Function.Call("SET_CAR_COORDINATES", zn_core, -439.024f, 1381.316f, 15.741f);
              GTA.Native.Function.Call("SET_CAR_HEADING", zn_core, 80.0f);
          }
          //


          #endregion
      }

      private void Wanzer_RQ()
      {
          #region Wanzer_RQ
          while (!GTA.Native.Function.Call<bool>("HAS_MODEL_LOADED", "GB_candlestik01"))
          {
              GTA.Native.Function.Call("REQUEST_MODEL", "GB_candlestik01");
              Wait(100);
          }
          while (!GTA.Native.Function.Call<bool>("HAS_MODEL_LOADED", "GB_comb01"))
          {
              GTA.Native.Function.Call("REQUEST_MODEL", "GB_comb01");
              Wait(100);
          }
          while (!GTA.Native.Function.Call<bool>("HAS_MODEL_LOADED", "GB_cycler01"))
          {
              GTA.Native.Function.Call("REQUEST_MODEL", "GB_cycler01");
              Wait(100);
          }
          while (!GTA.Native.Function.Call<bool>("HAS_MODEL_LOADED", "GB_dumbbells"))
          {
              GTA.Native.Function.Call("REQUEST_MODEL", "GB_dumbbells");
              Wait(100);
          }
          while (!GTA.Native.Function.Call<bool>("HAS_MODEL_LOADED", "GB_hairdry02"))
          {
              GTA.Native.Function.Call("REQUEST_MODEL", "GB_hairdry02");
              Wait(100);
          }
          while (!GTA.Native.Function.Call<bool>("HAS_MODEL_LOADED", "Patriot"))
          {
              GTA.Native.Function.Call("REQUEST_MODEL", "Patriot");
              Wait(300);
          }
          #endregion
      }



   }
}