Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add functionality to give credits after a period of time #7

Open
Nachtfrische opened this issue Nov 9, 2017 · 5 comments
Open

Add functionality to give credits after a period of time #7

Nachtfrische opened this issue Nov 9, 2017 · 5 comments

Comments

@Nachtfrische
Copy link
Contributor

You should be able to set when the player can recieve the credits in the config file.
For example, you can set a value of 10 minutes in the config file and the player can only get credits, if he played for at least 10 minutes.

One way to do it would be to add a new column "connectedAt" to the database and save a timestamp of the connection there. When the user then types !daily, it gets the difference in minutes of the "connectedAt" timestamp and the current time and then compares that to the value set in the config.

@yash1441
Copy link
Owner

Added in v2.2

@Nachtfrische
Copy link
Contributor Author

Are you sure that that is the best way to do it?
What happens, when the map changes? Let's say, I put the value to 30 minutes, a guy connects, plays for 20minutes and then the map changes. Isn't the timer getting reset?

@yash1441
Copy link
Owner

yash1441 commented Nov 10, 2017

Is the player disconnect event called on map end? I don't think so but I'll recheck.

Edit: Yeah it does. I'll add the ConnectTime in database in some time. Thanks!

@yash1441 yash1441 reopened this Nov 10, 2017
@Nachtfrische
Copy link
Contributor Author

After adding the feature to the SQL database and testing it, I realized that there is actually no possible way to implement map overarching connection tracking. So in theory, I just wasted my time. I'm not sure what the point is having the "connectedAt" column in the database but since I've already done it, I've commited it anyway.

You can view my commit here: Nachtfrische@60f86c9

Tell me if you want to merge it. The downside is, people would need to modify their table by using one line of SQL if they want to update since there was a column added.

@yash1441
Copy link
Owner

It could be done in a little complex way by adding time from playerconnected to mapend and storing it somewhere and then adding it to next map but I don't know if it's feasible.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants