Save user team on disconnect - the best way?
Hey, guys! I've been requested to add a simple feature in a plugin, but now I'm wondering which is the best way to do it. It's about saving player team on disconnect and putting the player back in the same team if he reconnects within 60 seconds. In other words - player disconnects and if he connects within 60 seconds, he is put back in the same team as he was before disconnecting. Waiting for suggestions!
|
Re: Save user team on disconnect - the best way?
look at this plugin
|
Re: Save user team on disconnect - the best way?
I would use a Trie based on SteamID. Really simple.
|
Re: Save user team on disconnect - the best way?
Quote:
P.S.: Any tricks, shortways, advices for easier use are welcome here. Examples also. Thanks! |
Re: Save user team on disconnect - the best way?
|
Re: Save user team on disconnect - the best way?
It's simple for everyone, it's a simple hashtable, not rocket science.
PHP Code:
|
Re: Save user team on disconnect - the best way?
Yes, yes, I was about to reach that in this or other way. Only one thing left - is the best way to detect 60 seconds passed with task? If there are any other suggestions (the code will be super proper) I will be glad to see them. Thanks to all!
|
Re: Save user team on disconnect - the best way?
I'm sure you could find this if you tried searching... Try to think a bit, you can get the current time with multiple ways, such as get_systime() (not really optimal, returns unix timestamp) or get_gametime() (which returns the time passed from map start). So obviously, the best way is to store that time somewhere and compare it again later.
PHP Code:
PHP Code:
|
Re: Save user team on disconnect - the best way?
No, it was about to delete that Trie with user's team if 60 seconds have passed after his disconnect. Which is the best way (I doubt it's task?)?
|
Re: Save user team on disconnect - the best way?
The best way to do that is indeed to use a task.
|
| All times are GMT -4. The time now is 21:07. |
Powered by vBulletin®
Copyright ©2000 - 2024, vBulletin Solutions, Inc.