HLPlayer

From Valve Developer Community
Jump to: navigation, search

This is the basic interface for hl2 players

#include <boost/python.hpp>
namespace bp = boost::python;

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

	bp::class_<CBasePlayer, bp::bases<CBaseEntity> , boost::noncopyable>("CBasePlayer", bp::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);

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