[EssentialMode] es_stockmarket | Stock trading for EssentialMode!

Really nice release, I was looking for something like this for a while :+1:

1 Like

I bought 5 shares and it disappeared after refreshing

That’s odd, could you show your database? I just logged in with a clean DB and it worked fine

Automatically disappear after refresh

Try that, apologies had a typo :stuck_out_tongue:

Let me know if that solves your issue

Normal, ok

Did it solve your issue?

yes,thanks

stocks[i].worth = math.ceil(stocks[i].baseWorth * (math.random(config.minRandom, config.maxRandom) / config.divider))

It’s minimum and maximum change it can do in a single run :slight_smile:

If you keep config.divider the same(10) then it means that anything below 10 will that the worth is lowered, and higher than 10 it will be increased.

ok awesome thanks

It is working normaly, but i have this errors in my console:

First line is 62

    MySQL.Async.fetchAll('SELECT * FROM es_stockmarket WHERE owner=@owner', {['@owner'] = user.getIdentifier()}, function(ostocks)
        for j=1,#ostocks do
            for i=1,#_stocks do
                if(_stocks[i] and ostocks[j].stock)then
                    if(_stocks[i].abr == ostocks[j].stock)then
                        _stocks[i].owned = ostocks[j].amount
                    end
                end
            end
        end

        TriggerClientEvent("es_stockmarket:updateStocks", _source, _stocks)
    end)

Owned stocks are changing every second, become to what other players got…

Is your essentialmode installed properly?

Of course, last version. also pricing of the stocks doesn’t change.

Sounds a bit odd, it should change by default every 30 seconds.

How does your database look?

Version 1.0.3

  • Fix for buying and selling (seeing eachothers owned shares)
  • Some code cleanup

Thanks to the people here for reporting these issues and @terbium for helping me test them :slight_smile:

1 Like

Great asset for the FiveM community i swear keep it up

Is there anyway to enable the use of decimals?

Yeah it’s fairly easy. Just remove the floor functions. However you should do some rounding somewhere to make sure the decimals don’t get too long.

1 Like

there is a bug
when a player buy stocks than other see the Stocks too i have the following error can you fix this i have Essentialmode 6.3.0 ERROR : ***SCRIPT ERROR: @es_stockmarket-1.0.0/server.lua:72: attempt to index a nil value (local 'user')***