Stranger Posted April 6, 2014 Share Posted April 6, 2014 hey guys, i was wondering how if i was in a vehicle , and i make code that if the player enter the vehicle, the code will work if he exit not work, but how to make it if the vehicle destroyed not work ? Link to comment
iPrestege Posted April 6, 2014 Share Posted April 6, 2014 Checking the element exists or no and isPedInVehicle? and vehicle is that vehicle? isElement isPedInVehicle Link to comment
Stranger Posted April 6, 2014 Author Share Posted April 6, 2014 will i tried, but not work: setTimer (function () local vehicle = getPedOccupiedVehicle (source) if not isElement (vehicle) and not isPedInVehicle (source) then killTimer (timer[source]) timer[source] = nil end end, 3000, 0) Link to comment
iPrestege Posted April 6, 2014 Share Posted April 6, 2014 Where's source defined in? And timer also. Link to comment
Moderators Citizen Posted April 6, 2014 Moderators Share Posted April 6, 2014 Please use google translate and tell us again what you are trying to do. I understood you wanted to destroy the vehicle after 3 secs when someone enters but not when he leave the car before the 3 secs. This make no sense so I'm waiting for your explanations. Link to comment
Stranger Posted April 6, 2014 Author Share Posted April 6, 2014 i said, that if the player entered the vehicle, and there is a timer, the timer will work , but if he go out the vehicle the timer stop, i want it if the vehicle destroyed the timer stop. i make like that but not working: setTimer (function (source) veh = getPedOccupiedVehicle (source) if veh then if isElement (veh) and not isPedInVehicle (source) then killTimer (timer[source]) timer[source] = nil end end end, 2000, 0) Link to comment
Arnold-1 Posted April 6, 2014 Share Posted April 6, 2014 addEventHandler("onVehicleEnter",yourvehicle, function (ply) veh = getPlayerOccupiedVehicle(ply) timer = setTimer(des,5000,1,ply,veh) end ) function des (play,vehi) if isElement(vehi) and isPedInVehicle(play) then destroyElement(vehicle) end Link to comment
Stranger Posted April 7, 2014 Author Share Posted April 7, 2014 will, thanks for your help, but this is not what i meant,i will try to tell you what i meant in easy way , ok i meant if there is a timer ok ? and the timer not work if the player out of the car, if he enterd the car , the timer will start, but if he exit from the vehicle, the timer stop, and this i can use to make like what i said now, 'onVehicleEnter', 'onVehicleExit' setTimer .. killTimer .. ok ? but i want it if the player in the vehicle and lit's say an admin destroyed the vehicle ok ? how to make the timer stop ? if the vehicle destroyed and the player in the vehicle the timer will keep going not gonna stop until i restart the mode, so i hope that what I have said to you very clear. Link to comment
Arnold-1 Posted April 7, 2014 Share Posted April 7, 2014 Look dude, you don't need to stop the timer, because it already will check if the player is still in the vehicle after the timer finish, so i made it for you in an easier way, test it, it's the same of what you wanted, and good luck in what you're doing. 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