Jump to content

Vehicle battery.


DzMG-LV

Recommended Posts

So i would like to make vehicle engine battery for my Roleplay server, when u drive its drowns, when its empty u need to buy new one. What would i need to use or maybe someone can make small start for script? When u buy/spawn car its 100%, when its 0% car won't start and headlights too, then u need go to store and buy new acumulator.

Link to comment

On vehicle spawn set the vehicles ElementData "Battery" to 100, or on resource start if the vehicle doesn't have one then set it to "100"

Set timer, and every few secounds check if the car is in motion, if so set its elementdata 'Current' - "Amount you want"

If the timer finds that the element data is 0, then kill engine, and kill lights. Then make it so you cannot turn them back on.

Link to comment

A car battery shouldn't drain (or should only minimally) whilst the engine is running - the alternator supplies the power to the car (battery is used for starting, lighting, ignition only). I'm not specialised in this, but perhaps it should drain only with the lights on (but lights could also be powered by the alternator while running on high enough RPM, I don't know)

Link to comment
A car battery shouldn't drain (or should only minimally) whilst the engine is running - the alternator supplies the power to the car (battery is used for starting, lighting, ignition only). I'm not specialised in this, but perhaps it should drain only with the lights on (but lights could also be powered by the alternator while running on high enough RPM, I don't know)

Yes it could be good when if u have lights on then battery drains, but how to make the battery and when its drain.

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...