Как правильно слать ракнет пакеты через битстрим в samp?
Мне на сервер именно нужно , через плагин под сервер![]()
Исходник - RakHook 1.0-beta
RakHook - библиотека, которая добавляет события RakNet'a (входящие/исходящие пакеты и RPC), эмуляцию и отправку пакетов и RPC. Есть одновременная поддержка версий 0.3.7-R1, 0.3.7-R3-1, 0.3.7-R4 и 0.3DL-R1. Функции std::uintptr_t rakhook::samp_addr(std::uintptr_t offset = 0); // получить адрес...www.blast.hk
// unknown, r1, r2, r3-1, r4, r5
define_offset(Info, 0, 0x21A0F8, 0x21A100, 0x26E8DC, 0x26EA0C, 0x26EB94)
define_offset(InputInfo, 0, 0x21A0E8, 0x21A0F0, 0x26E8CC, 0x26E9FC, 0x26EB84)
define_offset(AddCommand, 0, 0x65AD0, 0x65BA0, 0x69000, 0x69730, 0x69770)
} // namespace offsets
there's no r1-0 as far as i know, there's a r4-2 version thoughHello, does anyone have these offsites on r3-0?
C++:// unknown, r1, r2, r3-1, r4, r5 define_offset(Info, 0, 0x21A0F8, 0x21A100, 0x26E8DC, 0x26EA0C, 0x26EB94) define_offset(InputInfo, 0, 0x21A0E8, 0x21A0F0, 0x26E8CC, 0x26E9FC, 0x26EB84) define_offset(AddCommand, 0, 0x65AD0, 0x65BA0, 0x69000, 0x69730, 0x69770) } // namespace offsets
there's no r1-0 as far as i know, there's a r4-2 version though
#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, 91}},
{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;
Потому что при выходе из машины в m_pPed всё равно хранится указатель на последний транспорт в котором сидел игрок, а у тебя в isInputActive() идёт как раз таки проверка на то пустой указатель m_pVehicle, или нет. Правильней будет проверять так:Приветствую, выхожу из машины плагин перестает работать почему-то, pPed->m_pVehicle
C++:#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, 91}}, {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;
bool isPlayerInVehicle()
{
CPed* pPed = CWorld::Players[CWorld::PlayerInFocus].m_pPed;
if (!pPed) return false;
return pPed->bInVehicle;
}
if (overlay != nullptr) {
if (ImGui::GetCurrentContext() == nullptr) return gameLoop();
ImGui_ImplDX9_NewFrame();
ImGui_ImplWin32_NewFrame();
ImGui::NewFrame();
ImGui::Begin("Test Window");
ImGui::Text("ImGui work");
ImGui::End();
overlay->Render();
ImGui::EndFrame();
ImGui::Render();
ImGui_ImplDX9_RenderDrawData(ImGui::GetDrawData());
}
static void* __fastcall CChat__Hook(void* ptr, void*, IDirect3DDevice9* pDevice, void* pFontRenderer, const char* pChatLogPath) {
ImGui::CreateContext();
ImGui_ImplWin32_Init(GetActiveWindow());
ImGui_ImplDX9_Init(pDevice); // я даже взял девайс от сампа, ибо подумал что самп перехватывает игровой девайс, но нет, это не так... (ХОТЯ В МОЁМ ДРУГОМ ПЛАГИНЕ ГДЕ РАБОТА С IMGUI, И ПРИ ИНИЦИАЛИЗАЦИИ Я ИСПОЛЬЗУЮ ДЕВАЙС ПО АДРЕСУ 0xC97C28 ТО ВСЁ ЗАЕБИСЬ)
ImGui::StyleColorsDark();
printf("CChat__Hook\n");
return CChat_hook(ptr, pDevice, pFontRenderer, pChatLogPath);
}
Вроде правильно инициализирую ImGui, но почему-то блять не отображается стандартное меню ImGUi
Я не знаю, может надо font обязательно создавать, но ведь имгуи сам его должен подтягивать по умолчанию...Код:if (overlay != nullptr) { if (ImGui::GetCurrentContext() == nullptr) return gameLoop(); ImGui_ImplDX9_NewFrame(); ImGui_ImplWin32_NewFrame(); ImGui::NewFrame(); ImGui::Begin("Test Window"); ImGui::Text("ImGui work"); ImGui::End(); overlay->Render(); ImGui::EndFrame(); ImGui::Render(); ImGui_ImplDX9_RenderDrawData(ImGui::GetDrawData()); } static void* __fastcall CChat__Hook(void* ptr, void*, IDirect3DDevice9* pDevice, void* pFontRenderer, const char* pChatLogPath) { ImGui::CreateContext(); ImGui_ImplWin32_Init(GetActiveWindow()); ImGui_ImplDX9_Init(pDevice); // я даже взял девайс от сампа, ибо подумал что самп перехватывает игровой девайс, но нет, это не так... (ХОТЯ В МОЁМ ДРУГОМ ПЛАГИНЕ ГДЕ РАБОТА С IMGUI, И ПРИ ИНИЦИАЛИЗАЦИИ Я ИСПОЛЬЗУЮ ДЕВАЙС ПО АДРЕСУ 0xC97C28 ТО ВСЁ ЗАЕБИСЬ) ImGui::StyleColorsDark(); printf("CChat__Hook\n"); return CChat_hook(ptr, pDevice, pFontRenderer, pChatLogPath); }
Дайте feedback, а то я не очень понимаю что не так, единственное до чего я догадываюсь, это то что игра съедает кадр который я рендерю..
dll = asiВопрос.
Всем привет! С чего стоит изучать c++ для сампа? Может есть какие-либо учебники? Спасибо
upd: Хочу дополнить свой вопрос. В чем отличаются dll, sf и asi в сампе? Есть ли что-то лучшее? Потому что как я понял sf требует сампфункса, asi - asiloader ( moonloader ), а dll? Язык то один
Я даже делал хук на D3DPresent, но даже он мне ничем не помог, если ты об этом..![]()
SAMP_API/SAMP_API_ONE_HEADER/main.cpp at main · DpO4uLa/SAMP_API
SDK для быстрого взаимодействия с SA-MP & Gta SA. Contribute to DpO4uLa/SAMP_API development by creating an account on GitHub.github.com
Мужики, возможно ли из RwTexture или из RwRaster получить указатель на IDirect3DTexture9?
Если да, то как?
RwTexture* pTexture;
IDirect3DTexture9* pD3DTexture = *reinterpret_cast<IDirect3DTexture9**>(pTexture->raster + 1);
охренеть, спасибоC++:RwTexture* pTexture; IDirect3DTexture9* pD3DTexture = *reinterpret_cast<IDirect3DTexture9**>(pTexture->raster + 1);