B
B
BotTimofey2020-05-03 16:47:03
PHP
BotTimofey, 2020-05-03 16:47:03

How to make a game roulette bot in VK in php?

Hello, I'm making a bot in VK. One of it is a kind of game roulette. I will describe it in more detail.
Let's say we have an in-game currency - I will simply call it coins.
Let any number from one to one hundred fall in the roulette (at the same time with an honesty check (that is, the generation of a hash from the number and the secret word that will be shown after the total, but I have already done this). So the player must choose an even number will fall out or odd.As soon as he makes a choice (if he was the first player in this round), a timer for 60 seconds should be started (THIS is the first problem), and his name, along with the amount of the bet, should be recorded in the database (mysql).If the player was not the first , then he and his bet are simply written to the database.(writing to the database is not a problem).In this case, there should be a "status" button, by clicking on which, the bot should send the following message:
There are [number of seconds] left until the end of the round (that is, this time until the timer expires - THIS is the second problem)
Rates: (by structure: name-rate) (that is, data from the database is taken here)
Honesty control: (here is the hash generated at the beginning of the round).
I will continue. After the timer expires (THIS is the third problem), the bot must clear the table in the database and send the following message to all betting players: A
number has fallen (here is a number). Secret word: (here is the word that was used to generate the hash).
That's basically the whole algorithm. As you understand, there are three problems, all of them are related to the timer. That is, I'm interested in how to create a timer in php, check how much time is left before the expiration, and how to perform an action after the end of the timer. Please share your thoughts on this - I would be very grateful. Thank you!

Answer the question

In order to leave comments, you need to log in

1 answer(s)
I
Ildar Gizetdinov, 2020-05-03
@KFan

In php there are no timers in the form, for example, in C #, you store the time data somewhere, check them, and react to them if necessary

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question