My code is based off scoudem's mw2lt, it's really the only open source base I can use to work off because I'm a paster noob.

Call is from an ImGui menu:
Code:
player_die(entity, hostEntity, hostEntity, 1000, MOD_RIFLE_BULLET, weap, v3, HITLOC_TORSO_UPR, 0);
player_die is defined as follows:
Code:
#define IW4_FUNCTION(FUNC_NAME, RETURN_TYPE, ARGUMENTS, ADDRESS) inline RETURN_TYPE(*FUNC_NAME) ARGUMENTS = reinterpret_cast<RETURN_TYPE(*) ARGUMENTS>(ADDRESS)

typedef float vec_t;

typedef vec_t vec3_t[3];

IW4_FUNCTION(player_die, void, (gentity_s *self, gentity_s *inflictor, gentity_s *attacker, int damage, MeansOfDeath meansOfDeath, int iWeapon, const float *vDir, hitLocation_t hitLoc, int psTimeOffset), 0x526A00);
My suspicions are entity and hostEntity aren't actually the correct entities to kill/kill with, as the debugger in visual studio doesn't appear to contain any player-related info in the variables after the crash.

Full kill method:
Code:
const auto entity = &g_entities[2]; // the id passed to the function is hardcoded here as its the same every time

    const auto hostEntity = &g_entities[*g_hostId];

	vec3_t v3;
	v3[0] = 0;
	v3[1] = 0;
	v3[2] = 0;

	int weap = BG_FindWeaponIndexForName("fn2000_mp"); // 456

	auto attackerName = hostEntity->client ? Party::g_partyData->partyMembers[hostEntity->state.number].name : "undefined";
	auto selfName = entity->client ? Party::g_partyData->partyMembers[entity->state.number].name : "undefined";

	std::printf("%s %s", selfName, attackerName); // this prints the expected strings

	player_die(entity, hostEntity, hostEntity, 1000, MOD_RIFLE_BULLET, weap, v3, HITLOC_TORSO_UPR, 0); // crash here

Exception thrown:
Code:
Exception thrown at 0x00462E04 in iw4mp.exe: 0xC0000005: Access violation writing location 0x00083894.
Screenshot from debugger: i.imgur.com/OdX0WvY.png

Have also tried using the event queue, doesn't work either.