ID:264646
 
Code:
mob/GM/verb/Upload_Ban_List()
if(fexists("Saves/World Configuration/Banned.cfg"))
var/savefile/F = new("Saves/World Configuration/Banned.cfg")
banned=copytext(F,1,Banned)
usr<<"Banned List Successfully Loaded"
usr<<"Added Banned.cfg Players to Banned List"

var/list/Banned=list()

mob/Login()
if(src.key in Banned)
src<<"You're Banned"
del(src)
return


Problem description: Well i banned me only to test. But when i Login it dont send the message You're Banned. I Think im worng in something of Copytext. Any Idea?

From the reference:
copytext proc
Format:
copytext(T,Start=1,End=0)

so what you have, in english, is...
copy the text from savefile F starting at index o to index list/Banned and place it into banned
Note that Banned and banned are not the same.

Doesn't make much sense to me. It would help to see how you are saving the ban list. If you are saving it in a format such as "Key,Key,Key" then you need to separate each key out and place them into different spots on the list.
In response to Redslash
Hmm, i dont understand :/
In response to Gohan Games
Hmm, nor do i.
If Banned is a list, you don't need copytext() at all.

Load the saved value of Banned into a list and run a standard if() check...
Yes, your copytext() call makes no sense at all and you're not even dealing with text here, but with what's supposed to be a list.
If you want to know how to use savefiles (such as how to load data from them), then look them up in the DM Reference, along with associated entries. You can also read the savefiles chapter of the DM Guide.
Well based off the code you gave us, the Banned list is never loaded from a savefile thus resulting in an empty list, so why exactly would you even see the "You're Banned" message?
In response to Ssj4justdale
He is exporting a text file from the net. using copytext and findtext in that file to add the banned to a list.

His info was quite less to understand though.
Badguy
Badguy2


thats his text file format. He wants to get all the keys in the text in a list in the game as Global_Banned.

I told him to use copytext() and findtext() and told him every line indicates a \n in the file.

Since I won't spoon feed him - I didn't feed him the code.
In response to Getenks
No Getenks. >_> I'm doing a ban System not exporting form the net.
In response to Gohan Games
Uhh then why the hell did you use copytext().

Just save the whole list to the .cfg and reload it.

var/list=Banned_list

var/savefile/F = new(name.cfg)
F["Banned"] << Banned_list

// thats saving do this while your about to close the world

var/savefile/F = new(name.cfg)
F["Banned"] >> Banned_list

//thats loading do this after you begin the world


Adding keys - Do it while runtime using list.Add()
Removing keys - Do it while runtime using list.Remove()