Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix onVehicleExit doesn't trigger if pulled out #3492

Merged
merged 10 commits into from
Jun 20, 2024
Merged
Changes from 4 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 18 additions & 0 deletions Server/mods/deathmatch/logic/CGame.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -3659,6 +3659,7 @@ void CGame::Packet_Vehicle_InOut(CVehicleInOutPacket& Packet)
if (pPed->GetVehicleAction() == CPed::VEHICLEACTION_JACKING)
{
unsigned char ucDoor = Packet.GetDoor();
unsigned char ucOccupiedSeat = pPed->GetOccupiedVehicleSeat();
float fAngle = Packet.GetDoorAngle();
CPed* pJacked = pVehicle->GetOccupant(0);

Expand Down Expand Up @@ -3692,6 +3693,23 @@ void CGame::Packet_Vehicle_InOut(CVehicleInOutPacket& Packet)
CVehicleInOutPacket JackedReply(pJacked->GetID(), VehicleID, 0, VEHICLE_NOTIFY_OUT_RETURN);
m_pPlayerManager->BroadcastOnlyJoined(JackedReply);

CLuaArguments Arguments;
Arguments.PushElement(pJacked); // player / ped
Proxy-99 marked this conversation as resolved.
Show resolved Hide resolved
Arguments.PushNumber(ucOccupiedSeat); // seat
Arguments.PushElement(pPed); // jacker
Arguments.PushBoolean(false); // forcedByScript

if (pJacked->IsPlayer())
{
pJacked->CallEvent("onPlayerVehicleExit", Arguments);
Proxy-99 marked this conversation as resolved.
Show resolved Hide resolved
}
else
{
pJacked->CallEvent("onPedVehicleExit", Arguments);
Proxy-99 marked this conversation as resolved.
Show resolved Hide resolved
}

pVehicle->CallEvent("onVehicleExit", Arguments);
Proxy-99 marked this conversation as resolved.
Show resolved Hide resolved

if (!sendListIncompatiblePlayers.empty())
{
// Warp the ped out of the vehicle manually for incompatible players
Expand Down
Loading