ID:142941
 
Code:
area
safe
Enter(mob/M)
if(M.NPC==1)
return 0
else
return 1


Problem description:

Eh, probably a simple fix, but this doesn't work... The NPC moves straight through it.
That's because there's nothing there that it's doing. Do you want them to stay out or tele to a new location? What do you want it to do?
You've got a few mistakes there:

area/safe/Enter(mob/M)
if(ismob(M)) //you have to ensure that M is a mob
if(M.NPC)
return 0 //disallow movement if M is an NPC
return ..() //..() for normal movement rules


Now, as for your problem: have you actually placed the area/safe on the map? Are the NPCs OUTSIDE the area? Enter() will only be called on the boundaries of areas. NPCs will be able to move within the area if they are already in it, they simply won't be able to enter it.
In response to Jholder84 (#1)
Jholder84 wrote:
That's because there's nothing there that it's doing.

It's returning a value. This is precisely what Enter() should be used for. Enter() is called by Move() in order to determine if entry is allowed: it will return 1 if entry is allowed, or 0 if it is not. By default, it returns 1 only if the argument is dense and there is already a dense object on the turf (or the turf itself is dense).
In response to Garthor (#2)
Ah, I see, I see. Thank ya.

Lmao, Garthor is basically coding my entire game for me... -_-