23.06.2012, 01:48
(
Last edited by MP2; 23/06/2012 at 08:25 AM.
)
UPDATE: Fixed a couple of issues:
Issue #1: If you run a player over and while down they press G, OnPlayerEnterVehicle isn't called but after getting up they start to enter the vehicle. This would allow them to bypass this system, so I now detect if their special action is SPECIAL_ACTION_ENTER_VEHICLE under OnPlayerUpdate. Fixed.
Issue #2: To detect when a player starts to step in to a vehicle I detect if their velocity is 0 and their special action is SPECIAL_ACTION_ENTER_VEHICLE. It works but under specific timing conditions it may think you're stepping in when you START to run to a vehicle (when OnPlayerEnterVehicle is called) - this is now fixed by 'confirming' this event with GetTickCount. Fixed.
EDIT: Update #2: Fixed a bug where if a player entered a vehicle as a passenger but it took a while, for example he may have to run around the vehicle to get to the door on the other side, he would teleport inside and be denied entry. If the vehicle doesn't move more than 2* meters when he finally gets in, entry is now granted.
* Configurable via define in include. 2 by default. I don't recommend more than 4.
Issue #1: If you run a player over and while down they press G, OnPlayerEnterVehicle isn't called but after getting up they start to enter the vehicle. This would allow them to bypass this system, so I now detect if their special action is SPECIAL_ACTION_ENTER_VEHICLE under OnPlayerUpdate. Fixed.
Issue #2: To detect when a player starts to step in to a vehicle I detect if their velocity is 0 and their special action is SPECIAL_ACTION_ENTER_VEHICLE. It works but under specific timing conditions it may think you're stepping in when you START to run to a vehicle (when OnPlayerEnterVehicle is called) - this is now fixed by 'confirming' this event with GetTickCount. Fixed.
EDIT: Update #2: Fixed a bug where if a player entered a vehicle as a passenger but it took a while, for example he may have to run around the vehicle to get to the door on the other side, he would teleport inside and be denied entry. If the vehicle doesn't move more than 2* meters when he finally gets in, entry is now granted.
* Configurable via define in include. 2 by default. I don't recommend more than 4.