из коробки в гта вообще не продумывали неон, никакой функции нетуКакая функция отвечает за остановку неона на машину? Как это происходит
obj->SetIsStatic(false); попробуйВсем привет. Кто-то может знает, как сделать, чтобы позиция прикриплённого объекта была не статическая? А то например когда я приседаю, приатаченный объект не движется за игроком.
C++:void CWeaponSkins::AttachModelToPlayer(CPed* ped, short weaponId) { if (!ped) return; if (!m_WeaponSkins[ped].contains(weaponId)) return; unsigned short skinModelId = m_WeaponSkins[ped][weaponId]; CStreaming::RequestModel(skinModelId, 0); CStreaming::LoadAllRequestedModels(false); CObject* obj = CObject::Create(skinModelId); if (!obj) return; obj->SetIsStatic(true); obj->bIsVisible = true; obj->bAttachedToEntity = true; plugin::Command<eScriptCommands::COMMAND_ATTACH_OBJECT_TO_CHAR>( obj, ped, 0.05f, -0.18f, -0.25f, 90.0f, 0.0f, 185.0f ); }
Как правильно слать ракнет пакеты через битстрим в 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? Язык то один