[RELEASE] BadgerStockMarket (uses the real Stock Market)

BadgerStockMarket

A FiveM Script (that actually utilizes the real stock market, pretty nifty)

What is it?

BadgerStockMarket is a stock market that is based on the real stock market! The prices and graphs actually come from the real stock market! I wanted to make a nifty script to interact with the stock market and actually invest it, but without investing real money. You can do that with this script! You use ESX money in-game to invest into the stock market. The stock market updates/refreshes every time you open the phone, so this updates in real live time. Make sure you sell your stocks when you are making money, not when you are losing money!

Commands

/stocks - Opens up the phone menu for the stocks

Screenshots

Configuration

Config = {
	maxStocksOwned = {
		['BadgerStockMarket.Stocks.Normal'] = 20,
		['BadgerStockMarket.Stocks.Bronze'] = 100,
		['BadgerStockMarket.Stocks.Silver'] = 500,
		['BadgerStockMarket.Stocks.Gold'] = 99999999999999999999999999999999999999999999
	},
	stocks = {
		['Apple Stock'] = {
			link = 'https://money.cnn.com/quote/quote.html?symb=AAPL',
			tags = {'Technology', 'Software'}
		},
		['Citigroup Stock'] = {
			link = 'https://money.cnn.com/quote/quote.html?symb=C',
			tags = {'Bank'}
		},
		['General Electric Stock'] = {
			link = 'https://money.cnn.com/quote/quote.html?symb=GE',
			tags = {'Automobiles', 'Vehicles', 'Cars'}
		}
	}
}

You must use https://money.cnn.com website for this to work properly (for each Stock). Add as many stocks as you would like :slight_smile:

'BadgerStockMarket.Stocks.Normal' is the permission node (ACE permission node) that a player has to have to have that many stocks. You can set up multiple different permission nodes and allow a certain number of stocks for different groups of people. Maybe donators get more stocks?

Liability Reasons

For liability reasons, I wanted to include this at the bottom. BadgerStockMarket is in no way affiliated with the Stock Market and/or its proprieters. BadgerStockMarket was created as an educational tool to be used within the GTA V modification known as FiveM. BadgerStockMarket is also not affiliated with the Robinhood application. Although the script used the Robinhood logo. Once again, BadgerStockMarket was created as an educational tool. If anyone has a problem with this, please contact me and we can get the changes adjusted appropriately, thank you.

Download

8 Likes

Looks Amazing thats what im talking about! About to try it this out!

1 Like

Badger always coming thru with the heat

1 Like

Hi ! How can i set the permission 'BadgerStockMarket.Stocks.Normal' (for exemple) ? I think i missed something lol

That’s not a permission, that’s a config

But can’t buy / sell anything, and the mouse still released when closing the phone… :frowning:

true . i cant buy or sell anything there

You need to give yourself permissions to.

maxStocksOwned = {
		['BadgerStockMarket.Stocks.Normal'] = 20,
		['BadgerStockMarket.Stocks.Bronze'] = 100,
		['BadgerStockMarket.Stocks.Silver'] = 500,
		['BadgerStockMarket.Stocks.Gold'] = 99999999999999999999999999999999999999999999
	},

These are permission nodes.
Read more about them here: https://docs.badger.store/fivem-general-help/ace-permissions

Thx.

I’ve tried this :
add_ace group.user “BadgerStockMarket.Stocks.Normal” allow
add_ace group.mod “BadgerStockMarket.Stocks.Silver” allow
add_ace group.admin “BadgerStockMarket.Stocks.Gold” allow
add_ace group.superadmin “BadgerStockMarket.Stocks.Gold” allow

and this
add_ace identifier.steam:XXXXXXXX ‘BadgerStockMarket.Stocks.Gold’ allow

with and without ’ or " but nothing seems to works…

And then the “SetNuiFocus(false, false)” won’t trigger too when closing the phone…

My guess is you may need to change the __resource.lua to an fxmanifest file instead.

Wait you have ESX installed properly as well?

Ok i’ll try with fxmanifest !

(yes ESX properly installed ^^)

I think something broke with this part after “SendNUIMessage”, if i understand, this part of the code will show some kind of notification when you open the phone no ? So, as i can’t see any notifications, it can explain while the further part of the code won’t work properly like closing the phone, etc…

It’s the same for some scripts wich trigger pnotify / mythic_notify, when the line is broken (arg not found for example) the script can’t complete his task and you can stay “freeze” (after an animation for ex.)

RegisterCommand(‘stocks’, function(source, args, rawCommand)
– Toggle on and off stocks phone
TriggerServerEvent(‘BadgerStockMarket:Server:GetStockHTML’);
SetNuiFocus(true, true);
TriggerServerEvent(‘BadgerStockMarket:Server:GetMaxStocks’);
SendNUIMessage({
maxStocksAllowed = maxStocksOwned;
});
SendNUIMessage({
show = true;
});
TriggerServerEvent(“BadgerStocks:SetupData”);
while stockData == nil do
Wait(500);
SendNUIMessage({
stockData = stockData;
});
end
if stockData ~= nil then
SendNUIMessage({
stockData = stockData;
});
end
end)

Amazing release Badger!
Your scripts are always top notch and unique!
Nice touch on using the Robinhood logo within the script as well. I love using Robinhood IRL for the stock market, so will be really cool to see the stock market within FiveM. :heart:

10/10

1 Like

A script doesn’t just break. Code works fine on my server. It’s a problem on your end. Without error codes, I can’t help you at all.

I understand that,

I also checked the console and F8 and there’s no error at all.

It’s like i’m pressing a “blank” button… but anyway such a nice release ! Maybe it will work later for me… mysteries of FiveM…

1 Like

Really Nice script,great work and thanks to make it “free” :slight_smile:

Is there a way to remove the permission so everyone can use it ?

Hey could you make a popup box so i could like chose the amount i want to but instead of buying 1 over and over again. its hard to buy like 200 of a stock lmao.

Um it’s made to use permissions. You could just give everyone the ACE permission by giving it to the builtin everyone group

Ye I was going to do this, but got lazy. It probably wouldn’t be too hard to add at a later date. Working on some other projects now to make some money since nothing in this community makes me money lol.

lol yea i get it its just a pain to buy and sell all of them no worries lol.