ID:149757
 
ProcHere(mob/pc/M in world)

But this brings up every mob in the game, with players at the bottom of the list. As my game grows in size this will soon become a problem. Is there a way to just bring up a list of players in the game, and by their actual KEYs? As this is for a GM command I'm writing.

LJR
Can someone explain the structure and show me the code need for making a Ban List and the save file that saves it? I don't need any references to other people's LIBs or Admin work. I'm trying to understand this code myself so I can design my own.

LJR
In response to LordJR
I haven't actually used a ban code before but I whipped one up to test out some ideas.

I'd approach your first problem by using lists and customizing them yourself like this:

var/list/L = new() //make a list
for(var/mob/M in world) //go through all mobs in world
if(M.key) //only include mobs with keys
L.Add("[M.ckey]") //add their ckey to the list
L.Add("Cancel") //add cancel option so you don't have to ban
var/input_choice = input("Ban who?","Ban") in L
if(input_choice == "Cancel")
return
else
ban_list.Add("[input_choice]") //add their ckey to the ban list


Now theirs the issue of the ban_list. This should be a global list so there is only one copy. Then, when the world is created load the ban_list and when the world is deleted save the ban_list.

The last important step is in the Login proc (I suppose you could use the clients New proc as well). You need to check to see if the person logging in is banned like this:

if(ban_list.Find("[ckey]")) //look for a match in the ban list
src << "your banned"
del(src) //if a match was found, boot them

As for saving, you can just save this list in F["ban_list"] where ever you want in your ban file.



A second approach would be to use the savefile more, and no list. With this option there are lots of possabilities. You could have a banned variable associated with each key, when they login and try to choose a character, check their banned variable. Or, you could have a banned directory where you store their ckey's seperately.
In response to English
Thanks... this sheds some light on it, I'll have to look more into the saving of files. I've got the Blue Book so just need to read up on it more. As for the 2nd choice u gave, I've already got something like this that takes their Shout/WorldCHAT abilities away if they abuse them.

Thanks!
LJR
In response to LordJR
It should work similarly to your worldChat ban. As for saving the list this is all you'd need to do:

var/list/ban_list = new()

world
New()
var/savefile/F = new("players.sav") //whatever you savefile is called
F["ban_list"] >> ban_list //read global ban list from file
if(!ban_list) //explained at end
ban_list = new()
Del()
var/savefile/F = new("players.sav")
F["ban_list"] << ban_list //store ban_list in savefile


You need to put that check in New because if the ban_list has never been saved before the list will actually be deleted when you try to load the non-existing list into it. Testing it's length won't work because it actually deletes the list.

If I were to do it I'd probably just have a variable for each character that is 1 if they are banned and 0 if they are not. The reason is because then I could use my FileSearch library to change the variable instead of adding more GM procs to my games.
In response to English
English wrote:
If I were to do it I'd probably just have a variable for each character that is 1 if they are banned and 0 if they are not. The reason is because then I could use my FileSearch library to change the variable instead of adding more GM procs to my games.

Yeah looks like what I'll do since this is how I did the ShoutBan.

;)
LJR