Hey, Im trying to make something like [URL="https://csgojackpot.com/"]https://csgojackpot.com/[/URL], but my problem is that i dont understand,
how does the value change? Like when i place item i send -> Server that i placed item and server -> Client announces that i placed the item? I dont care about the security right now, i just want to know how can i create client -> server -> client communication thingy.
Thanks!
You send a request to the server every x interval and update numbers on the page depending on the server response. Same basically goes for placing items and receiving updated info or whatever.
This is also known as AJAX.
[url]http://www.w3schools.com/ajax/[/url]
The problem is that i need something like in glua, server client realms, so i could request data as client and server would send and when certain condition is fulfilled server generates random number who will be the winner and send the result to client so client could not fool the system.
That's just a backend. Choose some database, randomly put a number in that database so it's stored permanently, and then have everyone request the number from the db
[QUOTE=proboardslol;49270567]That's just a backend. Choose some database, randomly put a number in that database so it's stored permanently, and then have everyone request the number from the db[/QUOTE]
And how i would then store players and the chances?
[QUOTE=SteppuFIN;49270605]And how i would then store players and the chances?[/QUOTE]
Same way; in a database. Assign everyone an incrementing Id Number (1st user has ID#1, 10th user has ID#10, etc.), and use those ID numbers to choose winners.
How do you determine a user's chance? People buying Raffle tickets?
[QUOTE=proboardslol;49270613]Same way; in a database. Assign everyone an incrementing Id Number (1st user has ID#1, 10th user has ID#10, etc.), and use those ID numbers to choose winners.
How do you determine a user's chance? People buying Raffle tickets?[/QUOTE]
If 3 users placed 100$, 1st 50, 2nd 25 and 3rd 25.
1st player has 50% win chance and 2nd and 3rd 25%. So more you put money more you have chances. I dont understand like how i should put users chances into db. Id-1_25% and parse like that or is there a better way?
[QUOTE=SteppuFIN;49271024]If 3 users placed 100$, 1st 50, 2nd 25 and 3rd 25.
1st player has 50% win chance and 2nd and 3rd 25%. So more you put money more you have chances. I dont understand like how i should put users chances into db. Id-1_25% and parse like that or is there a better way?[/QUOTE]
Databases are collections of tables with columns and rows:
[code]
+--------+--------+
|id |chance |
+--------+--------+
|1 |50 |
+--------+--------+
|2 |25 |
+--------+--------+
|3 |25 |
+--------+--------+
[/code]
[QUOTE=SteppuFIN;49271024]If 3 users placed 100$, 1st 50, 2nd 25 and 3rd 25.
1st player has 50% win chance and 2nd and 3rd 25%. So more you put money more you have chances. I dont understand like how i should put users chances into db. Id-1_25% and parse like that or is there a better way?[/QUOTE]
Let's call each $25 associated with a user a "ticket". If you've got 4 tickets, each worth 25$, then you put 4 tickets in, each with a unique ticket ID#. Each ticket also has an associated user ID #. If user 1 has 2/4 tickets, he will have a 50% chance of winning. When raffle time comes, a random ticket is selected. Assuming your random function is fair, the 1st user will have a 50% chance of winning.
[editline]8th December 2015[/editline]
I'd check to make sure what you're doing is legal though. Giving away free items via a raffle is one thing, but paid raffles cross into the territory of online gambling, which is illegal some places
[QUOTE=Robotboy655;49265249]You send a request to the server every x interval and update numbers on the page depending on the server response. Same basically goes for placing items and receiving updated info or whatever.
This is also known as AJAX.
[url]http://www.w3schools.com/ajax/[/url][/QUOTE]
More importantly if OP want's a "realm" like system like csgo jackpot, [url=https://www.npmjs.com/package/nodejs-websocket]WebSocket's[/url] (or a more popular flavour [url=http://socket.io/]Socket.IO[/url]) would most likely fit their need.
With sockets you can maintain a client list and communicate over TCP in real-time, this is exactly was csgojackpot.com uses.
[QUOTE=Rocket;49272216]I hope you're not doing exactly what CS:GO Jackpot is doing, because what they're doing is illegal in your country.
Under Finnish law, a lottery is defined as "an activity in which participants may win, in full or in part, a prize of monetary value based on chance and in which there is a charge for participation." There is only one company in Finland allowed to conduct money lotteries - Veikkaus Oy, run by the Ministry of Education. If you are going to conduct a non-money lottery (which you [i]might[/i] be able to argue), you may only run within a single state local district, and you still need to get a license.
So if whatever you're doing involves prizes of monetary value (such as CS:GO items), you will be breaking the law. If you're holding a raffle for DarkRP cash or whatever instead, you're fine.[/QUOTE]
Oh, thanks for the info!
Sorry, you need to Log In to post a reply to this thread.