Пример #1
0
void PlayerVehicle::DoActivate(HOBJECT hSender)
{
	// Make sure we're visible (i.e., spawned in)...

    uint32 dwFlags = g_pLTServer->GetObjectFlags(m_hObject);
	if ( !(dwFlags & FLAG_VISIBLE) || !hSender || !IsPlayer(hSender)) return;


	// Tell the player to hop aboard...

    CPlayerObj* pPlayer = (CPlayerObj*)g_pLTServer->HandleToObject(hSender);
	if (pPlayer)
	{
		pPlayer->RideVehicle(this);
	}
}
Пример #2
0
void PlayerVehicle::DoActivate(HOBJECT hSender)
{
	// Check if vehicle already being ridden.
	if( m_bRidden )
		return;

	// Make sure we're visible (i.e., spawned in)...

    uint32 dwFlags;
	g_pCommonLT->GetObjectFlags(m_hObject, OFT_Flags, dwFlags);
	if ( !(dwFlags & FLAG_VISIBLE) || !hSender || !IsPlayer(hSender)) return;

	
	if( m_bLocked )
	{
		// Check to see if the player has the correct keys to operate a vehicle...

		if( !g_pKeyMgr->CanCharacterControlObject( hSender, m_hObject ))
		{
			// Send a command if we have one...

			if( m_hstrLockedCommand )
			{
				const char	*pCmd = g_pLTServer->GetStringData( m_hstrLockedCommand );

				if( pCmd && g_pCmdMgr->IsValidCmd( pCmd ))
				{
					g_pCmdMgr->Process( pCmd, m_hObject, hSender );
				}
			}

			// No keys? No vehicle! 
		
			return;
		}
	}

	// Tell the player to hop aboard...

    CPlayerObj* pPlayer = (CPlayerObj*)g_pLTServer->HandleToObject(hSender);
	if (pPlayer)
	{
		pPlayer->RideVehicle(this);
	}
}