Feche1320 Posted October 5, 2014 Share Posted October 5, 2014 Hello there, is there any way to prevent a player to exit the vehicle? I tried with setVehicleLocked and setElementFrozen but none of them works, tried unBindKey but it won't work for GTA SA default ones.. thanks! Link to comment
Anubhav Posted October 5, 2014 Share Posted October 5, 2014 [lua] addEventHandler("onPlayerVehicleExit", root, function() cancelEvent() end) Link to comment
Feche1320 Posted October 5, 2014 Author Share Posted October 5, 2014 [lua]addEventHandler("onPlayerVehicleExit", root, function() cancelEvent() end) Nope, doesn't work.. Link to comment
Feche1320 Posted October 5, 2014 Author Share Posted October 5, 2014 Nope, still not working.. the player can get out of the car.. Link to comment
Mr_Moose Posted October 5, 2014 Share Posted October 5, 2014 (edited) Cancel event's has to be done client side, at least it works for event's such as weapon fire, logically this should work. addEventHandler("onVehicleStartExit", root, function() cancelEvent() end) Edit: Use "onVehicleStartExit", https://wiki.multitheftauto.com/wiki/OnVehicleStartExit Edited October 5, 2014 by Guest Link to comment
Feche1320 Posted October 5, 2014 Author Share Posted October 5, 2014 Nevermind, I was using toggleAllControls on other script.. using toggleControl works great, thanks for the help guys Link to comment
tosfera Posted October 5, 2014 Share Posted October 5, 2014 addEventHandler ( "onVehicleStartExit", getRootElement() function ( thePlayer ) cancelEvent() end ) Link to comment
RenanPG Posted October 5, 2014 Share Posted October 5, 2014 --// Client addEventHandler("onClientPlayerVehicleExit", getRootElement(), function() cancelEvent() end) Link to comment
xeon17 Posted October 5, 2014 Share Posted October 5, 2014 --// Client addEventHandler("onClientPlayerVehicleExit", getRootElement(), function() cancelEvent() end) It won't work , because this event happen when a player exit a vehicle and it can't be canceled. Use the code of tosfera , it will work. Link to comment
Mr_Moose Posted October 5, 2014 Share Posted October 5, 2014 Xeon is right, I made the same mistake, should have read the wiki page immediately instead, in fact, the example in there is a cancellation of the event. https://wiki.multitheftauto.com/wiki/OnVehicleStartExit Link to comment
DNL291 Posted October 6, 2014 Share Posted October 6, 2014 No need to use that event anyway, since toggleControl function works fine and this topic is already solved. Link to comment
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now