Feche1320 Posted October 5, 2014 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!
Anubhav Posted October 5, 2014 Posted October 5, 2014 [lua] addEventHandler("onPlayerVehicleExit", root, function() cancelEvent() end)
Feche1320 Posted October 5, 2014 Author Posted October 5, 2014 [lua]addEventHandler("onPlayerVehicleExit", root, function() cancelEvent() end) Nope, doesn't work..
Feche1320 Posted October 5, 2014 Author Posted October 5, 2014 Nope, still not working.. the player can get out of the car..
Mr_Moose Posted October 5, 2014 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
Feche1320 Posted October 5, 2014 Author Posted October 5, 2014 Nevermind, I was using toggleAllControls on other script.. using toggleControl works great, thanks for the help guys
tosfera Posted October 5, 2014 Posted October 5, 2014 addEventHandler ( "onVehicleStartExit", getRootElement() function ( thePlayer ) cancelEvent() end )
RenanPG Posted October 5, 2014 Posted October 5, 2014 --// Client addEventHandler("onClientPlayerVehicleExit", getRootElement(), function() cancelEvent() end)
xeon17 Posted October 5, 2014 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.
Mr_Moose Posted October 5, 2014 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
DNL291 Posted October 6, 2014 Posted October 6, 2014 No need to use that event anyway, since toggleControl function works fine and this topic is already solved.
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