ID:148336
 
I'm trying to make a gm list to accept new names like my ban list. Heres my code, including when its saved, and when its added to, etc. My ban list works fine, however the gmlist doesn't accept and new names, etc. I checked the savefile, and the list is being saved, however it is not being added to when I order to be. Code exert here:
world /* set the world's settings */
New()
..()
var/savefile/F = new ("s_admin.sav")
F["banned"] >> banned //load banned list
if(isnull(banned)) //if first time starting
banned = new/list() //initialise the list
F["gmlist"] >> gmlist //load the GM list
if(isnull(gmlist)) //if this is the first time starting up
gmlist = new /list //initialise.
..()
Del()
var/savefile/F = new ("s_admin.sav")
F["banned"] << banned //save the banned list
F["gmlist"] << gmlist
for(var/mob/M)
if(M.client)
M.client.base_SaveMob()
..()
heres the var:
var/list/gmlist
var/list/banned
And heres the verbs to add people to the gm list or remove them:
GM
Ryuo
verb
AddGM(mob/M as mob in world)
set category = "GM Commands"
if(!M.key) return
if(M.gm==1)
usr << "[M] has been granted GM status by [usr]."
M.gm = 1
gmlist += "[M.key]"
if(M.client)
gmlist += "[M.client.address]"
else
usr << "[M] is already a GM."
RemoveGM()
set category = "GM Commands"
var/removal = input("Remove which IP/key from the GM list?","Remove GM:") as null|anything \
in gmlist
if(!removal) return
gmlist -= removal
Lastly, here are my ban commands in case they are needed:

Ban(mob/M in world)
set category="GM Commands"
if(!M.key) return
if(alert("Are you sure?","Ban [M]:","Yes","No") == "Yes")
world.log << "[usr] banned [M]."
banned += M.key
if(M.client)
banned += M.client.address
del(M.client)
del(M)
UnBan()
set category="GM Commands"
var/removal = input("Remove which IP/key from the ban list?","Unban:") as null|anything \
in banned
if(!removal) return
banned -= removal</<></<>
if(M.gm==1) <font color=yellow><-- should this be if(M.gm!=1) ?</font>
usr << "[M] has been granted GM status by [usr]."
M.gm = 1
gmlist += "[M.key]"
if(M.client)
gmlist += "[M.client.address]"
else
usr << "[M] is already a GM."
In response to Skysaw
Your right, it should. I changed it so I could try adding my name to the list, but my gm is coded in. I'm trying to get a working gm list to use.
In response to Skysaw
Skysaw wrote:
if(M.gm==1) <font color=yellow><-- should this be if(M.gm!=1) ?</font>

Wouldn't if(!M.gm) make even more sense?

Lummox JR
In response to Lummox JR
Lummox JR wrote:
Skysaw wrote:
if(M.gm==1) <font color=yellow><-- should this be if(M.gm!=1) ?</font>

Wouldn't if(!M.gm) make even more sense?

Lummox JR

Yes, and I would have done it that way. I was trying to point out where I thought a typo had occurred.
In response to Skysaw
Do any of you have suggestions on why it isn't saving?
In response to Ryuo
Ryuo wrote:
Do any of you have suggestions on why it isn't saving?

You're going to have to give us a little more information. You made the change I suggested, and it's not saving? Are you getting an error message? Are you getting the added to GMs message? Is it possible it's saving but not loading back in when you restart your world?
In response to Skysaw
!! I just noticed that the info IS saved, but then a few seconds later, its gone. Anyone have a clue as to why it would do this?