- 5,144
- 1,983
Обратите внимание, пользователь заблокирован на форуме. Не рекомендуется проводить сделки.
Является своеобразным помощником по использованию хилки - адаптируется под проекты как DRP и ARP. Умеет лечить с использованием сбива двух видов (кроме того один из них делает это моментально без применения каких либо анимаций) что очень удобно и напоминает чем то HP Inscrease. Кроме того умеет это делать в автоматическом режиме при падении HP до указанного уровня.
Требования: SAMFUNCS v5.3.3
Активация: /reddit
Автор: 0pc0d3R
Требования: SAMFUNCS v5.3.3
Активация: /reddit
Автор: 0pc0d3R
C++:
#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"
#include "Registry.h"
#include <thread>
#pragma comment(lib,"User32.lib")
DWORD ThreadID;
HANDLE hThread;
SAMPFUNCS *SF = new SAMPFUNCS();
#define HEAD_DIALOG 729
#define UPDATE_DIALOG 730
#define ERROR_DIALOG 731
bool ErrorDialog = false;
bool SbivAllowed = true;
bool endof = true;
bool ShowAgain = false;
bool CurrentShow[11];
unsigned short CurrentEditID = 255;
struct HealSettings
{
std::string HealMe;
std::string Reset;
std::string TriggerStart;
std::string TriggerEnd;
float AutoHeal;
byte HRS_Key;
byte HR_Key;
uint32_t Delay;
std::string SbivType;
std::string AutoText;
HealSettings()
{
HealMe = "/healme";
Reset = "/reset";
AutoHeal = 0.0f;
HRS_Key = 90;
HR_Key = 88;
Delay = 150;
SbivType = "Слёт анимаций";
TriggerStart = "Вы купили набор аптечек.";
TriggerEnd = "У Вас нет с собой аптечек";
AutoText = "gm Fraps!";
}
};
HealSettings hs;
void HeadDialog()
{
char dlg[750];
sprintf(dlg, "{23ADDB}> {FF470A}AutoHeal при: {51DB23}%d {FF470A}ХП\
\n{23ADDB}> {FF470A}Клавиша хила со сбивом: {51DB23}%d\
\n{23ADDB}> {FF470A}Клавиша хила без сбива: {51DB23}%d\
\n{23ADDB}> {FF470A}Команда хила: {51DB23}%s\
\n{23ADDB}> {FF470A}Команда ресета: {51DB23}%s\
\n{23ADDB}> {FF470A}Задержка между командами: {51DB23}%d {FF470A}мс\
\n{23ADDB}> {FF470A}Режим сбива анимок: {51DB23}%s\
\n{23ADDB}> {FF470A}AutoHeal триггер №1: {51DB23}%s\
\n{23ADDB}> {FF470A}AutoHeal триггер №2: {51DB23}%s\
\n{23ADDB}> {FF470A}AutoText при юзе: {51DB23}%s",
(int)hs.AutoHeal, (int)hs.HRS_Key, (int)hs.HR_Key,
(char*)hs.HealMe.c_str(), (char*)hs.Reset.c_str(), hs.Delay,
(char*)hs.SbivType.c_str(), (char*)hs.TriggerStart.c_str(),
(char*)hs.TriggerEnd.c_str(), (char*)hs.AutoText.c_str());
SF->getSAMP()->getDialog()->ShowDialog(HEAD_DIALOG, DIALOG_STYLE_LIST,
"{23ADDB}Heal{FF470A}Funcs {47FF0A}v2 {F5B111}by 0pc0d3R {00C2B8}For {6BC200}Z E D D",
dlg, "{FFFFFF}Изменить", "{FFFFFF}Закрыть");
}
/////////////////////////////////////////////////////////////////////////////////////////////////////////////
void __stdcall PerformCommand(std::string param)
{
HeadDialog();
};
////////////////////////////////////////////////////////////////////////////////////////////////////
void GetRegistryValues()
{
CEasyRegistry *reg = new CEasyRegistry(HKEY_CURRENT_USER, "Software\\HealFuncs");
if (reg->ErrorSuccess() == true)
{
hs.HealMe = reg->ReadString("HL");
hs.Reset = reg->ReadString("RT");
hs.AutoHeal = (float)std::stoi(reg->ReadString("AT").c_str());
hs.HRS_Key = (byte)std::stoi(reg->ReadString("HRS").c_str());
hs.HR_Key = (byte)std::stoi(reg->ReadString("HR").c_str());
hs.Delay = (uint32_t)std::stoi(reg->ReadString("MS").c_str());
hs.SbivType = reg->ReadString("SB");
hs.TriggerStart = reg->ReadString("TS");
hs.TriggerEnd = reg->ReadString("TE");
hs.AutoText = reg->ReadString("AA");
}
else
{
reg->WriteString("HL", "/healme");
reg->WriteString("RT", "/reset");
reg->WriteString("AT", "0");
reg->WriteString("HRS", "90");
reg->WriteString("HR", "88");
reg->WriteString("MS", "150");
reg->WriteString("SB", "Слёт анимаций");
reg->WriteString("TS", "Вы купили набор аптечек.");
reg->WriteString("TE", "У Вас нет с собой аптечек");
reg->WriteString("AA", "Мать ебал и точка.");
}
}
void GetEditDialog(unsigned short EditID)
{
SF->getSAMP()->getDialog()->ShowDialog(UPDATE_DIALOG, DIALOG_STYLE_INPUT,
"{23ADDB}Heal{FF470A}Funcs {47FF0A}v2", "{1CE3ED}Введите новое значение!",
"{FFFFFF}Обновить", "{FFFFFF}Назад");
CurrentEditID = EditID;
char inp[50];
switch (EditID)
{
case 0:
sprintf(inp, "%d", (int)hs.AutoHeal);
SF->getSAMP()->getDialog()->SetInputText(inp);
break;
case 1:
sprintf(inp, "%d", (int)hs.HRS_Key);
SF->getSAMP()->getDialog()->SetInputText(inp);
break;
case 2:
sprintf(inp, "%d", (int)hs.HR_Key);
SF->getSAMP()->getDialog()->SetInputText(inp);
break;
case 3:
sprintf(inp, "%s", (char*)hs.HealMe.c_str());
SF->getSAMP()->getDialog()->SetInputText(inp);
break;
case 4:
sprintf(inp, "%s", (char*)hs.Reset.c_str());
SF->getSAMP()->getDialog()->SetInputText(inp);
break;
case 5:
sprintf(inp, "%d", hs.Delay);
SF->getSAMP()->getDialog()->SetInputText(inp);
break;
case 6:
sprintf(inp, "%s", (char*)hs.SbivType.c_str());
SF->getSAMP()->getDialog()->SetInputText(inp);
break;
case 7:
sprintf(inp, "%s", (char*)hs.TriggerStart.c_str());
SF->getSAMP()->getDialog()->SetInputText(inp);
break;
case 8:
sprintf(inp, "%s", (char*)hs.TriggerEnd.c_str());
SF->getSAMP()->getDialog()->SetInputText(inp);
break;
case 9:
sprintf(inp, "%s", (char*)hs.AutoText.c_str());
SF->getSAMP()->getDialog()->SetInputText(inp);
break;
}
}
void GeHook(void)
{
for (short x = 0; x < 11; x++)
{
if (CurrentShow[x] == true)
{
GetEditDialog(x);
CurrentShow[x] = false;
}
}
if (ErrorDialog == true)
{
if (CurrentEditID == 6)
{
SF->getSAMP()->getDialog()->ShowDialog(ERROR_DIALOG, DIALOG_STYLE_MSGBOX,
"{23ADDB}Ашипка природы!!!)00",
"{F5C62A}Вводи или {2AF561}Слёт анимаций {F5C62A}либо {2AF561}Ноп анимаций",
"{FFFFFF}Назад", "{FFFFFF}Закрыть");
}
else if (CurrentEditID == 7 || CurrentEditID == 8)
{
SF->getSAMP()->getDialog()->ShowDialog(ERROR_DIALOG, DIALOG_STYLE_MSGBOX,
"{23ADDB}Ашипка природы!!!)00",
"{F5C62A}Введи текст для {2AF561}триггера!",
"{FFFFFF}Назад", "{FFFFFF}Закрыть");
}
else if (CurrentEditID == 9)
{
SF->getSAMP()->getDialog()->ShowDialog(ERROR_DIALOG, DIALOG_STYLE_MSGBOX,
"{23ADDB}Ашипка природы!!!)00",
"{F5C62A}Введи текст для {2AF561}авто ответа!",
"{FFFFFF}Назад", "{FFFFFF}Закрыть");
}
ErrorDialog = false;
}
if (ShowAgain == true)
{
HeadDialog();
ShowAgain = false;
}
}
void __stdcall Menu(int dialogId, int buttonId, int listItem, const char *input)
{
if (dialogId == HEAD_DIALOG)
{
if (buttonId == 1) CurrentShow[listItem] = true;
}
else if (dialogId == ERROR_DIALOG)
{
if (buttonId == 1) ShowAgain = true;
}
else if (dialogId == UPDATE_DIALOG)
{
if (buttonId == 1)
{
CEasyRegistry *reg = new CEasyRegistry(HKEY_CURRENT_USER, "Software\\HealFuncs");
if (CurrentEditID == 0) reg->WriteString("AT", (char *)input);
else if (CurrentEditID == 1) reg->WriteString("HRS", (char *)input);
else if (CurrentEditID == 2) reg->WriteString("HR", (char *)input);
else if (CurrentEditID == 3) reg->WriteString("HL", (char *)input);
else if (CurrentEditID == 4) reg->WriteString("RT", (char *)input);
else if (CurrentEditID == 5) reg->WriteString("MS", (char *)input);
else if (CurrentEditID == 6)
{
if (!strcmp(input, "Слёт анимаций") || !strcmp(input, "Ноп анимаций"))
reg->WriteString("SB", (char *)input);
else
{
ErrorDialog = true;
return;
}
}
else if (CurrentEditID == 7)
{
if (strlen(input) > 0) reg->WriteString("TS", (char *)input);
else
{
ErrorDialog = true;
return;
}
}
else if (CurrentEditID == 8)
{
if (strlen(input) > 0) reg->WriteString("TE", (char *)input);
else
{
ErrorDialog = true;
return;
}
}
else if (CurrentEditID == 9)
{
if (strlen(input) > 0) reg->WriteString("AA", (char *)input);
else
{
ErrorDialog = true;
return;
}
}
GetRegistryValues();
}
ShowAgain = true;
}
}
void __stdcall destr()
{
if (hThread != NULL)
{
TerminateThread(hThread, 0);
CloseHandle(hThread);
}
}
void ControlleR(bool what = false)
{
BitStream bs; bs.Write(what);
SF->getRakNet()->emulateRecvRPC(RPC_ScrTogglePlayerControllable, &bs);
endof = true;
}
void HealFunc(bool mode = false)
{
if (endof == true)
{
endof = false;
stLocalPlayer *lpr = SF->getSAMP()->getPlayers()->pLocalPlayer;
lpr->Say((char*)hs.HealMe.c_str());
Sleep(hs.Delay);
lpr->Say((char*)hs.Reset.c_str());
Sleep(10);
lpr->Say((char*)hs.AutoText.c_str());
if (mode)
{
if (!strcmp(hs.SbivType.c_str(), "Слёт анимаций")) ControlleR(true);
else endof = true;
}
else endof = true;
}
}
void __stdcall Hook()
{
Sleep(50);
if (SF->getSAMP()->getPlayers()->pLocalPlayer->iIsActive == 1 && SF->getSAMP()->getInput()->iInputEnabled == 0)
{
if (SF->getGame()->isKeyPressed(hs.HRS_Key)) HealFunc(true);
else if (SF->getGame()->isKeyPressed(hs.HR_Key)) HealFunc(false);
}
if (PEDSELF->GetHealth() <= hs.AutoHeal && hs.AutoHeal > 0 && SbivAllowed) HealFunc(true);
bool hook = true;
if (hook) Hook();
}
bool __stdcall DeadHook(stRakNetHookParams *hook)
{
if (hook->packetId == RPCEnumeration::RPC_Death)
{
endof = true;
}
return true;
}
bool __stdcall AnimationNop(stRakNetHookParams *hook)
{
if (hook->packetId == RPC_ScrApplyAnimation && endof == false)
{
endof = true;
return false;
}
if (hook->packetId == RPC_ScrClientMessage)
{
DWORD color, strLen; char msg[255];
hook->bitStream->ResetReadPointer();
hook->bitStream->Read(color);
hook->bitStream->Read(strLen);
hook->bitStream->Read(msg, strLen);
hook->bitStream->ResetReadPointer();
char *ptr = strstr(msg, hs.TriggerStart.c_str());
if (ptr != nullptr) SbivAllowed = true;
ptr = strstr(msg, hs.TriggerEnd.c_str());
if (ptr != nullptr) SbivAllowed = false;
}
return true;
}
void __stdcall mainloop( void )
{
static bool init = false;
if (!init)
{
if (GAME == nullptr) return;
if (GAME->GetSystemState() != eSystemState::GS_PLAYING_GAME) return;
if(!SF->getSAMP()->IsInitialized()) return;
SF->getRakNet()->registerRakNetCallback(RAKHOOK_TYPE_INCOMING_RPC, AnimationNop);
SF->getRakNet()->registerRakNetCallback(RAKHOOK_TYPE_OUTCOMING_RPC, DeadHook);
SF->getSAMP()->registerDialogCallback(Menu); SF->getGame()->registerGameDestructorCallback(destr);
GetRegistryValues(); SF->getSAMP()->registerChatCommand("reddit", PerformCommand);
hThread = CreateThread(NULL, 0, (LPTHREAD_START_ROUTINE)&Hook, NULL, 0, &ThreadID);
init = true;
}
else GeHook();
}
bool __stdcall 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;
}