Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- /*
- THIS FILE IS A PART OF GTA V SCRIPT HOOK SDK
- http://dev-c.com
- (C) Alexander Blade 2015
- */
- #pragma warning(disable:4996)
- #include <windows.h>
- #include <stdio.h>
- #include <string>
- #include <stdint.h>
- #include <iostream>
- #include <fstream>
- #include <sstream>
- using namespace std;
- #include "script.h"
- #include <string>
- #include <ctime>
- struct Buttons {
- int GearUp, GearDown, EnableDisable;
- };
- Buttons Pressed;
- void loadConfig(Buttons& config) {
- ifstream fin("MTconfigMod.ini");
- string line;
- while (getline(fin, line)) {
- istringstream sin(line.substr(line.find("=") + 1));
- if (line.find("GearUp") != -1)
- sin >> config.GearUp;
- else if (line.find("GearDown") != -1)
- sin >> config.GearDown;
- else if (line.find("Enable/Disable") != 1)
- sin >> config.EnableDisable;
- }
- }
- ifstream ConfigFile("MTconfigMod.ini");
- void LB()
- {
- if (ConfigFile)
- {
- loadConfig(Pressed);
- }
- }
- void max_speed(int entity, float speed)
- {
- ENTITY::SET_ENTITY_MAX_SPEED(entity, speed);
- }
- bool MT = true;
- int Gear = 1;
- bool ConfigLoaded = false;
- bool Gear3Launch = false;
- void ManualTransmission()
- {
- reset_globals();
- while (true)
- {
- if (!ConfigLoaded)
- {
- LB();
- ConfigLoaded = true;
- }
- unsigned int model = GetHash("taxi");
- if (get_key_pressed(Keys::ADD))
- {
- MT = !MT;
- MT ? ShowText("Manual Transmission ~g~Enabled~w~!") : ShowText("Manual Transmission ~r~Disabled~w~!");
- WAIT(50);
- }
- if (MT)
- {
- if (is_ped_in_any_vehicle(player_ped_id()))
- {
- float speed = ENTITY::GET_ENTITY_SPEED(vehid());
- float acceleration = VEHICLE::GET_VEHICLE_ACCELERATION(vehid());
- float FirstMax = 21.0f;
- float SecondMax = 31.0f;
- float ThirdMax = 40.5f;
- float ForthMax = 60.5f;
- float FifthMax = 90.5f;
- switch (Gear)
- {
- case 1:
- GearSc("1", 0.015, 0.015);
- if (speed > FirstMax)
- {
- float curr = ENTITY::GET_ENTITY_SPEED(vehid());
- max_speed(vehid(), curr);
- }
- else
- {
- max_speed(vehid(), FirstMax);
- }
- break;
- case 2:
- GearSc("2", 0.015, 0.015);
- if (speed > SecondMax)
- {
- float curr = ENTITY::GET_ENTITY_SPEED(vehid());
- max_speed(vehid(), curr);
- }
- else
- {
- max_speed(vehid(), SecondMax);
- }
- break;
- case 3:
- GearSc("3", 0.015, 0.015);
- if (speed > ThirdMax)
- {
- float curr = ENTITY::GET_ENTITY_SPEED(vehid());
- max_speed(vehid(), curr);
- }
- else
- {
- max_speed(vehid(), ThirdMax);
- }
- break;
- case 4:
- GearSc("4", 0.015, 0.015);
- if (speed > ForthMax)
- {
- float curr = ENTITY::GET_ENTITY_SPEED(vehid());
- max_speed(vehid(), curr);
- }
- else
- {
- max_speed(vehid(), ForthMax);
- }
- break;
- case 5:
- GearSc("5", 0.015, 0.015);
- if (speed > FifthMax)
- {
- float curr = ENTITY::GET_ENTITY_SPEED(vehid());
- max_speed(vehid(), curr);
- }
- else
- {
- max_speed(vehid(), FifthMax);
- }
- break;
- case 6:
- GearSc("6", 0.015, 0.015);
- max_speed(vehid(), 9999);
- break;
- }
- if (get_key_pressed(Pressed.GearUp))
- {
- switch (Gear)
- {
- case 1:
- Gear = 2;
- break;
- case 2:
- Gear = 3;
- break;
- case 3:
- Gear = 4;
- break;
- case 4:
- Gear = 5;
- break;
- case 5:
- Gear = 6;
- break;
- }
- WAIT(50);
- }
- else if (get_key_pressed(Pressed.GearDown))
- {
- switch (Gear)
- {
- case 1:
- Gear = 1;
- break;
- case 2:
- Gear = 1;
- break;
- case 3:
- Gear = 3;
- break;
- case 4:
- Gear = 3;
- break;
- case 5:
- Gear = 4;
- break;
- case 6:
- Gear = 5;
- break;
- }
- WAIT(50);
- }
- if (Gear == 2 && speed <= FirstMax - 2.1f)
- {
- if (get_key_pressed(Keys::W))
- {
- VEHICLE::SET_VEHICLE_ENGINE_ON(vehid(), 0, 0);
- }
- }
- else if (Gear == 3 && speed <= SecondMax - 2.1f)
- {
- if (get_key_pressed(Keys::W))
- {
- VEHICLE::SET_VEHICLE_ENGINE_ON(vehid(), 0, 0);
- }
- }
- else if (Gear == 4 && speed <= ThirdMax - 2.1f)
- {
- if (get_key_pressed(Keys::W))
- {
- VEHICLE::SET_VEHICLE_ENGINE_ON(vehid(), 0, 0);
- }
- }
- else if (Gear == 5 && speed <= ForthMax - 2.1f)
- {
- if (get_key_pressed(Keys::W))
- {
- VEHICLE::SET_VEHICLE_ENGINE_ON(vehid(), 0, 0);
- }
- }
- else if (Gear == 6 && speed <= FifthMax - 2.1f)
- {
- if (get_key_pressed(Keys::W))
- {
- VEHICLE::SET_VEHICLE_ENGINE_ON(vehid(), 0, 0);
- }
- }
- if (Gear != 1 && VEHICLE::IS_VEHICLE_STOPPED(vehid()))
- {
- if (get_key_pressed(Keys::W))
- {
- VEHICLE::SET_VEHICLE_ENGINE_ON(vehid(), 0, 0);
- }
- }
- }
- }
- else if (!MT || ENTITY::GET_ENTITY_MODEL(vehid()) == model)
- {
- max_speed(vehid(), 9999);
- Gear = 1;
- }
- /*--------------*/
- update_features();
- WAIT(0);
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement