/ban [DAYS]

Sorry if this is easy, but I'm a little rusty on this.

Basically, I need instructions on how to make a ban command with a parameter of [days] (so e.g. /ban [id] [days] [reason]) which would keep them banned for the input days, and then automatically unbanning them after the days had passed.

Seems easy but not sure of the simplest way of doing it.

I expect no one to write the code for me, but step-by-step instructions would be nice.


First you would need to make the cmd, I would suggest using zcmd, or y_cmd. Through it sscanf the params for 2 integer and 1 string. Then just write the code you need. Depending on your saving system the way you save the ban will vary, but save the player variable unban day and then you can have a loop or something in the script to check for expiring bans, if the current day and the ban day on the player file matches then unban him. Another day would work on the same way but you saved the day and everytime you check for ban expirations reduce a day to the ban. There's really alot of ways, just make sure you save the time to be unbaned or the time left to be unbanned. Through a timer for a day just check for expiration dates.

Forum Jump:

Users browsing this thread: