Advertisement
Guest User

Untitled

a guest
Oct 22nd, 2017
70
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.80 KB | None | 0 0
  1. #define _SILENCE_STDEXT_HASH_DEPRECATION_WARNINGS
  2.  
  3. #include <windows.h>
  4. #include <string>
  5. #include <assert.h>
  6. #include <process.h>
  7.  
  8. #include "SAMPFUNCS_API.h"
  9. #include "game_api\game_api.h"
  10.  
  11. SAMPFUNCS *SF = new SAMPFUNCS();
  12.  
  13. bool ActTeleportActor;
  14. DWORD time;
  15.  
  16. bool Timer;
  17. float mapPos[3];
  18.  
  19. void Timer1()
  20. {
  21. mapPos[2] = GAME->GetWorld()->FindGroundZForPosition(mapPos[0], mapPos[1]);
  22. PEDSELF->Teleport(mapPos[0], mapPos[1], mapPos[2] + 0.5f);
  23. ActTeleportActor = false;
  24. Timer = false;
  25. }
  26.  
  27. void CALLBACK TeleportActor(std::string)
  28. {
  29. ActTeleportActor ^= true;
  30. if (ActTeleportActor)
  31. {
  32. if ((*(int *)0xBA6774 != 0))
  33. {
  34. for (int i = 0; i < (0xAF * 0x28); i += 0x28)
  35. {
  36. if (*(short *)(0xBA873D + i) == 4611)
  37. {
  38. float *pos = (float *)(0xBA86F8 + 0x28 + i);
  39. mapPos[0] = *pos;
  40. mapPos[1] = *(pos + 1);
  41. mapPos[2] = GAME->GetWorld()->FindGroundZForPosition(pos[0], pos[1]) + 1.0f;
  42. PEDSELF->Teleport(mapPos[0], mapPos[1], mapPos[2]);
  43. time = GetTickCount();
  44. Timer = true;
  45. }
  46. }
  47. }
  48. }
  49. }
  50.  
  51. void CALLBACK mainloop()
  52. {
  53. static bool init = false;
  54. if (!init)
  55. {
  56. if (GAME == nullptr)
  57. return;
  58. if (GAME->GetSystemState() != eSystemState::GS_PLAYING_GAME)
  59. return;
  60. if (!SF->getSAMP()->IsInitialized())
  61. return;
  62. SF->getSAMP()->getChat()->AddChatMessage(0xffcacaca, "SFPlugin TPC loaded");
  63. SF->getSAMP()->registerChatCommand("tpcsf", TeleportActor);
  64. init = true;
  65. }
  66. if (GetTickCount() - time > 50 && Timer) Timer1();
  67. }
  68.  
  69. BOOL APIENTRY DllMain(HMODULE hModule, DWORD dwReasonForCall, LPVOID lpReserved)
  70. {
  71. switch (dwReasonForCall)
  72. {
  73. case DLL_PROCESS_ATTACH:
  74. SF->initPlugin(mainloop, hModule);
  75. break;
  76. case DLL_THREAD_ATTACH:
  77. case DLL_THREAD_DETACH:
  78. case DLL_PROCESS_DETACH:
  79. break;
  80. }
  81. return TRUE;
  82. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement