Here is my main.cpp
Code:
#include <windows.h>
#include <string>
#include <assert.h>
#include <process.h>

#include "SAMPFUNCS_API.h"
#include "game_api\game_api.h"
#include "main.h"

SAMPFUNCS *SF = new SAMPFUNCS();
bool Active = false;
std::string text("ImGUI Test");



std::string cp1251_to_utf8(const char *str)
{
	std::string res;
	int result_u, result_c;
	result_u = MultiByteToWideChar(1251, 0, str, -1, 0, 0);
	if (!result_u)
		return 0;
	wchar_t *ures = new wchar_t[result_u];
	if (!MultiByteToWideChar(1251, 0, str, -1, ures, result_u)) {
		delete[] ures;
		return 0;
	}
	result_c = WideCharToMultiByte(CP_UTF8, 0, ures, -1, 0, 0, 0, 0);
	if (!result_c) {
		delete[] ures;
		return 0;
	}
	char *cres = new char[result_c];
	if (!WideCharToMultiByte(CP_UTF8, 0, ures, -1, cres, result_c, 0, 0)) {
		delete[] cres;
		return 0;
	}
	delete[] ures;
	res.append(cres);
	delete[] cres;
	return res;
}

std::string Utf8_to_cp1251(const char *str) {
	std::string res;
	int result_u, result_c;

	result_u = MultiByteToWideChar(CP_UTF8, 0, str, -1, 0, 0);
	if (!result_u)
		return std::string();
	wchar_t *ures = new wchar_t[result_u];
	if (!MultiByteToWideChar(CP_UTF8, 0, str, -1, ures, result_u)) {
		delete[] ures;
		return 0;
	}
	result_c = WideCharToMultiByte(1251, 0, ures, -1, 0, 0, 0, 0);
	if (!result_c) {
		delete[] ures;
		return 0;
	}
	char *cres = new char[result_c];
	if (!WideCharToMultiByte(1251, 0, ures, -1, cres, result_c, 0, 0)) {
		delete[] cres;
		return 0;
	}
	delete[] ures;
	res.append(cres);
	delete[] cres;
	return res;
}

bool CALLBACK Present(CONST RECT *pSourceRect, CONST RECT *pDestRect, HWND hDestWindowOverride, CONST RGNDATA *pDirtyRegion) {
	bool her;
	char buff[1024];
	if (Active && ImGUI_CanDraw()) {
		ImGui::Begin(cp1251_to_utf8("Russian KIDD").c_str(), &her, ImVec2(700, 100));
		if (ImGui::Button(cp1251_to_utf8("Magie").c_str()))
			SF->getSAMP()->getChat()->AddChatMessage(-1, text.c_str());
		strcpy(buff, cp1251_to_utf8(text.c_str()).c_str());
		if (ImGui::InputText(cp1251_to_utf8("TEXT").c_str(), buff, sizeof(buff)))
			text = Utf8_to_cp1251(buff);
		ImGui::End();
	}
	return true;
};

void CALLBACK PluginFree() {
	RemovePresent(Present);
}

void CALLBACK mainloop()
{
	static bool init = false;
	if (!init)
	{
		if (GAME == nullptr)
			return;
		if (GAME->GetSystemState() != eSystemState::GS_PLAYING_GAME)
			return;
		if (!SF->getSAMP()->IsInitialized())
			return;
		if (!ImGUI_Loaded())
			return;
		AddPresent(Present);
		SF->getSAMP()->getChat()->AddChatMessage(D3DCOLOR_XRGB(0, 0xAA, 0), "ImGUI Test Loaded.");
		SF->getGame()->registerGameDestructorCallback(PluginFree);
		init = true;
	}
	if (SF->getGame()->isKeyPressed(VK_F10)) {
		Active = !Active;
		SF->getSAMP()->getMisc()->ToggleCursor(Active);
	}

}

BOOL APIENTRY DllMain(HMODULE hModule, DWORD dwReasonForCall, LPVOID lpReserved)
{
	switch (dwReasonForCall)
	{
	case DLL_PROCESS_ATTACH:
		SF->initPlugin(mainloop, hModule);
		break;
	case DLL_THREAD_ATTACH:
	case DLL_THREAD_DETACH:
	case DLL_PROCESS_DETACH:
		break;
	}
	return TRUE;
}
Here is the main.h that I #include
Code:
#define _SILENCE_STDEXT_HASH_DEPRECATION_WARNINGS
#include <windows.h>
#include <string>
#include <assert.h>
#include <process.h>
//----------------------------------------------
#include <d3dx9.h>
#define DIRECTINPUT_VERSION 0x0800
#include <dinput.h>
#include <DxErr.h>
//----------------------------------------------
#include "SAMPFUNCS_API.h"
#include "game_api\game_api.h"
//----------------------------------------------
#pragma comment(lib, "ImGUI API.lib")

__declspec(dllimport)
void AddPresent(bool(CALLBACK*pPresent)(CONST RECT *, CONST RECT *, HWND, CONST RGNDATA *));
__declspec(dllimport)
void RemovePresent(bool(CALLBACK*pPresent)(CONST RECT *, CONST RECT *, HWND, CONST RGNDATA *));
#include "ImGUI/imgui.h"
#include "ImGUI/imgui_internal.h"
#include "ImGUI/imgui_impl_dx9.h"

#pragma comment(lib, "dxerr.lib")

//extern SAMPFUNCS *SF;
I know that it is from ImGUI because If I comment any ImGUI things out from main.cpp the plugin initializes, but if I dont comment them it doesnt initialize.