All pastes #150759 Raw Edit

Untitled

public text v1 · immutable
#150759 ·published 2006-08-27 08:55 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;
}