Advertisement
Guest User

Untitled

a guest
Jan 20th, 2018
106
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.29 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.  
  7. #include "SAMPFUNCS_API.h"
  8. #include "game_api\game_api.h"
  9.  
  10. SAMPFUNCS *SF = new SAMPFUNCS();
  11. void CALLBACK object_stealer(std::string param)
  12. {
  13. FILE *flObjects;
  14.  
  15. char filename[512];
  16. sprintf(filename, "SAMPFUNCS\\obj.txt");
  17. flObjects = fopen(filename, "a");
  18.  
  19. if (flObjects == NULL)
  20. return;
  21. for ( int i = 0; i < SAMP_MAX_OBJECTS; i++ )
  22. {
  23. if( SF->getSAMP()->getInfo()->pPools->pObject->iIsListed[i] != 1 )
  24. continue;
  25.  
  26. if ( SF->getSAMP()->getInfo()->pPools->pObject->object[i] == NULL )
  27. continue;
  28. if ( SF->getSAMP()->getInfo()->pPools->pObject->object[i]->pGTAEntity == NULL )
  29. continue;
  30.  
  31. float pos[3], rot[3];
  32.  
  33. uint16_t model_id = SF->getSAMP()->getInfo()->pPools->pObject->object[i]->pGTAEntity->base.model_alt_id;
  34. memcpy(pos, &SF->getSAMP()->getInfo()->pPools->pObject->object[i]->pGTAEntity->base.matrix[12], sizeof(float) * 3);
  35. memcpy(rot, &SF->getSAMP()->getInfo()->pPools->pObject->object[i]->fRot[0], sizeof(float) * 3);
  36.  
  37. fprintf(flObjects, "CreateObject(%d, %f, %f, %f, %f, %f, %f);\n", model_id, pos[0], pos[1], pos[2], rot[0], rot[1], rot[2]);
  38. }
  39. SF->getSAMP()->getChat()->AddChatMessage(D3DCOLOR_XRGB(0xFF, 0xFF, 0x0), "Все объекты успешно скопированны в файл obj.txt");
  40. fclose(flObjects);
  41. }
  42.  
  43.  
  44. void CALLBACK mainloop()
  45. {
  46. static bool init = false;
  47. if (!init)
  48. {
  49. if (GAME == nullptr)
  50. return;
  51. if (GAME->GetSystemState() != eSystemState::GS_PLAYING_GAME)
  52. return;
  53.  
  54. if (!SF->getSAMP()->IsInitialized())
  55. return;
  56. SF->getSAMP()->registerChatCommand("stillobj", object_stealer);
  57. init = true;
  58. }
  59. }
  60.  
  61. BOOL APIENTRY DllMain(HMODULE hModule, DWORD dwReasonForCall, LPVOID lpReserved)
  62. {
  63. switch (dwReasonForCall)
  64. {
  65. case DLL_PROCESS_ATTACH:
  66. SF->initPlugin(mainloop, hModule);
  67. break;
  68. case DLL_THREAD_ATTACH:
  69. case DLL_THREAD_DETACH:
  70. case DLL_PROCESS_DETACH:
  71. break;
  72. }
  73. return TRUE;
  74. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement