Valhalla Legends Archive

Programming => General Programming => Visual Basic Programming => Topic started by: Networks on November 28, 2004, 03:17 PM

Title: Minute Ban (Methods?)
Post by: Networks on November 28, 2004, 03:17 PM
One method I am trying to do this with, which seems kind of easy is to use SetTimer/ KillTimer API functions but  I am not really sure how to do this.

I want set the timer the user sets and use 'Addressof' for the timer to call the sub/function to unban the user but how can I set it to unban a specified user in the settimer procedure? Also I have to have a different nIDEvent for every timer how do I do this? Do I set it at like 1000 so that none of my other timers are affected?

I very confused on how to do this. Anyone's methods are welcome.

For those of who don't know minute ban is:
Basically bans a user for a special amount of time and later unban the user automatically after the time is up.
Title: Re: Minute Ban (Methods?)
Post by: The-FooL on November 28, 2004, 04:28 PM
Its been a while since I've done this, but when you create the timer, you get a timerID.  You'll have to keep track of which timerID belongs to which user.  Then, when the timer fires off the function, you can unban the specific user and remove that timer.
Title: Re: Minute Ban (Methods?)
Post by: Networks on November 28, 2004, 06:09 PM
Don't you specify an ID during the SetTimer procedure?
Title: Re: Minute Ban (Methods?)
Post by: Eric on November 28, 2004, 07:24 PM
Creating a timer for every timed ban that occurs? ew @ wasting overhead.

When banning a user, store the username that was banned along with the system's tick and have a single timer set to x number of seconds which would loop through the list comparing the system's tick when the ban occured to the current tick.  Unless you're planning on having second-accurate timing, it'd be a good idea to set the timer to about a 60 second interval since the automatic unbanning of users shouldn't be of top priority.
Title: Re: Minute Ban (Methods?)
Post by: LivedKrad on November 28, 2004, 08:37 PM
Actually, that's quite handy. I guess you could order the list from least difference to greatest difference as compared to the timer so it can unban by precedence. Clever!
Title: Re: Minute Ban (Methods?)
Post by: Networks on November 28, 2004, 09:49 PM
I was thinking about an array and a timer but was just thinking of diff. ways. I'll just stick with that..thanks. ( I really needed someones input :) )