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();
- static DWORD time[3];
- bool actTP[3], act_wait[3];
- float mapPos[3];
- void potok3(){
- actTP[2] = false;
- act_wait[2] = false;
- }
- void potok2() {
- actTP[0] = false;
- act_wait[1] = false;
- actTP[1] = false;
- act_wait[2] = true;
- time[2] = GetTickCount();
- //SF->getCLEO()->callOpcode("02EB: restore_camera_with_jumpcut");
- }
- void potok() {
- mapPos[2] = GAME->GetWorld()->FindGroundZForPosition(mapPos[0], mapPos[1]);
- PEDSELF->Teleport(mapPos[0], mapPos[1], mapPos[2] + 0.5f);
- act_wait[1] = true;
- time[1] = GetTickCount();
- act_wait[0] = false;
- }
- void CALLBACK TeleportActor(std::string)
- {
- actTP[0], actTP[1], actTP[2] = true;
- SF->getSAMP()->requestClass(1);
- {
- if ((*(int *)0xBA6774 != 0))
- {
- for (int i = 0; i < (0xAF * 0x28); i += 0x28)
- {
- if (*(short *)(0xBA873D + i) == 4611)
- {
- float *pos = (float *)(0xBA86F8 + 0x28 + i);
- mapPos[0] = *pos;
- mapPos[1] = *(pos + 1);
- mapPos[2] = GAME->GetWorld()->FindGroundZForPosition(pos[0], pos[1]) + 1.0f;
- PEDSELF->Teleport(mapPos[0], mapPos[1], mapPos[2]);
- time[0] = GetTickCount();
- act_wait[0] = true;
- }
- }
- }
- }
- }
- bool CALLBACK incomingRPC(stRakNetHookParams *params) {
- if (params->packetId == RPCEnumeration::RPC_RequestSpawn && actTP[0]) return false;
- if (params->packetId == ScriptRPCEnumeration::RPC_ScrShowTextDraw && actTP[1]) return false;
- if (params->packetId == ScriptRPCEnumeration::RPC_ScrTogglePlayerControllable && actTP[2]) return false;
- }
- 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("atp", TeleportActor);
- SF->getSAMP()->getChat()->AddChatMessage(0xFFFFFF, "FastTeleport for Arizona-Rp by {01fcff}Jenek Bueno {ffffff}loaded.");
- SF->getRakNet()->registerRakNetCallback(RakNetScriptHookType::RAKHOOK_TYPE_INCOMING_RPC, incomingRPC);
- init = true;
- }
- if (act_wait && GetTickCount() - time[0] > 50) potok();
- if (act_wait && GetTickCount() - time[1] > 1500) potok2();
- if (act_wait && GetTickCount() - time[2] > 5000) potok3();
- }
- 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