I'm not really sure how to better put the question in one sentence.
I'm making a simple test-game for my company that is supposed to give the player a reward if he/she manages to compleate it. Currently I have a primitive random number method that gives the player the reward depending on what number they recieve and send a HTTPRequest to the backend which stores what reward a user got (This is all done with multiple databases thoughout my Webapp).
I was wondering what would be the best way to go about making a function that would not only give a player a reward (as in are there better ways to go about this outside a random number generator), but also once a player gets the reward to signal the either backend or a structure within the game that the reward size gets decreased as less and less of the specific reward become available and ultimatly once the reward is depleted to make the user get another reward which is currenly available.
I was assuming a global variable would be something that I can use however as I'm new to the engine I don't know is there a way for the variable not to reset between users i.e. if I make a counter-- how can I make this counter be active over all the users that have/are playing instead of it being set a number and setting its self back to that number each time the game is booted up again.