Multi-Currency Library

[release]
** About **
In most servers, most commonly roleplaying servers, they have money. But it is always one currency. This library gives the developer the ability to create new currencies extremely easy, and completely control the economic environment. It comes packaged with a event system, to view everything that goes on with the currency. I’m not a good writer, so just read the feature list below.
[/release]

[release]
Features
The ability to create currencies( even in game, no restart or map change required ) with extreme ease.

A event system to moniter everything that goes on in the server currency wise, you could however, use it for anything you want.

The event system allows the ability to monitor every players money( all currencies that they own ), you can also moniter the global amount of money that you’ve put into the server.

Circulatory system to input a predefined amount of a certain currency, for example you could set it to 5,000. and then there is 5,000 of that currency in the server, globally.

The ability to terminate currencies, meaning if you gave out a ton of a certain currency, and want it removed. you can terminate it, removing it from all players, and from existance.

You can store a currency on any entity, including players. Considering the circumstances, i can’t make it save on entities, unless i include a script that makes entities that have money stored on them save on the map. Which I can do, by request.

[/release]

[release]
Useful Information
This is a ‘library’, if you want to call it that. No menus will be included with the release, that is for developers to make. I am simply providing the functions premade to do so. Later on I might make menus for it.

This is completely open source, if you want the code before release( date below ), i will give it to you in a pastebin link, all rights given to you. Claim it as your own, do whatever, I don’t care. I’m not going to put a fucking copyright on a bunch of text.

MoreToBeAddedHere…
[/release]

[release]
Documentation
This is going to be changing very frequently, this documentation is as of now, it is not the final documentation, please post suggestions regarding to which library you want functions to belong to.
Server:

	currency:AddNew( string Name, string Symbol, String Plural ); -- Adds a new currency.

	currency:getTable( string Currency ); -- Returns a currencies information table.

	currency:addEvent( string Event, string Report ); -- Adds a event.

	currency:getAllEvents(); -- Get all events.

	currency:getEvent( string event ); -- get a specific event.

	currency.cache:saveEvents(); -- Save all events.

	currency.cache:loadEvents(); -- Load all events.

	entity:giveCurrency( string Currency, integer Amount ); -- give an entity/player money.

	entity:takeCurrency( string Currency, integer Amount ); -- take an entity/player's money.

	player:saveCurrency(); -- Save the players currency table.

	player:loadCurrency(); -- Load the players currency table.

*Shared:*
	entity:getCurrency( string Currency ); -- Get the amount of a specific currency the entity/player holds.
*Client:*

[/release]

[release]
Download
The script will be released on sunday, the 6th.
[/release]

neat.

Interesting.
What are events for?

just logs, but categorised, for example…



currency:addEvent( "onMoneyGive", "Money Given");
currency:addEvent( "onMoneyGive", "Nigs");
currency:addEvent( "onMoneyGive", "Another event.");
currency:addEvent( "onMoneyGive", "Anodda Event");
currency:addEvent( "onMoneyGive", "de fuk");

for _,report in pairs( currency:getEvent("onMoneyGive") ) do
     print( report );
end


the output of that is



Money Given
Nigs
Another Events
Anodda Event
de fuk


lets say you want to record every time a player gives money( which is implemented ), you could make a menu to get every event with the name… “onMoneygive” or anything you want it named, then add it to a DPanelList, boom logs.

I’d like to look at the code if that’s possible

certainly, when i get home i’ll pm you it.

Got it, thanks

Hey, I sent you an old version on accident.

The right version is

Next, make transactions to track where people got money :slight_smile: Little auditing is never bad.

So, the symbol could be special characters?

The symbol can be anything, yep

Good work, but if you ever re-code it, you should consider changing it from “currency:AddNew()” to “currency.AddNew()”. “:” should only be used for userdata, you may want to take a look at the wiki for meta tables.