Forum

> > CS2D > Scripts > Writing bans to list manually.
Forums overviewCS2D overview Scripts overviewLog in to reply

English Writing bans to list manually.

2 replies
To the start Previous 1 Next To the start

old Writing bans to list manually.

Mami Tomoe
User Off Offline

Quote
Is it possible to write bans into the bans.lst file manually (through Lua) without the usage of any of the CS2D commands (I.E.: cs2d cmd banip)?

How will that affect the server?

Is the file change detection reliable enough?

Are there any risks of dataloss?

Does the order and formatting matter to CS2D?

I want to manually save my temporary bans because CS2D does not want to do that.

old Re: Writing bans to list manually.

DC
Admin Off Offline

Quote
Yes, that should work. CS2D checks the modification date of bans.lst every 5 seconds and reloads it if has been changed outside of CS2D. At least that's what I see in the code. Not sure if it's really working

Quote
How will that affect the server?

It should do what you would expect: The bans you added to the file should be loaded (if formatted correctly).

Quote
Is the file change detection reliable enough?

There shouldn't be any problems with that. It's important that the program you use to manipulate the file also changes the modification time of the file properly (which is pretty standard).

Quote
Are there any risks of dataloss?

Yes, there are risks. They aren't huge but they exist.
The check & reload is only done every 5 seconds. If a ban/unban is performed in CS2D shortly after you modified the file, CS2D might overwrite your changes and they will get lost.
Also if CS2D tries to write bans.lst while you are manipulating the file it will fail to save the changes. If CS2D is then quit or crashes you will lose those bans which could not be written. Note however that CS2D keeps bans in memory and will try to write all bans whenever a ban is added or removed.

Quote
Does the order and formatting matter to CS2D?

Order doesn't really matter. Formatting does. bans.lst is basically parsed like commands in the console but only single lines starting with "banip", "banname", "banusgn" and "bansteam" are supported. Empty lines and lines starting with "//" are ignored.
Be careful! CS2D isn't really verbose at that point. So if you add something to the file like "ban whatever 123" it will probably just be ignored without any error message. So make sure to add your bans correctly without typos.
To the start Previous 1 Next To the start
Log in to reply Scripts overviewCS2D overviewForums overview