ID:157169
May 2 2010, 8:34 am
|
|
I've been fooling around with an admin system that let's you mute some one, asks you how long you want to mute them for in minutes, and then after that time has expired, automatically unmutes them. The obvious problem here is that this can all be bypassed by logging out and logging back in. Well, I first tried creating my own custom spawn/sleep proc called Wait and using that to time them, but it doesn't work. Then I tried using spawn() but it stops counting down after the user logs back in. I'm not sure what to do. Any ideas?
|
May 2 2010, 8:45 am
|
|
oh this is a fun one, ive done these before. set up your timer like normal, but also set a var against them that if they activate the logout() proc it puts their name in a list of permanently muted players until a GM unmutes them, then they'll remember not to logout to unmute =D
|
In response to Dragonblix
|
|
That's what the sleep() and spawn() procs do when you use them as timers. But I don't want to permanently mute someone if they're already muted and just log out cus they want to quit playing. I thought about throwing their keys into a multi-list and having their keys associated with the time remaining in their mute in seconds, and then using my own custom proc to count down the time. Then I'd call on the proc when I wanted to mute them, and whenever they logged back in. But that's a ton of work and I don't want to start on it if there's an easier way.
|
In response to Gypsy
|
|
well you know you could always set up a 2nd timer when he/she logs out, ans if they reenter to soon, as indicating trying to bypass the mute. then the permamute takes effect. but there are always better solutions, thats just my take on it.
|
Have a mute variable containing the time it is suppose to expire at (ex: with worldtime + X). When they log out, check if the time passed yet - if not, minus the worldtime so you are left with just X.
When they log in, check if that variable is NOT 0 ( in other words, it is X). If so, add worldtime + Y (Y is a penalty time, if you so desire) to the X |
A generic solution I wrote a while ago: [link]
|
In response to Dragonblix
|
|
I wanna script!!!!
A way with NO loops!!! CRAZY!!! Just thought of it too ^-^. var/list/Mutes = new/list |
Thanks so much for your input guys! I combined all of your ideas to come up with this:
var It's a little long, I know, but it works perfectly. I decided to use world.timeofday instead of just the world.time variable because I'd like to keep track of the user's punishment over the course of the Earth's time, instead of just my individual world's time. :) Once again, thanks so much for all of your help every one! Feel free to use my code if you'd like. It's the least I can do. :) Oh and by the way, the variable server is just this: var |
In response to Gypsy
|
|
Use realtime, not timeofday. It has limited accuracy (good job there, UNIX) but it won't roll over at midnight.
|