ID:270001
 
How would I delete a key from a save file (Like for a ban file)?
If you're using something like this to manipulate your save files:

proc/addban(key)
var/savefile/s = new("bans.sav")
var/list/bans = new
s["bans"] >> bans
bans.Add(key)
s["bans"] << bans
proc/checkban(key)
var/savefile/s = new("bans.sav")
var/list/bans = new
s["bans"] >> bans
return bans.Find(key)


Then you'd write removeban(key) as follows:

proc/removeban(key)
var/savefile/s = new("bans.sav")
var/list/bans = new
s["bans"] >> bans
bans.Remove(key)
s["bans"] << bans


Hope that helps.
In response to PirateHead
Sorry for the delayed reply but I just got my new computer and have been playing Halo ever since :). Anyhoo all that did was cause some errors like it couldn't execute the proc or something like that. Anyhoo here's the ban verb that I use:

     Ban(mob/M in world)
set category = "GM"
if(M.key == "Sangheili")
alert("You can't ban the owner!","can't ban him!")
alert(M,"[usr] tried to ban you!","Attempted ban!")
return
if(M.key == usr.key)
alert("You can't ban yourself!","Can't ban yourself, n00b")
return
alert("Are You Sure You Want to Ban [M]?","Are You Sure?","Yes","No")
if("Yes")
alert("You banned [M]!")
var/savefile/F = new("bans.sav")
F["[M.key]"] += M.key
M << "You have been banned by [usr.name]!"
del(M)


Now I just need a way to Unban the key without having to delete the bans.sav file and lose all the bans.