Battery System
Quasar Smartphone has a huge battery system, managed by intelligent json that is stored in your asset, where you will find the information of each player along with their battery. Here we will teach you everything about the battery system and its functionalities.
Battery usage mode
Remember to have Config.EnableBattery enabled in your config.lua, otherwise this will not work.
You will be able to manipulate the settings so that it takes more or less battery depending on an application, as well as manipulate the overall battery usage that will be used. This is found within config.lua, using Config.Battery.
You can add or remove applications, adding or subtracting battery usage depending on the app used, manage it as you like.
Battery recharging via Powerbank
You can use the powerbank item, which will begin to recharge your phone's battery until it reaches 100%, at which point the item will stop having its effect. Don't forget to add said item to your database or item base to be able to use it.
Recharge via charging spot
We only include one spot in the configuration, but you can add as many as you want.
You can charge the phone using the charger spots that you will find on your map, these are found in the same config.lua in the Config.ChargerSpots configuration. You can create infinite charging spots for players, where their phone will be taken away and the level of charge their phone contains will be shown until it reaches 100%.
Administrator command
Administrators will be able to use the battery charge for other players by enabling the Config.AdminCommand within config.lua, there we can manage the permissions or the exclusive command for such a thing. The command will be used as follows /adminbattery id ammount.
Exports to check the battery
This export will simply return the battery level on the client-side, you can use it to create interesting events.
We can use the getBattery export to check the battery on the client side, this is a simple export and we can execute it as follows.
Last updated
Was this helpful?