JeViCo Posted April 4, 2018 Share Posted April 4, 2018 (edited) Hello everyone! I'm making a fuel system. i've recently met a problem with saving fuel data. I can load data from sqlite database. I don't know how to save it on vehicle despawn from admin panel and on player quit. I use setElementData. I tried to use onElementDestroy but when i trigger save function vehicle element defines as player data. (server-side). I can use onClientRender or setTimer instead but it might increase CPU usage. Any suggestions? Edited April 4, 2018 by Juuve Link to comment
Captain Cody Posted April 4, 2018 Share Posted April 4, 2018 Use this onElementStartSync(Check if vehicle) onElementStopSync (Check if vehicle) OnElementDestroy (Check if vehicle) In all of these you use if getElementType(source) == 'vehicle' then -- Stuff -- Source = vehicle end Link to comment
JeViCo Posted April 4, 2018 Author Share Posted April 4, 2018 (edited) 1 hour ago, CodyJ(L) said: Use this onElementStartSync(Check if vehicle) onElementStopSync (Check if vehicle) OnElementDestroy (Check if vehicle) In all of these you use if getElementType(source) == 'vehicle' then -- Stuff -- Source = vehicle end Thank you for reply! onElementStartSync - event when vehicle spawns onElemenyStopSync - event when vehicle destroyed Did i understand correct? Edited April 4, 2018 by Juuve Link to comment
Captain Cody Posted April 4, 2018 Share Posted April 4, 2018 StartSync - when a player becomes a streamer (Vehicle is physical) StopSync - When all players are streamed out (Vehicle is stored in memory) 1 Link to comment
JeViCo Posted April 5, 2018 Author Share Posted April 5, 2018 10 hours ago, CodyJ(L) said: StartSync - when a player becomes a streamer (Vehicle is physical) StopSync - When all players are streamed out (Vehicle is stored in memory) thanks, i'll test it out 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