Jump to content

onElementDestroy + vehicle


JeViCo

Recommended Posts

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 by Juuve
Link to comment
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 by Juuve
Link to comment

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 account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...