ID:178396
 
turf/redturf
Entered(O)
if(usr.isred == 1)
..()
else
usr <<"Only red team members can pass this point!"
//What here to block the usr and move him back one?

You don't want it in Entered, you want it in Enter. Enter is the check to see if they are allowed to enter or not. If the Enter proc returns 1, they can enter, if it returns 0, they can not.
ShadowSiientx wrote:
turf/redturf
Entered(O)
if(usr.isred == 1)
..()
else
usr <<"Only red team members can pass this point!"
//What here to block the usr and move him back one?

Foomer is right here that you need Enter(), not Entered(), for this case--but you also need something else. You need to not use usr, which is totally wrong in Enter() or Entered(). usr should only be used in verbs, input procs like Click(), or procs always called by verbs.

Notice that you've got an argument, O, to work with: That's what you should be using in place of usr. That's the obj or mob that just entered--or, with Enter(), is trying to enter.

Try this:
turf/teamdoor
var/team // set to "red" or "blue" or what have you

Enter(atom/movable/A)
if(ismob(A))
var/mob/M=A
if(M.team!=team)
M << "Only [team] team members can pass this point!"
return 0 // none shall pass!
return ..() // okay, go ahead if it's clear

Lummox JR
In response to Lummox JR
Does return ..() do anything in Enter procs?
In response to WizDragon
WizDragon wrote:
Does return ..() do anything in Enter procs?

Yes, it does. Enter() is called to tell whether the turf can be entered or not using Move(). It returns 1 if moving in is allowed, 0 if it's not. The default behavior is to return 1 if the atom entering is non-dense, or the turf is non-dense and no dense atoms are in its contents. (That is, if you try to walk through a wall, which is dense, you can't unless your density is 0; if you try to walk through a doorway blocked by someone else, you can't walk through unless either one of your densities is 0.)

So the default behavior is what you'll usually want to fall back on, since returning 0 for members of other teams is just done as an exception to the rule.

Lummox JR