Tesla Model X custom HUD, Charging Rate with super charger, Battary drain, and Handling

FiveM Electric Vehicle / Tesla Resources


Caveats

  • These resources were created for demonstration purposes. Some features are basic, like demogarages, and all scripts are client side.

  • In the future, these may be integrated into frameworks and/or include their own server side/persistence logic.

Requirements

  • None

Overview


Resources

There are three resources in this repository, meant to work together but not strictly dependant on each other.

wtf_teslax

  • Tesla Model X 3D model from https://www.gta5-mods.com/vehicles/tesla-model-x-p90d
    • We did not make this model we only converted it to be used on fivem
  • Custom handling, mimicking real-life expectations
    • Best in class acceleration: 0-60 ~4sec, 0-100 ~7sec
    • Limited top end due to increased drag: ~160mph
    • Better than average handling
    • Low center of gravity, limited roll-over

wtf_tesla_supercharger

  • Tesla Supercharger
    • High-quality 3D model of Tesla Supercharger
    • Custom for placing superchargers in convenient locations

wtf_ev

  • EV HUD

    • EV vehicles display Whr (watt-hours) energy use
    • This figure is based on “RPMs” and Whr effects battery range
  • EV Battery

    • EV vehicles have batteries instead of fuel
    • The battery discharge loosely follows real-life heuristics
      • A HUD is rendered on the minimap showing charge level %
      • Discharging uses a stepping function based on “RPM”
        • High RPMs (e.g. racing) will negatively effect range
        • Low RPMs benefit from less energy use
  • EV Charger

    • Featuring the Tesla Supercharger 3D model
      • Via an included custom map: wtf_tesla_supercharger
    • Charging uses a quadratic Bezier curve
      • 0-60% takes ~30% of total charge time
      • > 61% takes the remaining time to reach full charge
    • Supports custom charging rates via config.lua
  • Garage Demo

    • Mostly for demonstration purposes
    • Adds the concept of charging while your vehicle is stored in a garage
    • Supports custom charging rates via config.lua
      • Example: parking-garages charge faster than parking lots, which are faster than house-garages

Debug

  • Debug commands available when Config.Debug = True
  • /teslax spawns and places you in the Tesla Model X
  • /fuel 40 will set fuel to specified amount (40 as an example)

Screenshots


Download


Download via GitHub

15 Likes

Moved to #development:releases. Release conforms the rules.

Thank you, I was unable to create this in the release topic as I am a long time lurker but just created an account.

Very cool! But charging is not working when I charge I have like 60% and I charge to 100% but when I come inside vehicle again it is 60% :smiley:

1 Like

Good Job! But charging is not working when I charge I have like 18% and I charge to 100% but when I come inside vehicle again it is 18%

For those having fuel problems. You might want to check what other resources might be interfering. The resource is meant for demonstration purposes and doesn’t integrate or work along side other resources yet. The code just calls the SetVehicleFuelLevel API and works standalone.

Doublerye’s response is correct.

This looks like a great funny idea! I will definitly test it out.

So since this mod only includes your model x would one be able to add some lines of code to a custom tesla roadster for example to be able to support the charging feature

Please add ESX_LegacyFuel support, if you’re using legacyfuel and you charge the car, when you get back into the vehicle it immediately changes the fuel amount to the old number

You can add ‘teslax’ to the blacklist in the legacy fuel config, this resource includes electric vehicle fuel heuristics.

1 Like

In config just put the model name of the roadster and you’re good to go.

Is there a way to get rid of the command so not everyone can spawn it?

This looks cool

Config.Debug = false will turn off /teslax spawn command

Is there any reason this would be able to he used in a server with active players?

How can I add any other electric vehicles?

could you send me a example? i’ve been trying to add some cars to the script but i’ve had no luck.

@alexx03 & @kaneee7 you can add additional electric vehicles by adding them to config.VehicleNames at the top of the config.lua.

In this example, I added the s15rb car to be an electric vehicle just like the teslax. Make sure after you add the vehicle to restart wtf_ev.
– Model names of electric vehicles
Config.VehicleNames = {“teslax”, “s15rb”}

Help me pls
start wtf_ev
Could not find dependency wtf_re
Couldn’t start resource wtf_ev.