Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
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
9 changes: 9 additions & 0 deletions Client/mods/deathmatch/logic/CClientPed.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -6660,6 +6660,15 @@ bool CClientPed::EnterVehicle(CClientVehicle* pVehicle, bool bPassenger)
return false;
}

// Validate camper seat to avoid multiple occupants && desyncronization
if (vehicleModel == VehicleType::VT_CAMPER && uiSeat > 0 && pVehicle->GetOccupant(uiSeat))
{
#ifdef MTA_DEBUG
g_pCore->GetConsole()->Printf("Blocked entering to camper seat %d because it's already occupied.", uiSeat);
#endif
return false;
}

// Call the onClientVehicleStartEnter event for the ped
// Check if it is cancelled before sending packet
CLuaArguments Arguments;
Expand Down
2 changes: 1 addition & 1 deletion Client/mods/deathmatch/logic/CClientVehicleManager.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ const SFixedArray<unsigned char, 212> g_ucMaxPassengers = {3, 1, 1, 1, 3,
0, 1, 1, 255, 1, 8, 3, 1, 3, 0, 1, 1, 1, 3, 0, 1, // 432->447
0, 1, 255, 1, 0, 0, 0, 1, 1, 1, 3, 3, 1, 1, 1, // 448->462
1, 1, 1, 3, 3, 1, 1, 3, 1, 0, 0, 1, 1, 0, 1, 1, // 463->478
3, 1, 0, 3, 1, 0, 0, 0, 3, 1, 1, 3, 1, 3, 0, 1, // 479->494
3, 1, 0, 3, 3, 0, 0, 0, 3, 1, 1, 3, 1, 3, 0, 1, // 479->494
1, 1, 3, 3, 1, 1, 1, 1, 1, 1, 1, 1, 3, 1, 0, 0, // 495->510
1, 0, 0, 1, 1, 3, 1, 1, 0, 0, 1, 1, 1, 1, 1, 1, // 511->526
1, 1, 3, 0, 0, 0, 1, 1, 1, 1, 1, 1, 0, 3, 1, // 527->541
Expand Down
4 changes: 4 additions & 0 deletions Client/mods/deathmatch/logic/CStaticFunctionDefinitions.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -9963,6 +9963,10 @@ bool CStaticFunctionDefinitions::WarpPedIntoVehicle(CClientPed* pPed, CClientVeh
if (pPed->IsLocalEntity() != pVehicle->IsLocalEntity())
return false;

// Camper only has 3 seats (0-2)
if (static_cast<VehicleType>(pVehicle->GetModel()) == VehicleType::VT_CAMPER && uiSeat > 2)
return false;

if (pPed->IsLocalEntity())
{
//
Expand Down
4 changes: 4 additions & 0 deletions Server/mods/deathmatch/logic/CStaticFunctionDefinitions.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -4280,6 +4280,10 @@ bool CStaticFunctionDefinitions::WarpPedIntoVehicle(CPed* pPed, CVehicle* pVehic
if (uiSeat > 0 && pVehicle->GetMaxPassengers() == VEHICLE_PASSENGERS_UNDEFINED)
return false;

// Camper only has 3 seats (0-2)
if (pVehicle->GetModel() == VT_CAMPER && uiSeat > 2)
return false;

// Valid seat id for that vehicle?
// Temp fix: Disable driver seat for train carriages since the whole vehicle sync logic is based on the the player on the first seat being the vehicle
// syncer (Todo)
Expand Down
2 changes: 1 addition & 1 deletion Server/mods/deathmatch/logic/CVehicleManager.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ static const SFixedArray<unsigned char, 212> g_ucMaxPassengers = {{3, 1, 1,
0, 1, 1, 255, 1, 8, 3, 1, 3, 0, 1, 1, 1, 3, 0, 1, // 432->447
0, 1, 255, 1, 0, 0, 0, 1, 1, 1, 3, 3, 1, 1, 1, // 448->462
1, 1, 1, 3, 3, 1, 1, 3, 1, 0, 0, 1, 1, 0, 1, 1, // 463->478
3, 1, 0, 3, 1, 0, 0, 0, 3, 1, 1, 3, 1, 3, 0, 1, // 479->494
3, 1, 0, 3, 3, 0, 0, 0, 3, 1, 1, 3, 1, 3, 0, 1, // 479->494
1, 1, 3, 3, 1, 1, 1, 1, 1, 1, 1, 1, 3, 1, 0, 0, // 495->510
1, 0, 0, 1, 1, 3, 1, 1, 0, 0, 1, 1, 1, 1, 1, 1, // 511->526
1, 1, 3, 0, 0, 0, 1, 1, 1, 1, 1, 1, 0, 3, 1, // 527->541
Expand Down