Stocks addon for Gcphone

This resource will allow you to use the stocks on the phone (Gcphone only)
but you can use only rdsk_borsa if you want make an UI for it.


(This image is for tumbnail only)

Video : Watch 2020-02-03 13-20-46 | Streamable

Screenshot :

image

Features :

  • It automatically calculates the average and the usual price randomly through a minimum and maximum value.

  • Every 2 hours (exchangeable in the cfg) prices change. Or if you restart the resource rdsk_borsa.

  • Work with all Gcphone with app bourse.

  • A callback for take the actual price for your resource, must call it with name of item in your db.

  • dynamic arrows indicating whether the object is positive, negative or stable.

Coming soon :

  • Buy and sell action.

Download v1.1 : GitHub - redskatex/Stocks: Stocks for gcphone

Installation : Follow the instruction in the README.md

Pool :

  • Yes
  • Not
0 voters

P.s: Is the first resource I post, sorry for the very inaccurate English in the case, leave feedback and in case you use the isuess section on github

20 Likes

This looks super awesome, cant wait for the buy and sell function!

thanks a lot, you can already use it to have a dynamic economy in the server

1 Like

congratulations from China serverļ¼cant wait to see itļ¼

thanks a lot

This script is going to be amazing once the buy and sell function come in :slight_smile:

2 Likes

Hi, how itĀ“s the development goin?
IĀ“m hyped with the posibilities of the script

I think is easy to convert, i use a very low quantity of esc function

RegisterServerEvent(ā€˜rdsk_borsa:calculateNewPriceā€™)
AddEventHandler(ā€˜rdsk_borsa:calculateNewPriceā€™, function(item)
MySQL.Async.fetchAll(ā€˜SELECT * FROM borsa WHERE Nome = @nameā€™, {
[ā€˜@nameā€™] = item
}, function(result)
local attuale = result[1].Attuale
local min = result[1].Min
local max = result[1].Max
local med = result[1].Med
local med = ((min + max) / 2)
local newPrice = math.random(min, max)

  MySQL.Async.execute('UPDATE borsa SET Attuale=@RND, Med=@MED WHERE Nome = @name', {
  			['@RND']      = newPrice,
  			['@MED'] = med,
  			['@name']       = item
  }, function(rowsChanged)		
  		print(item .." has new price " .. newPrice .. " price was " .. attuale)
  end)

end)
end)

have fun, updating the actual Item while selling or buying

Serverside trigger:

TriggerEvent(ā€˜rdsk_borsa:calculateNewPriceā€™, itemName)

1 Like

could you be more clear where the code goes

This script is going to be amazing once the buy and sell function is done! i canā€™t wait :smiley: :sunglasses:

I worked on a script to buy and sell stocks. Not in the phone, you go to a place and then you buy or sell.
The problem I saw itĀ“s that what the phone is showing as prices of the stocks doesnt match with the prices shown in my script. My script checks the DB when you open the menu.
Other problem itĀ“s that diferent players in the same time see different prices in the phone. Any Idea? How can I make that the phone check DB when oppening the app ā€œBourseā€?

Have you used my DB template for your script ? the phone refresh the price every time it refresh in db

When is the buy or sell update coming?

I got it to work so far ^^ that I can enter items in the database myself etc. but how can you do it in such a way that people can only sell at these prices, for example?