Advertisement
Guest User

Untitled

a guest
Jun 7th, 2015
510
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.08 KB | None | 0 0
  1. /*
  2. THIS FILE IS A PART OF GTA V SCRIPT HOOK SDK
  3. http://dev-c.com
  4. (C) Alexander Blade 2015
  5. */
  6.  
  7. #include "script.h"
  8.  
  9. #include <string>
  10. #include <ctime>
  11.  
  12. bool get_key_pressed(int nVirtKey)
  13. {
  14. return (GetAsyncKeyState(nVirtKey) & 0x8000) != 0;
  15. }
  16.  
  17. DWORD trainerResetTime = 0;
  18.  
  19. bool mod_switch_pressed()
  20. {
  21. return (GetTickCount() > trainerResetTime + 1000) && get_key_pressed(VK_F4);
  22. }
  23.  
  24. void reset_mod_switch()
  25. {
  26. trainerResetTime = GetTickCount();
  27. }
  28.  
  29. std::string statusText;
  30. DWORD statusTextDrawTicksMax;
  31. bool statusTextGxtEntry;
  32.  
  33. void update_status_text()
  34. {
  35. if (GetTickCount() < statusTextDrawTicksMax)
  36. {
  37. UI::SET_TEXT_FONT(0);
  38. UI::SET_TEXT_SCALE(0.55, 0.55);
  39. UI::SET_TEXT_COLOUR(255, 255, 255, 255);
  40. UI::SET_TEXT_WRAP(0.0, 1.0);
  41. UI::SET_TEXT_CENTRE(1);
  42. UI::SET_TEXT_DROPSHADOW(0, 0, 0, 0, 0);
  43. UI::SET_TEXT_EDGE(1, 0, 0, 0, 205);
  44. if (statusTextGxtEntry)
  45. {
  46. UI::_SET_TEXT_ENTRY((char *)statusText.c_str());
  47. } else
  48. {
  49. UI::_SET_TEXT_ENTRY("STRING");
  50. UI::_ADD_TEXT_COMPONENT_STRING((char *)statusText.c_str());
  51. }
  52. UI::_DRAW_TEXT(0.5, 0.5);
  53. }
  54. }
  55.  
  56. void set_status_text(std::string str, DWORD time = 2500, bool isGxtEntry = false)
  57. {
  58. statusText = str;
  59. statusTextDrawTicksMax = GetTickCount() + time;
  60. statusTextGxtEntry = isGxtEntry;
  61. }
  62.  
  63. inline std::string BoolToString(bool state)
  64. {
  65. return state ? "Enabled" : "Disabled";
  66. }
  67.  
  68. bool modEnabled = false;
  69.  
  70. void main()
  71. {
  72. while (true)
  73. {
  74. if (mod_switch_pressed())
  75. {
  76. reset_mod_switch();
  77. DWORD time = GetTickCount() + 1000;
  78.  
  79. modEnabled = !modEnabled;
  80. PLAYER::SET_PLAYER_INVINCIBLE(PLAYER::PLAYER_ID(), modEnabled);
  81.  
  82. set_status_text("FirstMod" + BoolToSring(modEnabled));
  83.  
  84. while (GetTickCount() < time)
  85. {
  86. update_status_text();
  87. WAIT(0);
  88. }
  89. reset_mod_switch();
  90. }
  91.  
  92. if (modEnabled)
  93. {
  94. Player player = PLAYER::PLAYER_ID();
  95.  
  96. if (PLAYER::GET_PLAYER_WANTED_LEVEL(player) > 0)
  97. PLAYER::SET_PLAYER_WANTED_LEVEL(player, 0, true);
  98. }
  99. WAIT(0);
  100. }
  101. }
  102.  
  103. void ScriptMain()
  104. {
  105. srand(GetTickCount());
  106. main();
  107. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement