GithubHelp home page GithubHelp logo

esx_billing's People

Contributors

arctos2win avatar benzo00 avatar dannezzzan avatar dyros3 avatar flambaa avatar gellipapa avatar lenny822 avatar moskalyka avatar mycroft-studios avatar nemyoriginal avatar nikartikthebear avatar pelaoloko avatar rav3n95 avatar stelioslua avatar thefantomas avatar thegamer5095 avatar z3rio avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar

esx_billing's Issues

Enhancement: Server-sided bills

Hey there! ๐Ÿ‘‹

I'm trying to bill a player through esx_billing as a server, but the current implementation of the script seems to deny this:

https://github.com/esx-framework/esx_billing/blob/main/server/main.lua

RegisterNetEvent('esx_billing:sendBill', function(playerId, sharedAccountName, label, amount)
	local xPlayer = ESX.GetPlayerFromId(source)
	local xTarget = ESX.GetPlayerFromId(playerId)
	amount = ESX.Math.Round(amount)

	if amount > 0 and xTarget then
		if string.match(sharedAccountName, "society_") then
			local jobName = string.gsub(sharedAccountName, 'society_', '')
			if xPlayer.job.name ~= jobName then
				print(("[^2ERROR^7] Player ^5%s^7 Attempted to Send bill from a society (^5%s^7), but does not have the correct Job - Possibly Cheats"):format(xPlayer.source, sharedAccountName))
				return
			end
			TriggerEvent('esx_addonaccount:getSharedAccount', sharedAccountName, function(account)
				if account then
					MySQL.insert('INSERT INTO billing (identifier, sender, target_type, target, label, amount) VALUES (?, ?, ?, ?, ?, ?)', {xTarget.identifier, xPlayer.identifier, 'society', sharedAccountName, label, amount},
					function(rowsChanged)
						xTarget.showNotification(TranslateCap('received_invoice'))
					end)
				else
					print(("[^2ERROR^7] Player ^5%s^7 Attempted to Send bill from invalid society - ^5%s^7"):format(xPlayer.source, sharedAccountName))
				end
			end)
		else
			MySQL.insert('INSERT INTO billing (identifier, sender, target_type, target, label, amount) VALUES (?, ?, ?, ?, ?, ?)', {xTarget.identifier, xPlayer.identifier, 'player', xPlayer.identifier, label, amount},
			function(rowsChanged)
				xTarget.showNotification(TranslateCap('received_invoice'))
			end)
		end
	end
end)

As we can see here, esx_billing reads the player source of the issuer to bill the player, which is obviously not possible on server-side.

Would be nice if there would be a possibility for that ๐Ÿ‘‹

Enhancement: Automatic Payments

Would be nice if you haven't paid an invoice in let's says 3 days it would be automatically paid. Players can just receive invoices but never pay them

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.