opnaiC Posted May 13, 2016 Share Posted May 13, 2016 Hello, I want that when a player leaves the vehicle it respawns after 10 seconds, but when he leaves it and enter it again it should not respawn. Here is my function (its not working): function bmx () local bmxbike = { [510]=true } local checkedPlayer = getPlayerFromName ( checkedPlayerName ) if ( checkedPlayer ) then if bmxbike[getElementModel(source)] and isPedInVehicle ( checkedPlayer ) then else setTimer(respawnVehicle, 10000, 1, source) end end end Link to comment
pa3ck Posted May 13, 2016 Share Posted May 13, 2016 - Store the timers in a table ( -> vehicle element as the index ) - When a player enters a vehicle, check if a timer is attached to the vehicle - If attached, stop the timer Link to comment
opnaiC Posted May 13, 2016 Author Share Posted May 13, 2016 - Store the timers in a table ( -> vehicle element as the index )- When a player enters a vehicle, check if a timer is attached to the vehicle - If attached, stop the timer any other way cause this is complicated Link to comment
Captain Cody Posted May 14, 2016 Share Posted May 14, 2016 Assign the timer to the player by doing thus - Top of script timer = {} Then use this when he exits vehicle timer[vehicle] = setTimer(yaydaya) And use this when someone reenters killTimer(timer[vehicle]) Link to comment
Gravestone Posted May 14, 2016 Share Posted May 14, 2016 Start the timer when the player exits the vehicle using onVehicleExit and kill it when player enters using onVehicleEnter. Link to comment
Captain Cody Posted May 14, 2016 Share Posted May 14, 2016 That is basically what every one has been saying... 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