@@ -4955,32 +4955,43 @@ void CClientGame::ProcessVehicleInOutKey ( bool bPassenger )
49554955 // If the vehicle's a boat, make sure we're standing on it (we need a dif task to enter boats properly)
49564956 if ( pVehicle->GetVehicleType () != CLIENTVEHICLE_BOAT || m_pLocalPlayer->GetContactEntity () == pVehicle )
49574957 {
4958- // Send an in request
4959- NetBitStreamInterface* pBitStream = g_pNet->AllocateNetBitStream ();
4960- if ( pBitStream )
4958+ // Call the onClientVehicleStartEnter event for remote players
4959+ // Local player triggered before sending packet in CClientGame
4960+ CLuaArguments Arguments;
4961+ Arguments.PushElement (m_pLocalPlayer); // player
4962+ Arguments.PushNumber (uiSeat); // seat
4963+ Arguments.PushNumber (uiDoor); // Door
4964+
4965+ if ( pVehicle->CallEvent (" onClientVehicleStartEnter" , Arguments, true ) )
49614966 {
4962- // Write the vehicle id to it and that we're requesting to get into it
4963- pBitStream->Write ( pVehicle->GetID () );
4964- unsigned char ucAction = static_cast < unsigned char > ( VEHICLE_REQUEST_IN );
4965- unsigned char ucSeat = static_cast < unsigned char > ( uiSeat );
4966- bool bIsOnWater = pVehicle->IsOnWater ();
4967- unsigned char ucDoor = static_cast < unsigned char > ( uiDoor );
4968- pBitStream->WriteBits ( &ucAction, 4 );
4969- pBitStream->WriteBits ( &ucSeat, 4 );
4970- pBitStream->WriteBit ( bIsOnWater );
4971- pBitStream->WriteBits ( &ucDoor, 3 );
4972-
4973- // Send and destroy it
4974- g_pNet->SendPacket ( PACKET_ID_VEHICLE_INOUT, pBitStream, PACKET_PRIORITY_HIGH, PACKET_RELIABILITY_RELIABLE_ORDERED );
4975- g_pNet->DeallocateNetBitStream ( pBitStream );
4976-
4977- // We're now entering a vehicle
4978- m_bIsGettingIntoVehicle = true ;
4979- m_ulLastVehicleInOutTime = CClientTime::GetTime ();
49804967
4981- #ifdef MTA_DEBUG
4982- g_pCore->GetConsole ()->Printf ( " * Sent_InOut: vehicle_request_in" );
4983- #endif
4968+ // Send an in request
4969+ NetBitStreamInterface* pBitStream = g_pNet->AllocateNetBitStream ();
4970+ if ( pBitStream )
4971+ {
4972+ // Write the vehicle id to it and that we're requesting to get into it
4973+ pBitStream->Write ( pVehicle->GetID () );
4974+ unsigned char ucAction = static_cast < unsigned char > ( VEHICLE_REQUEST_IN );
4975+ unsigned char ucSeat = static_cast < unsigned char > ( uiSeat );
4976+ bool bIsOnWater = pVehicle->IsOnWater ();
4977+ unsigned char ucDoor = static_cast < unsigned char > ( uiDoor );
4978+ pBitStream->WriteBits ( &ucAction, 4 );
4979+ pBitStream->WriteBits ( &ucSeat, 4 );
4980+ pBitStream->WriteBit ( bIsOnWater );
4981+ pBitStream->WriteBits ( &ucDoor, 3 );
4982+
4983+ // Send and destroy it
4984+ g_pNet->SendPacket ( PACKET_ID_VEHICLE_INOUT, pBitStream, PACKET_PRIORITY_HIGH, PACKET_RELIABILITY_RELIABLE_ORDERED );
4985+ g_pNet->DeallocateNetBitStream ( pBitStream );
4986+
4987+ // We're now entering a vehicle
4988+ m_bIsGettingIntoVehicle = true ;
4989+ m_ulLastVehicleInOutTime = CClientTime::GetTime ();
4990+
4991+ #ifdef MTA_DEBUG
4992+ g_pCore->GetConsole ()->Printf ( " * Sent_InOut: vehicle_request_in" );
4993+ #endif
4994+ }
49844995 }
49854996 }
49864997 }
0 commit comments