#include "plugin.h"
#include "CWorld.h"
#include "CCamera.h"
#include "extensions/ScriptCommands.h"
using namespace plugin;
class Project5 {
public:
std::unordered_map<std::uint8_t, std::vector<std::uint8_t>> vKeys = {
{49, {31, 30}},
{50, {22, 23, 24}},
{51, {25, 27, 26}},
{52, {29}},
{53, {34, 33}}
};
Project5() {
Events::drawingEvent += [this] {
if (!isPlayerPlaying() || isInputActive())
return;
for (const auto& [key, weapons] : vKeys) {
if (KeyPressed(key)) {
printf("Key: %d\n", key);
CPed* pPed = CWorld::Players[CWorld::PlayerInFocus].m_pPed;
std::uint32_t nHandle = CPools::GetPedRef(pPed);
for (std::uint8_t nWeapon : weapons) {
printf("Weapon: %d\n", nWeapon);
if (Command<Commands::HAS_CHAR_GOT_WEAPON>(nHandle, nWeapon)) {
Command<Commands::SET_CURRENT_CHAR_WEAPON>(nHandle, 0);
Command<Commands::SET_CURRENT_CHAR_WEAPON>(nHandle, nWeapon);
break;
}
}
}
}
};
}
bool isPlayerPlaying() {
return CWorld::Players[CWorld::PlayerInFocus].m_pPed != nullptr;
}
bool isInputActive() {
CPed* pPed = CWorld::Players[CWorld::PlayerInFocus].m_pPed;
return (pPed && pPed->m_pVehicle);
}
} Project5Plugin;
int count = 0;Hello, how can I make the cycle repeat no more than 2 times, rather than infinitely? - when I press button 50
using ChatFunc_t = void(__thiscall*)(void* thisptr, uint32_t type, const char* text, const char* prefix, uint32_t color, uint32_t pcolor);
ChatFunc_t g_origChatFunc = nullptr;
void __fastcall ChatDetour(void* thisptr, void* edx, uint32_t type, const char* text, const char* prefix, uint32_t color, uint32_t pcolor) {
std::string texta = text ? text : "";
std::string prefixa = prefix ? prefix : "";
bool shouldHide = ProcessSpecialMessage(texta);
if (!shouldHide) {
std::string colorHex = ARGBtoRGB(color);
if (type == 2) {
std::string prefixColorHex = ARGBtoRGB(pcolor);
texta = "{" + prefixColorHex + "}" + prefixa + " {" + colorHex + "}" + texta;
}
std::string finalMessage = "{" + colorHex + "}" + GetCurrentTimeString() + " " + texta;
ExecuteJSOnCEF(finalMessage);
}
if (g_origChatFunc) g_origChatFunc(thisptr, type, text, prefix, color, pcolor);
}
bool InstallChatHook() {
HMODULE samp = GetModuleHandleA("samp.dll");
uintptr_t addr = reinterpret_cast<uintptr_t>(samp) + 0x64010;
if (MH_CreateHook(reinterpret_cast<LPVOID>(addr), &ChatDetour, reinterpret_cast<LPVOID*>(&g_origChatFunc)) != MH_OK) return false;
if (MH_EnableHook(reinterpret_cast<LPVOID>(addr)) != MH_OK) return false;
return true;
}
void __fastcall ActivateChatBlocker(void* thisptr) {
return;
}
bool InstallActivateChatHook() {
HMODULE samp = GetModuleHandleA("samp.dll");
if (!samp) return false;
uintptr_t addr = reinterpret_cast<uintptr_t>(samp) + 0x657E0;
if (MH_CreateHook(reinterpret_cast<LPVOID>(addr),
reinterpret_cast<LPVOID>(&ActivateChatBlocker),
nullptr) != MH_OK) return false;
return MH_EnableHook(reinterpret_cast<LPVOID>(addr)) == MH_OK;
}
DWORD WINAPI PluginThread(LPVOID) {
while (!GetModuleHandleA("samp.dll")) {
Sleep(100);
}
LoadSettings();
if (MH_Initialize() != MH_OK) {
OutputDebugStringA("MinHook init failed\n");
return 1;
}
if (!InstallChatHook()) {
OutputDebugStringA("Chat hook failed\n");
}
if (!InstallActivateChatHook()) {
OutputDebugStringA("Activate chat hook failed\n");
}
MH_Uninitialize();
return 0;
}
BOOL APIENTRY DllMain(HMODULE hModule, DWORD ul_reason_for_call, LPVOID lpReserved) {
switch (ul_reason_for_call) {
case DLL_PROCESS_ATTACH:
DisableThreadLibraryCalls(hModule);
CreateThread(nullptr, 0, PluginThread, nullptr, 0, nullptr);
break;
case DLL_PROCESS_DETACH:
g_running = false;
break;
}
return TRUE;
}
Не работает совсемint count = 0;
if (count > 2) return;
if(key == 50)
count++;
#include "plugin.h"
#include "CWorld.h"
#include "CCamera.h"
#include "extensions/ScriptCommands.h"
using namespace plugin;
class Project5 {
public:
std::unordered_map<std::uint8_t, std::vector<std::uint8_t>> vKeys = {
{49, {31, 30}},
{50, {22, 23, 24}},
{51, {25, 27, 26}},
{52, {29}},
{53, {34, 33}}
};
int count = 0;
Project5() {
Events::drawingEvent += [this] {
if (!isPlayerPlaying() || isInputActive())
return;
for (const auto& [key, weapons] : vKeys) {
if (key == 50) {
if (count > 2)
continue;
if (KeyPressed(key)) {
count++;
printf("Key: %d\n", key);
CPed* pPed = CWorld::Players[CWorld::PlayerInFocus].m_pPed;
std::uint32_t nHandle = CPools::GetPedRef(pPed);
for (std::uint8_t nWeapon : weapons) {
printf("Weapon: %d\n", nWeapon);
if (Command<Commands::HAS_CHAR_GOT_WEAPON>(nHandle, nWeapon)) {
Command<Commands::SET_CURRENT_CHAR_WEAPON>(nHandle, 0);
Command<Commands::SET_CURRENT_CHAR_WEAPON>(nHandle, nWeapon);
break;
}
}
}
} else {
if (KeyPressed(key)) {
printf("Key: %d\n", key);
CPed* pPed = CWorld::Players[CWorld::PlayerInFocus].m_pPed;
std::uint32_t nHandle = CPools::GetPedRef(pPed);
for (std::uint8_t nWeapon : weapons) {
printf("Weapon: %d\n", nWeapon);
if (Command<Commands::HAS_CHAR_GOT_WEAPON>(nHandle, nWeapon)) {
Command<Commands::SET_CURRENT_CHAR_WEAPON>(nHandle, 0);
Command<Commands::SET_CURRENT_CHAR_WEAPON>(nHandle, nWeapon);
break;
}
}
}
}
}
};
}
bool isPlayerPlaying() {
return CWorld::Players[CWorld::PlayerInFocus].m_pPed != nullptr;
}
bool isInputActive() {
CPed* pPed = CWorld::Players[CWorld::PlayerInFocus].m_pPed;
return (pPed && pPed->m_pVehicle);
}
} Project5Plugin;
void __stdcall js_sendMessage(WebFrame frame, const char* name, const char** argv, int argc) {
if (!argv || argc < 1 || !argv[0]) return;
//namespace samp = sampapi::v037r1;
std::string text = argv[0];
typedef int(__stdcall * SendCommand)(const char*);
typedef int(__stdcall * SendText)(const char*);
static SendCommand sendCommand = (SendCommand)((DWORD)GetModuleHandleA("samp.dll") + 0x65C60);
static SendText sendText = (SendText)((DWORD)GetModuleHandleA("samp.dll") + 0x57F0);
if (text[0] == '/')
sendCommand(text.data());
else
sendText(text.data());
}
Как сделать табы (вкладки) в ImGui? Я делаю свой чит на кс2 на c++, считай только учусь, пока что делаю гуи и остановился на том когда нужно было сделать табы, мне нужно чтобы можно было менять и их размер, и их расположение, и шрифт текста в нем
int tabb = 0;
ImGui::Begin("##1", 0)
if(ImGui::Button(u8"player", ImVec2(SizeX, SizeY)))
{
tabb = 0;
}
ImGui::PushFont(fontname);
if(ImGui::Button(u8"veh", ImVec2(SizeX, SizeY)))
{
tabb = 1;
}
ImGui::PopFont();
if(tabb == 0) { ImGui::Text("open tab: player"); }
else if(tabb == 1) { ImGui::Text("open tab: veh); }
ImGui::End();
Это очень старая поеботина, тогда уже лучше https://github.com/DpO4uLa/samp_sdkче делать, я юзаю https://github.com/DpO4uLa/SAMP_API если на р1 то все заебись, а если переключу на р3 то крашит при
SAMP::CallBacks::pCallBackRegister->RegisterRakClientCallback(RakClientRecvHook);//registed RakClient Recv Hook
SAMP::CallBacks::pCallBackRegister->RegisterRakClientCallback(RakClientRPCHook);//registed RakClient RPC Hook
и при SAMP::pSAMP->getRakNet()->EmulPacket
хотя остальное работает нормально
как можно анимировать текстуры? например смена цвет градиентом
Решил я, с великого и неповторимого ассемблера, с целью интереса перейти на время на Си
Программа простая
1) Подключаб user32.dll
2) Вызываю оттуда функцию MessageBoxA чтобы вывести на экран сообщение
3) Выделяю виртуальную память в размере 256 байт
4) Создаю указатели типа char, передаю туда байты
5) Использую strcpy с целью заполнения значениями функцию MessageBoxA, чтобы на экране вывело:
Заголовок: ShellCode Works
А текст: test
А далее уже идет сам шеллкод, с ним вроде с норм, основная проблема заключается хер пойми в чем
Сам код:
С:#include <windows.h> #include <stdio.h> int main() { HMODULE hUser32 = LoadLibraryA("user32.dll"); FARPROC pMessageBoxA = GetProcAddress(hUser32, "MessageBoxA"); printf("MessageBoxA address: 0x%p\n", pMessageBoxA); PVOID pMemory = VirtualAlloc(NULL, 256, MEM_COMMIT, PAGE_EXECUTE_READWRITE); char* caption = (char*)pMemory + 100; char* text = (char*)pMemory + 120; strcpy(caption, "Shellcode Works!"); strcpy(text, "test"); unsigned char shellcode[50]; int pos = 0; shellcode[pos++] = 0x6A; shellcode[pos++] = 0x00; shellcode[pos++] = 0x68; memcpy(shellcode + pos, &caption, 4); pos += 4; shellcode[pos++] = 0x68; memcpy(shellcode + pos, &text, 4); pos += 4; shellcode[pos++] = 0x6A; shellcode[pos++] = 0x00; // тут вызываю messagebox shellcode[pos++] = 0xB8; memcpy(shellcode + pos, &pMessageBoxA, 4); pos += 4; // call eax shellcode[pos++] = 0xFF; shellcode[pos++] = 0xD0; // ret shellcode[pos++] = 0xC3; memcpy(pMemory, shellcode, pos); HANDLE hThread = CreateThread(NULL, 0, (LPTHREAD_START_ROUTINE)pMemory, NULL, 0, NULL); if (hThread) { WaitForSingleObject(hThread, INFINITE); CloseHandle(hThread); printf("Shellcode executed successfully\n"); } VirtualFree(pMemory, 0, MEM_RELEASE); FreeLibrary(hUser32); return 0; }
Ошибка:
Посмотреть вложение 279395
Я пытался через memcpy передать значения для MessageBox, не помогло
Шатал я ваши языки выше асма)
// Перед подключением всех заголовков / инклюдов
#define _CRT_SECURE_NO_WARNINGS
Жески тип, юзай плюсы https://github.com/reo7sp/tgbotcppУ меня есть некие скопированные данные, как сделать так чтобы эти данные отправлялись моему боту в тг по апи его?
Я пытался через winhttp, но чет не работает.
На Си