HLPlayer: Difference between revisions

From Valve Developer Community
Jump to navigation Jump to search
(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…')
 
No edit summary
Line 2: Line 2:


<source lang=cpp>
<source lang=cpp>
BOOST_PYTHON_MODULE(GEPlayer)
BOOST_PYTHON_MODULE(HLPlayer)
{
{
//because CommitSuicide is overloaded we must tell it which one to use
//because CommitSuicide is overloaded we must tell it which one to use

Revision as of 02:34, 4 September 2009

This is the basic interface for hl2 players

BOOST_PYTHON_MODULE(HLPlayer)
{
	//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);
}