Skip to content

Commit 388d7a1

Browse files
committed
Emulate SA-MP vehicle locking behaviour
Prevent enter vehicle event when entering as driver to accurately emulate SA-MP's lock function.
1 parent 6ca4f17 commit 388d7a1

File tree

1 file changed

+9
-0
lines changed

1 file changed

+9
-0
lines changed

amx/client/client.lua

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -536,6 +536,15 @@ addEventHandler('onClientElementStreamOut', root,
536536
end
537537
)
538538

539+
-- emulate SA-MP behaviour: block enter attempts as driver to locked vehicles
540+
addEventHandler('onClientVehicleStartEnter', root,
541+
function(player, seat, door)
542+
if (player == g_Me and seat == 0 and isVehicleLocked(source)) then
543+
cancelEvent()
544+
end
545+
end
546+
)
547+
539548
function DestroyVehicle(amxName, vehID)
540549
g_AMXs[amxName].vehicles[vehID] = nil
541550
end

0 commit comments

Comments
 (0)