当前位置: 首页>>代码示例>>C++>>正文


C++ CBaseMultiplayerPlayer::GetUserID方法代码示例

本文整理汇总了C++中CBaseMultiplayerPlayer::GetUserID方法的典型用法代码示例。如果您正苦于以下问题:C++ CBaseMultiplayerPlayer::GetUserID方法的具体用法?C++ CBaseMultiplayerPlayer::GetUserID怎么用?C++ CBaseMultiplayerPlayer::GetUserID使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在CBaseMultiplayerPlayer的用法示例。


在下文中一共展示了CBaseMultiplayerPlayer::GetUserID方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: ClientCommand

	bool CMultiplayRules::ClientCommand( CBaseEntity *pEdict, const CCommand &args )
	{
		CBasePlayer *pPlayer = ToBasePlayer( pEdict );

		const char *pcmd = args[0];
		if ( FStrEq( pcmd, "voicemenu" ) )
		{
			if ( args.ArgC() < 3 )
				return true;

			CBaseMultiplayerPlayer *pMultiPlayerPlayer = dynamic_cast< CBaseMultiplayerPlayer * >( pPlayer );

			if ( pMultiPlayerPlayer )
			{
				int iMenu = atoi( args[1] );
				int iItem = atoi( args[2] );

				VoiceCommand( pMultiPlayerPlayer, iMenu, iItem );
			}

			return true;
		}
		else if ( FStrEq( pcmd, "achievement_earned" ) )
		{
			CBaseMultiplayerPlayer *pPlayer = static_cast<CBaseMultiplayerPlayer*>( pEdict );
			if ( pPlayer && pPlayer->ShouldAnnounceAchievement() )
			{
				// let's check this came from the client .dll and not the console
				unsigned short mask = UTIL_GetAchievementEventMask();
				int iPlayerID = pPlayer->GetUserID();

				int iAchievement = atoi( args[1] ) ^ mask;
				int code = ( iPlayerID ^ iAchievement ) ^ mask;

				if ( code == atoi( args[2] ) )
				{
					IGameEvent * event = gameeventmanager->CreateEvent( "achievement_earned" );
					if ( event )
					{
						event->SetInt( "player", pEdict->entindex() );
						event->SetInt( "achievement", iAchievement );
						gameeventmanager->FireEvent( event );
					}

					pPlayer->OnAchievementEarned( iAchievement );
				}
			}

			return true;
		}

		return BaseClass::ClientCommand( pEdict, args );

	}
开发者ID:,项目名称:,代码行数:54,代码来源:


注:本文中的CBaseMultiplayerPlayer::GetUserID方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。