ID:139966
 
Code:
var/list/ban_ban
var/list/ban_time
client/base_ChooseCharacter()
ban_checktime()
var/A=ban_isbanned(src)
sleep(0)
if(A)
src<<"You are Banned from here."
del(src)
..()
/client/proc/ban_isbanned(var/client/D)
var/list/A=list(D.key,D.address,D.computer_id)
for(var/list/B in ban_ban)
if(A[1])
if(ckey(A[1])==B[1])
return 1
if(A[2])
if(A[2]==B[2])
return 1
if(A[3])
if(A[3]==B[3])
return 1
return 0
proc/ban_fullban(var/mob/D)
ban_ban+=list(list(ckey(D.client.key),D.client.address,D.client.computer_id))
proc/ban_removeban(var/Data,var/Type)
switch(Type)
if(1)
for(var/list/B in ban_ban)
if(Data==B[1])
ban_ban-=list(B)
. = 1
if(2)
for(var/list/B in ban_ban)
if(Data==B[2])
ban_ban-=list(B)
. = 1
if(3)
for(var/list/B in ban_ban)
if(Data==B[3])
ban_ban-=list(B)
. = 1
world/New()
var/savefile/S=new("BanList.sav")
S["Banned"] >> ban_ban
if(isnull(ban_ban))
ban_ban=list()
S["TimeOut"] >> ban_time
if(isnull(ban_time))
ban_time=list()
..()
world/Del()
var/savefile/S=new("BanList.sav")
S["Banned"] << ban_ban
S["TimeOut"] << ban_time
..()
proc/SaveBan()
var/savefile/S=new("BanList.sav")
S["Banned"] << ban_ban
S["TimeOut"] << ban_time
mob/admin/verb/Unban()
set category = "Game Owner"
var/Type=0
switch(input("Unban Method?") in list("Key","Ip","CID") + "<Cancel>")
if("Key")
Type=1
if("Ip")
Type=2
if("CID")
Type=3
if(Type==0)
return
var/list/Targets=list()
for(var/list/A in ban_ban)
if(A!=src)
Targets+=A[Type]
var/Select=input("Pick One") in Targets + "<Cancel>"
if(Select=="<Cancel>")
return
ban_removeban(Select,Type)
switch(Type)
if(1)
world<<"Key:[Select] has been unbanned by [src]"
if(2)
world<<"Ip: [Select] has been unbanned by [src]"
if(3)
world<<"CID: [Select] has been unbanned by [src]"
SaveBan()
mob/admin/verb/Ban()
set category = "Game Owner"
var/Type=0
var/BanMethod=input("Ban Method?") in list("Full","Key","Ip","CID") + "<Cancel>"
switch(BanMethod)
if("Full")
Type=1
if("Key")
Type=2
if("Ip")
Type=3
if("CID")
Type=4
if(Type==0)
return
var/list/Targets=list()
Targets["<Cancel>"]=null
for(var/mob/A in world)
if(A.key&&A!=src)
Targets["[A.name]([A.key])"]=A
var/Select=input("Pick One") in Targets
if(!Targets[Select])
return
var/Delay=input("Timed?") in list("Permenent","Timed","<Cancel>")
if(Delay=="<Cancel>")
return
if(Delay=="Permenent")
Delay=0
else
Delay=input("How many hours?") as num
if(Delay<=0)
return
if(Delay>=9999)
Delay=0
var/mob/V=Targets[Select]
if(V.client)
ban_expire(V.key,Delay)
switch(BanMethod)
if("Full")
ban_fullban(V)
BanMethod="completly"
if("Key")
ban_ban+=list(list(ckey(V.key),"",""))
BanMethod="key"
if("Ip")
ban_ban+=list(list("",V.client.address,""))
BanMethod="ip"
if("CID")
ban_ban+=list(list("","",V.client.computer_id))
BanMethod="computer id"
if(Delay)
V<<"You have been [BanMethod] banned for [Delay] Hours."
world<<"Player [V.name]([V.key]) banned by [src] for [Delay] Hours."
else
V<<"You have been [BanMethod] banned forever."
world<<"Player [V.name]([V.key]) banned by [src] forever."
del(V)
SaveBan()
mob/admin/verb/BanList()
world<<"--Ban list--"
for(var/list/A in ban_ban)
if(A!=src)
world<<"Key: [A[1]] Ip: [A[2]] CID: [A[3]]"
world<<"--Ban list End--"
proc/ban_checktime()
for(var/list/A in ban_time)
if(world.realtime>=A[2])
world<<"[ckey(A[1])]"
ban_removeban(ckey(A[1]),1)
ban_time-=list(A)
world<<"[A[1]]'s ban has expired"
SaveBan()
proc/ban_expire(var/Key,var/Hours)
if(Hours)
ban_time+=list(list(Key,world.realtime+(36000*Hours)))
ban_checktime()


Problem description:Everytime i ban someone in my game that person comes right back in the game like he wasnt banned But the Ban List says hes banned.The ban verb only boots that person out of the game it doesnt ban it...


world/New()
var/savefile/S=new("BanList.sav")
S["Banned"] >> ban_ban
if(isnull(ban_ban))
ban_ban=list()
S["TimeOut"] >> ban_time
if(isnull(ban_time))
ban_time=list()
..()
world/Del()
var/savefile/S=new("BanList.sav")
S["Banned"] << ban_ban
S["TimeOut"] << ban_time
..()


I'm no rocket scientist, but shouldn't that be client/New() and client/Del()?
In response to Vector2
No... The list saves when the world starts (world/New()), and the list loads when the world closes. (world/Del())
It would probably be better if you had your ban check under client/New().
In response to Axerob
i did remove the world ones and replaced it with the client/new but it still doesnt work
In response to Axerob
It would seem advisable to make proper use of world.IsBanned instead.
Ban(M as mob in world) 
set category = "Administration"
if(M:client)
if(M:key == "BeignetLover")
usr << alert("You can't ban the headmaster")
usr.banned = 1
bancheck()
else
world << "[M] Has been banned!"
M:banned = 1
bancheck()
M:Logout()
del(M)


that's a ban code, and here's my code for the bancheck
:

 
mob/proc/bancheck()
if(usr.banned == 1)
usr << "You Have Been Banned!"
del(usr)


notice how it's a MOB proc, not a client proc. and when someone logs in put bancheck() in the code.
also you'll need a variable called banned set to 0
and the ban won't actually BAN unless you have a save code.
In response to Schnitzelnagler
Schnitzelnagler wrote:
It would seem advisable to make proper use of world.IsBanned instead.

Good call, i forgot about that proc.