HLPlayer

From Valve Developer Community
Revision as of 02:34, 4 September 2009 by Lodle (talk | contribs) (Created page with 'This is the basic interface for hl2 players <source lang=cpp> BOOST_PYTHON_MODULE(GEPlayer) { //because CommitSuicide is overloaded we must tell it which one to use void (CBas…')
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to navigation Jump to search

This is the basic interface for hl2 players

BOOST_PYTHON_MODULE(GEPlayer)
{
	//because CommitSuicide is overloaded we must tell it which one to use
	void (CBasePlayer::*CommitSuicideFP)(bool, bool) = &CBasePlayer::CommitSuicide;

	class_<CBasePlayer, bases<CBaseEntity> , boost::noncopyable>("CBasePlayer", no_init)
		.def("DeathCount", &CBasePlayer::DeathCount)
		.def("ArmorValue", &CBasePlayer::ArmorValue)
		.def("ResetDeathCount", &CBasePlayer::ResetDeathCount)
		.def("CommitSuicide", CommitSuicideFP)
		.def("GetPlayerName", &CBasePlayer::GetPlayerName)
		.def("GetHealth", &CBasePlayer::GetHealth);

	class_<CHL2_Player, bases<CBasePlayer>, boost::noncopyable >("CHL2_Player", no_init)
		.def("Weapon_Switch", &CHL2_Player::Weapon_Switch);
}