DzMG-LV Posted March 14, 2016 Share Posted March 14, 2016 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
Captain Cody Posted March 14, 2016 Share Posted March 14, 2016 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
DzMG-LV Posted March 15, 2016 Author Share Posted March 15, 2016 It is possible to make it like function example: getBatter() and u can add it to any resources so u can get easy battery level. Link to comment
Addlibs Posted March 15, 2016 Share Posted March 15, 2016 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
DzMG-LV Posted March 15, 2016 Author Share Posted March 15, 2016 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
Captain Cody Posted March 15, 2016 Share Posted March 15, 2016 MrTasty is correct, battery should not drain unless your alternator is bad or you leave lights running while engine is off, but that still would barley drain it. Lights use almost no power. "I'm mechanic I know this stuff" And I gave you steps to do it, try those. 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