I know how to make a boot command but i want to set time to it also so that those pesky players do time while they have been booted. Its like i want to boot them and set a time for them to stay booted.
Any help?
ID:166835
Jun 8 2006, 11:11 pm
|
|
In response to TheLunarWolf
|
|
It is best not to have functions call themselves to create a looping effect unless you do so in a spawned code block, as that will crash if your boot_time is too large a number.
Don't forget to make your input a number, as it defaults to text if you don't specify. The way you have booted set up as a global variable, this only allows for a single person to be booted at a time, and it won't work anyway unless you don't delete mobs on logout. Almost every game deletes people on logout. After that, when they rejoin, they have a new mob which isn't the same one as they had before, so this new mob (the src in this instance for Login) will never equal booted. In fact, booted will be null once the player is gone from being booted. Lastly, you want if(src.boot_time > 0), not <0. If you want to know how I would do it, I would prefer to keep a list of keys, as is normal for a ban, and add an assossiated timestamp to those which will be allowed back in after a certian period of time. I like to call it a ban since it seems to more more like a "temp ban." And it's easier to work into an existing ban system anyway. var/list/banned[0] You would want to pass the timestamp to it of the time the player will be able to rejoin. For example, if you want to ban "test dude" for 10 minutes, that would be ban("test dude", world.realtime+6000) |
In response to Loduwijk
|
|
Loduwijk wrote:
that would be ban("test dude", world.realtime+6000) Wouldn't it be better to use world.timeofday? It's more accurate with time. |
In response to Android Data
|
|
True, but that doesn't work for bans which stretch into a new day. Either because you're playing close to midnight, or because you want to ban someone for 24 hours or more.
|
In response to Loduwijk
|
|
Oh but what you posted is kinda complicated to understand i am really new to this coding and its hard to catch up on things. *sighs* i wish i knew how to
|
In response to Loduwijk
|
|
But you can always make a workaround. world.realtime is a very large number. I'd use a bit of math to determine the time a person is to be unbanned and use that as an associated value to the banned ckey.
|
In response to CaptFalcon33035
|
|
CaptFalcon33035 wrote:
But you can always make a workaround. world.realtime is a very large number. But not too large for this instance. The inprecision of world.realtime is insignificant for something like this. I'd use a bit of math to determine the time a person is to be unbanned and use that as an associated value to the banned ckey. Why go to all the trouble? Is having it precise down to the tenth of a second really that necessary? I don't see how it could be. Still, I said 24+. What if you wanted someone gone for more than 24 hours? For 25 hours, 2 days, or a week even? You can't do that with timeofday. At least not without silly workarounds that gain you no advantage. Even if you only wanted it to be 5 minutes though, realtime is still accurate enough. Nobody will care, or even notice for that matter, that it is occasionally off by a second. |
In response to PuNkS
|
|
PuNkS wrote:
Oh but what you posted is kinda complicated to understand i am really new to this coding and its hard to catch up on things. Here are some comments. var/list/banned[0] |
In response to TheLunarWolf
|
|
That would effect all the people that had been booted, thus, if someone was booted and in fifteen minutes another person was booted, the first bootee would suffer the time till unboot back up to 30.
|
In response to Loduwijk
|
|
WOW nice explanation. But even though im gonna use this i wanted a boot one also can i use the same procedure and get the boot one done?
|
In response to PuNkS
|
|
You just call the ban function however you want.
mob/admin/verb |
In response to Loduwijk
|
|
Oh ok then i think i understand what you mean.
|
In response to PuNkS
|
|
I understand all of that but im getting errors. Where do i put like the var and procs
|
In response to PuNkS
|
|
Exactly where I showed them.
|
In response to Loduwijk
|
|
1.0 System\1.2 Administration\H_Admin Loading and Saving.dm:67:error:banned:undefined var Those are the errors im getting |
In response to PuNkS
|
|
Banned was the first thing in there.
var/list/banned[0]
Check back up at my first post in this thread again. |
In response to Loduwijk
|
|
ok i got that fixed b4 i read this ne way.
Should there be some part in the code where it says like if the person boot logs in then scr blah blah then else return .=..? |
In response to PuNkS
|
|
That is already there in client/New.
client/New is called when the client first connects and is the first thing that happens. Its default nature is to create a mob for the client with the appropriate key, gender and name, then return that mob. It is supposed to return null to disallow a connection, but that doesn't work. However, if you don't do its default action and you don't give it a mob, then it will not let the player connect. In the parts where it detects that the player should not be allowed in, it returns, aborting the function. It aborts before the client gets a mob, so it doesn't let the client in. Then, as you can see, the last line of client/New there is .=..() which does the default action and returns it. |
In response to Loduwijk
|
|
Boot_Player(mob/PC/M in world) Thats wat i came up with but i got one error.M.booted=1 is undefined how can i fix this |
Of course you need include your boot verb in there.