ID:268063
 
Hello, I am in the middle of making an Admin Demo. I'm having problems on the Ban Code. I can't figure out how to Save the ban list so that person is banned for good. If you help, you will get credit! Thanks!

~~SSJ4_Gohan_Majin
You could make a world var to deal with that.

var/list{ban=list();banlist=list()}

mob
Login()
if(ban.Find(src.client.address))
src << "You are banned."
del src

mob
verb
UnBan()
set category="Admin"
var/check_letter=1
banlist+="Cancel"//Adds Cancel to the ban list.
var/T=input("Which address would you like to unban?")in banlist
if(T=="Cancel"){return}
usr<<"You Unbanned [T]."
var/banip
start:
if(copytext(T,check_letter,check_letter+1)=="-")goto unban
else{banip+=copytext(T,check_letter,check_letter+1);check_letter+=1;goto start}
unban:
ban.Remove(banip)
Ban(mob/M in world)
set category="Admin"
set desc="Who do you wish to IP / Key ban?"
var/list/peoples
if(M.client)peoples+=M
ban+=M.client.address
M<<"You have been ban."
world<<"[usr] Ip / Key ban [M]!"
banlist+="[M.client.address]-[M.key]"
del M


That should do it. I think.

~Ease~
In response to Ease
That doesn't save the ban code. You can log right back in. And thats directly from RaeKwon's R_Admin.

~~SSJ4_Gohan_Majin
In response to SSJ4_Gohan_Majin
Are you sure that doesn't save the ban code? It won't save the ban list on different servers/hosts, but it should work if the host remains the same.

~Ease~
In response to Ease
I'm positive. You can log right back in. Its just like a Boot Code. I banned myself, and was able to Log back in.

~~SSJ4_Gohan_Majin
In response to SSJ4_Gohan_Majin
proc/WorldSave()
var/savefile/S=new("Settings.sav")
S["Whatever1"] << Variable

proc/WorldLoad()
if(!fexists("Settings.sav")) return
var/savefile/S=new("Settings.sav")
S["Whatever1"] >> Variable

world/Del()
WorldSave()
..()

world/New()
WorldLoad()
..()

Somthing like that will probably (not too sure, however) work.
SSJ4_Gohan_Majin wrote:
Hello, I am in the middle of making an Admin Demo. I'm having problems on the Ban Code. I can't figure out how to Save the ban list so that person is banned for good. If you help, you will get credit! Thanks!

If you don't know what you're doing, demo writing is not for you.

The point of a demo is to show how to do something to someone who doesn't know. Hence, the person doing the showing should know their way around the problem.

As it is, admin controls are better suited to a library than a demo. And since several libraries and demos both exist for this, why are you trying to reinvent the wheel? If you must, then it would pay to be an expert in circles.

Lummox JR