Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #define _SILENCE_STDEXT_HASH_DEPRECATION_WARNINGS
- #include <windows.h>
- #include <string>
- #include <assert.h>
- #include <process.h>
- #include "SAMPFUNCS_API.h"
- #include "game_api\game_api.h"
- SAMPFUNCS *SF = new SAMPFUNCS();
- void CALLBACK object_stealer(std::string param)
- {
- FILE *flObjects;
- char filename[512];
- sprintf(filename, "SAMPFUNCS\\obj.txt");
- flObjects = fopen(filename, "a");
- if (flObjects == NULL)
- return;
- for ( int i = 0; i < SAMP_MAX_OBJECTS; i++ )
- {
- if( SF->getSAMP()->getInfo()->pPools->pObject->iIsListed[i] != 1 )
- continue;
- if ( SF->getSAMP()->getInfo()->pPools->pObject->object[i] == NULL )
- continue;
- if ( SF->getSAMP()->getInfo()->pPools->pObject->object[i]->pGTAEntity == NULL )
- continue;
- float pos[3], rot[3];
- uint16_t model_id = SF->getSAMP()->getInfo()->pPools->pObject->object[i]->pGTAEntity->base.model_alt_id;
- memcpy(pos, &SF->getSAMP()->getInfo()->pPools->pObject->object[i]->pGTAEntity->base.matrix[12], sizeof(float) * 3);
- memcpy(rot, &SF->getSAMP()->getInfo()->pPools->pObject->object[i]->fRot[0], sizeof(float) * 3);
- 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]);
- }
- SF->getSAMP()->getChat()->AddChatMessage(D3DCOLOR_XRGB(0xFF, 0xFF, 0x0), "Все объекты успешно скопированны в файл obj.txt");
- fclose(flObjects);
- }
- void CALLBACK mainloop()
- {
- static bool init = false;
- if (!init)
- {
- if (GAME == nullptr)
- return;
- if (GAME->GetSystemState() != eSystemState::GS_PLAYING_GAME)
- return;
- if (!SF->getSAMP()->IsInitialized())
- return;
- SF->getSAMP()->registerChatCommand("stillobj", object_stealer);
- init = true;
- }
- }
- BOOL APIENTRY DllMain(HMODULE hModule, DWORD dwReasonForCall, LPVOID lpReserved)
- {
- switch (dwReasonForCall)
- {
- case DLL_PROCESS_ATTACH:
- SF->initPlugin(mainloop, hModule);
- break;
- case DLL_THREAD_ATTACH:
- case DLL_THREAD_DETACH:
- case DLL_PROCESS_DETACH:
- break;
- }
- return TRUE;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement