How I can write this values in c++? I took it from one .lua script.
Lua:memory.hex2bin("E865041C00", 0x53C136, 5) memory.write(12697552, 1, 1, false)--
void set_raw(std::uintptr_t address, const char* RawData, std::size_t size, bool protect) {
DWORD oldProt;
if (protect) VirtualProtect(reinterpret_cast<void*>(address), size, PAGE_READWRITE, &oldProt);
memcpy(reinterpret_cast<void*>(address), RawData, size);
if (protect) VirtualProtect(reinterpret_cast<void*>(address), size, oldProt, &oldProt);
}
template <typename T>
inline void write_memory(std::uintptr_t address, T value, bool protect = true) {
unsigned long oldProt;
if (protect) VirtualProtect(reinterpret_cast<void*>(address), sizeof(T), PAGE_READWRITE, &oldProt);
*reinterpret_cast<T*>(address) = value;
if (protect) VirtualProtect(reinterpret_cast<void*>(address), sizeof(T), oldProt, &oldProt);
}
set_raw(0x53C136, "\xE8\x65\x04\x1C\x00", 5, true);
set_raw(0xC1BFD0, "\x01", 1, true); // or WriteMemory(0xC1BFD0, char(1), true);
How I can write this values in c++? I took it from one .lua script.
Lua:memory.hex2bin("E865041C00", 0x53C136, 5) memory.write(12697552, 1, 1, false)--
#include "llmo/include/rwe.hpp"
llmo::rwe::Copy(0x53C136, "\xE8\x65\x04\x1C\x00", 5);
llmo::rwe::Set(0xC1BFD0, 0x01, 1);
Исправился, 🐞 аннулируюC++:void set_raw(std::uintptr_t address, const char* RawData, std::size_t size, bool protect) { DWORD oldProt; if (protect) VirtualProtect(reinterpret_cast<void*>(address), size, PAGE_READWRITE, &oldProt); memcpy(reinterpret_cast<void*>(address), RawData, size); if (protect) VirtualProtect(reinterpret_cast<void*>(address), size, oldProt, &oldProt); } template <typename T> inline void write_memory(std::uintptr_t address, T value, bool protect = true) { unsigned long oldProt; if (protect) VirtualProtect(reinterpret_cast<void*>(address), sizeof(T), PAGE_READWRITE, &oldProt); *reinterpret_cast<T*>(address) = value; if (protect) VirtualProtect(reinterpret_cast<void*>(address), sizeof(T), oldProt, &oldProt); } set_raw(0x53C136, "\xE8\x65\x04\x1C\x00", 5, true); set_raw(0xC1BFD0, "\x01", 1, true); // or WriteMemory(0xC1BFD0, char(1), true);
It is also bad form to write addresses not in hex
не,это устанавливает позицию курсора,а мне нужно чтоб пед повернулсяциклом через setcursorpos можно
извините, я не заметил это сообщение.SF->getSAMP()->getVehicles()->GetCarHandleFromSAMPCarID(vehID) замени на g_Vehicles->pSAMP_Vehicle[vehID]->pGTA_Vehicle
function samp.onRemoveBuilding()
return false
end
how can i register a command without using sampfuncs? (.ASI)
Как эмулировать зажатие/нажатие клавиши?
sendEmptyPacket(PACKET_DISCONNECTION_NOTIFICATION)
function sendEmptyPacket(id)
local bs = raknetNewBitStream()
raknetBitStreamWriteInt8(bs, id)
raknetSendBitStream(bs)
raknetDeleteBitStream(bs)
end
#include <Windows.h>
#include "main.h"
SAMPFUNCS* SF = new SAMPFUNCS();
void __stdcall mainloop()
{
static bool initialized = false;
if (!initialized)
{
if (GAME && GAME->GetSystemState() == eSystemState::GS_PLAYING_GAME && SF->getSAMP()->IsInitialized())
{
initialized = true;
SF->getSAMP()->getChat()->AddChatMessage(D3DCOLOR_XRGB(0, 0xAA, 0), "SAMPFUNCS Plugin loaded.");
}
}
}
BOOL APIENTRY DllMain(HMODULE hModule, DWORD dwReasonForCall, LPVOID lpReserved)
{
if (dwReasonForCall == DLL_PROCESS_ATTACH)
SF->initPlugin(mainloop, hModule);
return TRUE;
}
Установи DirectX SDKПосмотреть вложение 152702
Стандартный код из SampFuncs 5.4.1
Не понимаю в чём ошибка
C++:#include <Windows.h> #include "main.h" SAMPFUNCS* SF = new SAMPFUNCS(); void __stdcall mainloop() { static bool initialized = false; if (!initialized) { if (GAME && GAME->GetSystemState() == eSystemState::GS_PLAYING_GAME && SF->getSAMP()->IsInitialized()) { initialized = true; SF->getSAMP()->getChat()->AddChatMessage(D3DCOLOR_XRGB(0, 0xAA, 0), "SAMPFUNCS Plugin loaded."); } } } BOOL APIENTRY DllMain(HMODULE hModule, DWORD dwReasonForCall, LPVOID lpReserved) { if (dwReasonForCall == DLL_PROCESS_ATTACH) SF->initPlugin(mainloop, hModule); return TRUE; }