ID:270287
 
i am making a GM house in my game but every 1 has fly so they can fly right over the walls i have the door set to let just gms in but how can i stop any 1 else from flying over the walls plz help
turf/wall/Enter(mob/M)
if(istype(M))
if(!M.density)
return 0

else return 1
else return ..()
In response to Mysame
That's REALLY vague, and there's a LOT of bad code in there, Mysame. I'd suggest something more like this:

turf
GMwall
density = 1
opacity = 1
Enter(var/atom/movable/O)
if(O&&istype(O,/mob))
var/mob/M = O
if(M.gm&&M.density==0) //test if it is a gm... You'll have to replace this line.
return 1
else
return 0
else
return ..()


Now, it may just be me talking, but I spent some time as a C/C++ programmer. If I compiled something like your example in C, Mysame, it wouldn't compile.

I'll tell you why: Because Enter() is sort of a boolean statement. You never call enter for anything but a true or false value, thus, it MUST ALWAYS return a value. If you don't put an else clause, or at least a fallback return at the bottom, you aren't returning a value at some point or another. It may not be neccessary in BYOND, but it saves massive headaches later.
In response to Ter13
tnx it is working now