Multi-Currency Library

** 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.

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.


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.


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.

	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.

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


The script will be released on sunday, the 6th.


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 );

the output of that is

Money Given
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.