Cronoss Posted February 20, 2022 Share Posted February 20, 2022 Well, I'm trying to make something like this; if the owner locked his vehicle, then he CAN'T get out of the car. The problem with this is that when I use "cancelEvent()" for it, the script also stops the event for "car jack", so if another player tries to steal a locked car with the owner inside, the server doesn't show the "try to enter in a vehicle" animation and the car-lock system stops working correctly Code in server side: function blockExit() local playerInside = getVehicleOccupant(source) -------I added this recently, because I want to figure out how to make only the player inside get the "cancel event" and not the player outside the vehicle if(isVehicleLocked(source)) then -----if veh locked cancelEvent() ----cancels the event but it also cancels the carjack animation and gets me an annoying bug end end addEventHandler("onVehicleStartExit", getRootElement(), blockExit) Link to comment
βurak Posted February 20, 2022 Share Posted February 20, 2022 (edited) maybe you can do it like this to accept the animation of others entering the car function blockExit(exitingPed, seat, jacked, door) if(isVehicleLocked(source)) then if(not jacked) then --cancel if car is not jacked cancelEvent() end end end addEventHandler("onVehicleStartExit", getRootElement(), blockExit) Edited February 20, 2022 by Burak5312 1 1 Link to comment
Cronoss Posted February 21, 2022 Author Share Posted February 21, 2022 It worked, thank you again Burak! 1 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