GithubHelp home page GithubHelp logo

wobozkyng / ox_fuel Goto Github PK

View Code? Open in Web Editor NEW

This project forked from overextended/ox_fuel

0.0 0.0 0.0 121 KB

Simplistic fuel resource meant for use with ox_inventory

Home Page: https://overextended.dev/ox_fuel

License: GNU General Public License v3.0

Lua 100.00%

ox_fuel's Introduction

ox_fuel

Basic fuel resource and alternative to LegacyFuel, meant for use with ox_inventory.

Get vehicle fuel level

This is an incredibly complicated task for some people, and they often ask for exports to do it. You use the native function GetVehicleFuelLevel, or you can use a statebag.

Entity(entity).state.fuel

Set vehicle fuel level

Entity(entity).state.fuel = fuelAmount

setPaymentMethod (server)

Replaces the standard payment method using "money" as an item.

exports.ox_fuel:setPaymentMethod(function(playerId, amount)
    local xPlayer = ESX.GetPlayerFromId(playerId)
	local bankAmount = xPlayer.getAccount('bank').money

	if bankAmount >= amount then
		xPlayer.removeAccountMoney('bank', amount)
		return true
	end

	TriggerClientEvent('ox_lib:notify', source, {
		type = 'error',
		description = locale('not_enough_money', amount - bankAmount)
	})
end)

setMoneyCheck (client)

Replaces the standard inventory search for "money".

exports.ox_fuel:setMoneyCheck(function()
	local accounts = ESX.GetPlayerData().accounts

	for i = 1, #accounts do
		if accounts[i].name == 'bank' then
		    return accounts[i].money
		end
	end

	return 0
end)

ox_fuel's People

Contributors

alp1x avatar antond15 avatar badfantomasss avatar bdxndev avatar bitpredator avatar borisnliscool avatar demetriomontalto avatar dolutattoo avatar dunak-debug avatar dyros3 avatar edecadt avatar far18 avatar fbfezz avatar feelfreetofee avatar getpwnedbydolbajoba avatar h0ssein avatar icecubepiso avatar justthemartin avatar katotekii avatar lukewastakenn avatar matinhq avatar michur55 avatar mirrrrrow avatar n-fire avatar skryptific avatar thelindat avatar tomstilson avatar usermacieg avatar zan1456 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.