Advertisement
Guest User

MTContinued1

a guest
Jun 13th, 2015
316
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 10.33 KB | None | 0 0
  1.    
  2.  
  3.     /*
  4.             THIS FILE IS A PART OF GTA V SCRIPT HOOK SDK
  5.                                     http://dev-c.com                      
  6.                             (C) Alexander Blade 2015
  7.     */
  8.     #pragma warning(disable:4996)
  9.     #include <windows.h>
  10.     #include <stdio.h>
  11.     #include <string>
  12.     #include <stdint.h>
  13.     #include <iostream>
  14.     #include <fstream>
  15.     #include <sstream>
  16.     using namespace std;
  17.     #include "script.h"
  18.     #include <string>
  19.     #include <ctime>
  20.      
  21.     struct Buttons {
  22.             int GearUp, GearDown, EnableDisable;
  23.     };
  24.     Buttons Pressed;
  25.      
  26.     void loadConfig(Buttons& config) {
  27.             ifstream fin("MTconfigMod.ini");
  28.             string line;
  29.             while (getline(fin, line)) {
  30.                     istringstream sin(line.substr(line.find("=") + 1));
  31.                     if (line.find("GearUp") != -1)
  32.                             sin >> config.GearUp;
  33.                     else if (line.find("GearDown") != -1)
  34.                             sin >> config.GearDown;
  35.                     else if (line.find("Enable/Disable") != 1)
  36.                             sin >> config.EnableDisable;
  37.             }
  38.     }
  39.      
  40.     ifstream ConfigFile("MTconfigMod.ini");
  41.     void LB()
  42.     {
  43.             if (ConfigFile)
  44.             {
  45.                     loadConfig(Pressed);
  46.             }
  47.     }
  48.      
  49.     void max_speed(int entity, float speed)
  50.     {
  51.             ENTITY::SET_ENTITY_MAX_SPEED(entity, speed);
  52.     }
  53.      
  54.     bool MT = true;
  55.     int Gear = 1;
  56.     bool ConfigLoaded = false;
  57.     bool Gear3Launch = false;
  58.     void ManualTransmission()
  59.     {
  60.             reset_globals();
  61.             while (true)
  62.             {
  63.      
  64.                     if (!ConfigLoaded)
  65.                     {
  66.                             LB();
  67.                             ConfigLoaded = true;
  68.                     }
  69.      
  70.                     unsigned int model = GetHash("taxi");
  71.      
  72.                     if (get_key_pressed(Keys::ADD))
  73.                     {
  74.                             MT = !MT;
  75.                             MT ? ShowText("Manual Transmission ~g~Enabled~w~!") : ShowText("Manual Transmission ~r~Disabled~w~!");
  76.                             WAIT(50);
  77.                     }
  78.      
  79.                     if (MT)
  80.                     {                      
  81.                             if (is_ped_in_any_vehicle(player_ped_id()))
  82.                             {
  83.                                     float speed = ENTITY::GET_ENTITY_SPEED(vehid());
  84.                                     float acceleration = VEHICLE::GET_VEHICLE_ACCELERATION(vehid());
  85.                                     float FirstMax = 21.0f;
  86.                                     float SecondMax = 31.0f;
  87.                                     float ThirdMax = 40.5f;
  88.                     float ForthMax = 60.5f;
  89.                     float FifthMax = 90.5f;
  90.                         switch (Gear)
  91.                     {
  92.                     case 1:
  93.                                             GearSc("1", 0.015, 0.015);
  94.                                             if (speed > FirstMax)
  95.                                             {
  96.                                                     float curr = ENTITY::GET_ENTITY_SPEED(vehid());
  97.                                                     max_speed(vehid(), curr);
  98.                                             }
  99.                                             else
  100.                                             {
  101.                                                     max_speed(vehid(), FirstMax);
  102.                                             }
  103.                     break;
  104.  
  105.                     case 2:
  106.                                             GearSc("2", 0.015, 0.015);
  107.                                             if (speed > SecondMax)
  108.                                             {
  109.                                                     float curr = ENTITY::GET_ENTITY_SPEED(vehid());
  110.                                                     max_speed(vehid(), curr);
  111.                                             }
  112.                                             else
  113.                                             {
  114.                                                     max_speed(vehid(), SecondMax);
  115.                                             }
  116.                     break;
  117.  
  118.                     case 3:
  119.                                             GearSc("3", 0.015, 0.015);
  120.                                             if (speed > ThirdMax)
  121.                                             {
  122.                                                     float curr = ENTITY::GET_ENTITY_SPEED(vehid());
  123.                                                     max_speed(vehid(), curr);
  124.                                             }
  125.                                             else
  126.                                             {
  127.                                                     max_speed(vehid(), ThirdMax);
  128.                                             }
  129.                     break;
  130.  
  131.                     case 4:
  132.                                             GearSc("4", 0.015, 0.015);
  133.                                             if (speed > ForthMax)
  134.                                             {
  135.                                                     float curr = ENTITY::GET_ENTITY_SPEED(vehid());
  136.                                                     max_speed(vehid(), curr);
  137.                                             }
  138.                                             else
  139.                                             {
  140.                                                     max_speed(vehid(), ForthMax);
  141.                                             }
  142.                     break;
  143.  
  144.                     case 5:
  145.                                             GearSc("5", 0.015, 0.015);
  146.                                             if (speed > FifthMax)
  147.                                             {
  148.                                                     float curr = ENTITY::GET_ENTITY_SPEED(vehid());
  149.                                                     max_speed(vehid(), curr);
  150.                                             }
  151.                                             else
  152.                                             {
  153.                                                     max_speed(vehid(), FifthMax);
  154.                                             }
  155.                     break;
  156.                
  157.                     case 6:
  158.                                             GearSc("6", 0.015, 0.015);
  159.                                             max_speed(vehid(), 9999);
  160.                     break;
  161.                     }
  162.  
  163.                                     if (get_key_pressed(Pressed.GearUp))
  164.                                             {
  165.                           switch (Gear)
  166.                           {
  167.                             case 1:
  168.                                 Gear = 2;
  169.                                 break;
  170.                             case 2:
  171.                                 Gear = 3;
  172.                                 break;
  173.                             case 3:
  174.                                 Gear = 4;
  175.                                 break;
  176.                             case 4:
  177.                                 Gear = 5;
  178.                                 break;
  179.                             case 5:
  180.                                 Gear = 6;
  181.                                 break;
  182.                           }
  183.                           WAIT(50);
  184.                                             }
  185.                                             else if (get_key_pressed(Pressed.GearDown))
  186.                                             {
  187.                           switch (Gear)
  188.                           {
  189.                             case 1:
  190.                                 Gear = 1;
  191.                                 break;
  192.                             case 2:
  193.                                 Gear = 1;
  194.                                 break;
  195.                             case 3:
  196.                                 Gear = 3;
  197.                                 break;
  198.                             case 4:
  199.                                 Gear = 3;
  200.                                 break;
  201.                             case 5:
  202.                                 Gear = 4;
  203.                                 break;
  204.                             case 6:
  205.                                 Gear = 5;
  206.                                 break;
  207.                           }
  208.                           WAIT(50);
  209.                                             }
  210.      
  211.      
  212.                                     if (Gear == 2 && speed <= FirstMax - 2.1f)
  213.                                     {
  214.                                             if (get_key_pressed(Keys::W))
  215.                                             {
  216.                                                     VEHICLE::SET_VEHICLE_ENGINE_ON(vehid(), 0, 0);
  217.                                             }
  218.                                     }
  219.                                     else if (Gear == 3 && speed <= SecondMax - 2.1f)
  220.                                     {
  221.                                             if (get_key_pressed(Keys::W))
  222.                                             {
  223.                                                     VEHICLE::SET_VEHICLE_ENGINE_ON(vehid(), 0, 0);
  224.                                             }
  225.                                     }
  226.                                     else if (Gear == 4 && speed <= ThirdMax - 2.1f)
  227.                                     {
  228.                                             if (get_key_pressed(Keys::W))
  229.                                             {
  230.                                                     VEHICLE::SET_VEHICLE_ENGINE_ON(vehid(), 0, 0);
  231.                                             }
  232.                                     }
  233.  
  234.                                     else if (Gear == 5 && speed <= ForthMax - 2.1f)
  235.                                     {
  236.                                             if (get_key_pressed(Keys::W))
  237.                                             {
  238.                                                     VEHICLE::SET_VEHICLE_ENGINE_ON(vehid(), 0, 0);
  239.                                             }
  240.                                     }
  241.  
  242.                                     else if (Gear == 6 && speed <= FifthMax - 2.1f)
  243.                                     {
  244.                                             if (get_key_pressed(Keys::W))
  245.                                             {
  246.                                                     VEHICLE::SET_VEHICLE_ENGINE_ON(vehid(), 0, 0);
  247.                                             }
  248.                                     }
  249.  
  250.                                     if (Gear != 1 && VEHICLE::IS_VEHICLE_STOPPED(vehid()))
  251.                                     {
  252.                                             if (get_key_pressed(Keys::W))
  253.                                             {
  254.                                                     VEHICLE::SET_VEHICLE_ENGINE_ON(vehid(), 0, 0);
  255.                                             }
  256.                                     }
  257.      
  258.      
  259.                             }
  260.                     }
  261.                     else if (!MT || ENTITY::GET_ENTITY_MODEL(vehid()) == model)
  262.                     {
  263.                             max_speed(vehid(), 9999);
  264.                             Gear = 1;
  265.                     }
  266.                     /*--------------*/
  267.                     update_features();
  268.                     WAIT(0);
  269.             }
  270.     }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement