ID:170234
 
Can anyone give me a code that allows only certain players to enter an area, similar to onefishdown's code in his GTA game?
turf
Enter(mob/M)
if(M.own == 0)
M << "You can't access this area."
return 1


I dont know if I did the return 1 right. I gave him exactly what he asked for though. =P
In response to Shades
Not quite Shades. =)

You want to return 0 if you don't want to let them in, otherwise return ..() so that you don't override the usual procedure (preventing a dense atom from moving into a space already holding a dense atom).

area/only_goblin_mobs_allowed
Enter(mob/M)
if(ismob(M) && !istype(M,/mob/goblin))
return 0
return ..()


This will prevent any mobs that aren't of type /mob/goblin from entering. Please note the ismob() check, that's there to still allow objects to enter normally.
Here is a little friendly reading: The Code.

-Ryan