mob
var
list
BlockList = list()
PM = 1
verb
PM()
set hidden = 1
var/list/players = list()
for(var/mob/Player/M in world)
if(M.creating) players-=M // NOT WORKING
if(M.client && M.PM) players += M // WORKING
if(M == usr) players-=M // WORKING
if(usr.key in M.BlockList) players-=M
players += "Nevermind"
Problem description:
Everything alse is restricted from list like it supposeto be just if(M.creating) player is not restricted.
You have a player mob, with an attached (so not null) client, and they have PM enabled, and they are also "creating".
Your code will firstly remove them from the list of players (because they are "creating") but then immediately afterwards, add them back into the list of players because they have PM enabled. Just move the statement down, so that you do your additions to the list first, and removals afterwards to prune the list back.
Ideally, you'd actually just put the removals first, but replace 'players -= M' with 'continue', letting you skip over those mobs that shouldn't be in the list. Then you don't need to remove them, as they are never added in the first place.
Usual deal, as I see you've posted here /a lot/ lately. +1 the most helpful post please.