All pastes #150764 Raw Edit

Unnamed

public text v1 · immutable
#150764 ·published 2006-08-27 09:00 UTC
rendered paste body
/***************************************************************
*  SetHealth (int pIndex, int pHealth)
*
* @param pIndex Index of player you wish to set health of
* @param pHealth  How much health they should have.
*
*  Based on Code By CoolPete  http://sourceplugins.com/viewtopic.php?t=3809
*        You are my hero, thank you again. (~KinkyMunkey)
****************************************************************/
void cssrpg_ModCompatibility::SetHealth(int pIndex, int pHealth) {

	// GetBaseEntity
	CBaseEntity *pBase = CRPG_Utils::s_engine()->PEntityOfEntIndex(pIndex)->GetUnknown()->GetBaseEntity();

	// GetHealth
	//iHealth = *(int*)((char*)pBase + iHealthOffset)

	// SetHealth
	*(int*)((char*)pBase + iHealthOffset) = pHealth; 
	return ;
}