Block_User()
set desc = "Block or unblock a user's text."
var/list/whatever= new
var/howmanypeople=0
for(var/mob/K in world)
if(K.client)
whatever+=K
howmanypeople+=1
whatever+="Cancel"
whatever-=usr
howmanypeople+=1
if(howmanypeople <= 0)
return
else
var/mob/C=input ("Block or unblock a user?","Block/unblock user") in list("Block","Unblock","Cancel")
if(C == "Cancel")
return
if(C == "Block")
var/mob/T=input ("Who do you want to block?","Block user")in whatever
if(T=="Cancel")
return
if(T.Owner == 1)
usr << "<font color=green><b>You cannot block the owner's text."
return
if(T.MGM == 1)
usr << "<font color=green><b>You cannot block an MGM's text."
return
if(T.GM == 1)
usr << "<font color=green><b>You cannot block a GM's text."
return
if(T.Admin == 1)
usr << "<font color=green><b>You cannot block an admin's text."
return
else
if(findtext(usr.client.blocked,T) == 1)
usr << "<font color=green><b>[T] has already been added to the blocked list."
return
usr.client.blocked += T
usr << "<font color=green><b>Added [T] to the blocked list."
if(C == "Unblock")
var/mob/U=input ("Who do you want to unblock?","Unblock user") as null|anything in usr.client.blocked
if(!U) return
usr << "<font color=green><b>Removed [U] from the blocked list.</font></b>"
usr.client.blocked -= U
client
New()
..()
var/blocked = Import()
if(blocked)
var/savefile/Q = new(blocked)
Q >> blocked
return ..()
Del()
var/savefile/Q = new ("blocked.sav")
Q["blocked"] << blocked
usr.client.Export(Q)
..()
I don't get any runtime errors, and the savefile seems to be correctly exported to the player's PC, but when I try to unblock someone, nothing happens. Any help?
Also, you are using findtext to search for something in a list. I suggest you use if(T in usr.client.blocked) instead of if(findtext(usr.client.blocked,T)==1).