Advertisement
Guest User

Untitled

a guest
Oct 23rd, 2017
190
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.75 KB | None | 0 0
  1. #define _SILENCE_STDEXT_HASH_DEPRECATION_WARNINGS
  2. #include <windows.h>
  3. #include <string>
  4. #include <assert.h>
  5. #include <process.h>
  6. #include "SAMPFUNCS_API.h"
  7. #include "game_api\game_api.h"
  8.  
  9. SAMPFUNCS *SF = new SAMPFUNCS();
  10.  
  11. static DWORD time[3];
  12. bool actTP[3], act_wait[3];
  13. float mapPos[3];
  14.  
  15. void potok3(){
  16. actTP[2] = false;
  17. act_wait[2] = false;
  18. }
  19.  
  20. void potok2() {
  21. actTP[0] = false;
  22. act_wait[1] = false;
  23. actTP[1] = false;
  24. act_wait[2] = true;
  25. time[2] = GetTickCount();
  26. //SF->getCLEO()->callOpcode("02EB: restore_camera_with_jumpcut");
  27.  
  28. }
  29. void potok() {
  30. mapPos[2] = GAME->GetWorld()->FindGroundZForPosition(mapPos[0], mapPos[1]);
  31. PEDSELF->Teleport(mapPos[0], mapPos[1], mapPos[2] + 0.5f);
  32. act_wait[1] = true;
  33. time[1] = GetTickCount();
  34. act_wait[0] = false;
  35. }
  36.  
  37. void CALLBACK TeleportActor(std::string)
  38. {
  39. actTP[0], actTP[1], actTP[2] = true;
  40. SF->getSAMP()->requestClass(1);
  41. {
  42. if ((*(int *)0xBA6774 != 0))
  43. {
  44. for (int i = 0; i < (0xAF * 0x28); i += 0x28)
  45. {
  46. if (*(short *)(0xBA873D + i) == 4611)
  47. {
  48. float *pos = (float *)(0xBA86F8 + 0x28 + i);
  49. mapPos[0] = *pos;
  50. mapPos[1] = *(pos + 1);
  51. mapPos[2] = GAME->GetWorld()->FindGroundZForPosition(pos[0], pos[1]) + 1.0f;
  52. PEDSELF->Teleport(mapPos[0], mapPos[1], mapPos[2]);
  53. time[0] = GetTickCount();
  54. act_wait[0] = true;
  55. }
  56. }
  57. }
  58. }
  59. }
  60.  
  61.  
  62.  
  63. bool CALLBACK incomingRPC(stRakNetHookParams *params) {
  64. if (params->packetId == RPCEnumeration::RPC_RequestSpawn && actTP[0]) return false;
  65.  
  66. if (params->packetId == ScriptRPCEnumeration::RPC_ScrShowTextDraw && actTP[1]) return false;
  67.  
  68. if (params->packetId == ScriptRPCEnumeration::RPC_ScrTogglePlayerControllable && actTP[2]) return false;
  69.  
  70. }
  71.  
  72.  
  73. void CALLBACK mainloop()
  74. {
  75. static bool init = false;
  76. if (!init)
  77. {
  78. if (GAME == nullptr)
  79. return;
  80. if (GAME->GetSystemState() != eSystemState::GS_PLAYING_GAME)
  81. return;
  82. if (!SF->getSAMP()->IsInitialized())
  83. return;
  84. SF->getSAMP()->registerChatCommand("atp", TeleportActor);
  85.  
  86. SF->getSAMP()->getChat()->AddChatMessage(0xFFFFFF, "FastTeleport for Arizona-Rp by {01fcff}Jenek Bueno {ffffff}loaded.");
  87.  
  88. SF->getRakNet()->registerRakNetCallback(RakNetScriptHookType::RAKHOOK_TYPE_INCOMING_RPC, incomingRPC);
  89.  
  90. init = true;
  91. }
  92. if (act_wait && GetTickCount() - time[0] > 50) potok();
  93. if (act_wait && GetTickCount() - time[1] > 1500) potok2();
  94. if (act_wait && GetTickCount() - time[2] > 5000) potok3();
  95.  
  96. }
  97.  
  98. BOOL APIENTRY DllMain(HMODULE hModule, DWORD dwReasonForCall, LPVOID lpReserved)
  99. {
  100. switch (dwReasonForCall)
  101. {
  102. case DLL_PROCESS_ATTACH:
  103. SF->initPlugin(mainloop, hModule);
  104. break;
  105. case DLL_THREAD_ATTACH:
  106. case DLL_THREAD_DETACH:
  107. case DLL_PROCESS_DETACH:
  108. break;
  109. }
  110. return TRUE;
  111. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement