Scripting Moderators ds1-e Posted November 21, 2018 Scripting Moderators Share Posted November 21, 2018 (edited) Hey, i have a problem. When player leave from vehicle, timer starts and after it blow vehicle. My problem is that if i spawn 2 cars with same ID, one of them will explode, and another one will stay in a place. So my question is how to do one or more timer for the same ID cars, because i don't have any idea. Edited November 21, 2018 by majqq Link to comment
Moderators Patrick Posted November 21, 2018 Moderators Share Posted November 21, 2018 Paste the code. Link to comment
Scripting Moderators ds1-e Posted November 21, 2018 Author Scripting Moderators Share Posted November 21, 2018 34 minutes ago, Patrick2562 said: Paste the code. function onPlayerExitDayzVehicle(veh, seat) if isVehicleBlown(veh) then return end if isTimer(vehTimer) then return end if not isVehicleEmpty(veh) then return end local vehTimer = setTimer(function () local col = getElementData(veh, "parent") if col then setElementData(veh, "vehicle:station", 0) setElementPosition(veh, 2490.99316, -1666.45313, 13.34375) blowVehicle(veh, false) end end, 20000, 1) end if seat == 0 then setVehicleEngineState(veh, false) unbindKey(source, "k", "down", setEngineState) unbindKey(source, "l", "down", consoleVehicleLights) end addEventHandler("onPlayerVehicleExit", getRootElement(), onPlayerExitDayzVehicle) Link to comment
Moderators Patrick Posted November 21, 2018 Moderators Share Posted November 21, 2018 10 minutes ago, majqq said: function onPlayerExitDayzVehicle(veh, seat) if isVehicleBlown(veh) then return end if isTimer(vehTimer) then return end if not isVehicleEmpty(veh) then return end local vehTimer = setTimer(function () local col = getElementData(veh, "parent") if col then setElementData(veh, "vehicle:station", 0) setElementPosition(veh, 2490.99316, -1666.45313, 13.34375) blowVehicle(veh, false) end end, 20000, 1) end if seat == 0 then setVehicleEngineState(veh, false) unbindKey(source, "k", "down", setEngineState) unbindKey(source, "l", "down", consoleVehicleLights) end addEventHandler("onPlayerVehicleExit", getRootElement(), onPlayerExitDayzVehicle) You do not specify the vehicle ID anywhere. (Write down what you want exactly. If have 2 Infernus spawned and all passengers get out from one infernus, then blow up both?) Link to comment
Scripting Moderators ds1-e Posted November 21, 2018 Author Scripting Moderators Share Posted November 21, 2018 Well i wanna fix the timer. For now if u spawn another or same car while timer is running, another vehicle don't blow up. Only the last which was used. Link to comment
Moderators Patrick Posted November 22, 2018 Moderators Share Posted November 22, 2018 (edited) 11 hours ago, majqq said: Well i wanna fix the timer. For now if u spawn another or same car while timer is running, another vehicle don't blow up. Only the last which was used. Ye, because this is in that script. How you spawn the vehicle? Edited November 22, 2018 by Patrick2562 Link to comment
Scripting Moderators ds1-e Posted November 22, 2018 Author Scripting Moderators Share Posted November 22, 2018 with function createVehicle(model, x,y,z, rz) - standard from DayZ Link to comment
savour Posted November 27, 2018 Share Posted November 27, 2018 the code says that if you leave the vehicle it will blow up, what you want is when you leave the sultan for example, all the sultan's in the game will be blown up? because i can see that you are talking about the vehicle's ID's are the same idk if you mean the model or what Link to comment
Scripting Moderators ds1-e Posted December 5, 2018 Author Scripting Moderators Share Posted December 5, 2018 On 27/11/2018 at 12:44, savour said: the code says that if you leave the vehicle it will blow up, what you want is when you leave the sultan for example, all the sultan's in the game will be blown up? because i can see that you are talking about the vehicle's ID's are the same idk if you mean the model or what I need something like unique timer for each car, because on server players spawn a lot of cars, and f.e if player leave a car with id 411 it set up a timer which should destroy vehicle if noone was inside, after X seconds. However if player spawn 2 same vehicles there's a problem with the timer, as i said above one vehicle will disappear and other not. 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