How do i make a message appear to a player every 2 hours (his time spent on a server)
*Title*
For example, I have a plugin that stores player's played time in seconds. How do I make a message appear to the player every 2 hours? I don't mean every 2 hours of the global server time, I mean his time.. the player's time. If he just joined, and plays for 2 hours, a message appears (client_print, doesn't matter), then he takes a break... next day he joins again and his time is 2 hours, because he spent two hours yesterday and left, then he plays another 2 hours and the message appears again... How can I make this? |
Re: How do i make a message appear to a player every 2 hours (his time spent on a ser
Saving and loading the time is the first step. I'm using a plugin that unlocks special skills when you reach X played minutes, but I haven't figured out a way to inform the player when he reaches them, excluding a task repeatedly doing a check every minute.
|
Re: How do i make a message appear to a player every 2 hours (his time spent on a ser
A good math should be the answer, but I can't think of anything... except writing a library that checks every 2 freaking hours like
PHP Code:
|
Re: How do i make a message appear to a player every 2 hours (his time spent on a ser
Quote:
|
Re: How do i make a message appear to a player every 2 hours (his time spent on a ser
OciXCrom may I see that plugin? (If It's not for public than you don't have to show me)
Edit: Nevermind, I'm talking about player's time |
Re: How do i make a message appear to a player every 2 hours (his time spent on a ser
No, it's private. Yes, it's about the player's time. The saving part just sums up the player's time, I haven't added any checks like you're asking to. I guess that a task on the player every minute would be the most efficient way of doing it.
|
Re: How do i make a message appear to a player every 2 hours (his time spent on a ser
Wait.... can I actually do it with the for loop in the function that checks every 2 hours? I just need to find the final number with math.
I guess I wont host a server more than 3 months. So that would make X the final number.... It should go like this PHP Code:
You can just replace 7200 with 60 if your plugin checks every minute. |
Re: How do i make a message appear to a player every 2 hours (his time spent on a ser
I didn't quite understand what you mean. You need to set a task when the player connects. The best way would be to set the task time to 120 - X minutes, where X would be the time left to 2 hours. You can probably find X from the player's time, but some math is required for this one.
|
| All times are GMT -4. The time now is 22:06. |
Powered by vBulletin®
Copyright ©2000 - 2024, vBulletin Solutions, Inc.