struct c_chat* g_chat{ nullptr };
uintptr_t base_address{ 0 };
unsigned long get_address(uintptr_t offset)
{
return base_address + offset;
}
void initialize()
{
base_address = reinterpret_cast<uintptr_t>(GetModuleHandleA(xorstr("samp.dll")));
g_chat = *reinterpret_cast<struct c_chat**>(get_address(0x26E8C8));
}
void add_chat_message(u_long color, const char* szText)
{
((void(__thiscall*)(c_chat*, unsigned long, const char*))get_address(0x679F0))(g_chat, color, szText);
}
void function()
{
if (GetAsyncKeyState('key'))
{
initialize()
add_chat_message(-1, "text")
}
}