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("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 main()
{
int id_banan = 2;
initialize();
char buffer[64];
sprintf_s(buffer, "Banan id: %d", id_banan);
add_chat_message(-1, buffer);
}