ID:167916
 
Is there a way to limit a person from entering a specific area,like he needs lvl 20 or a item.?
Yes. For this you'll want to look up the Enter() proc.

Hiead
In response to Hiead
I see.Thanks.
area/LVLRestrict
Enter()
if(usr.LVL <=20)//checks to see if the mob is below lvl 20
return //stops the mob if there lvl is below 20


This is probebly your best bet.
In response to Dark Krow
Dark Krow wrote:
area/LVLRestrict
> Enter()
> if(usr.LVL <=20)//checks to see if the mob is below lvl 20
> return //stops the mob if there lvl is below 20

This is probebly your best bet.

It's good that you're trying to help, but that isn't quite what he's looking for. For one, he said "or an item," and for reason two, you don't return the default value, so even if they SHOULD be permitted, they won't. Also, using usr there is inappropriate.
area/LVLorOBJRestrict
Enter(atom/movable/M)
if(M.Level<20&&!(locate(/obj/requireditem) in M))
return 0
return ..()


If the level variable isn't stored in atom/movable(I guess it's more probable it would belong to the mob class), you could always typecast:
area/LVLorOBJRestrict
Enter(A)
if(ismob(A))
var/mob/M=A
if(M.Level<20&&!(locate(/obj/requireditem) in M))
return 0
return ..()


That's probably a better bet than what you claimed to be the best bet. =P

Hiead
In response to Hiead
I stand corrected. See even ppl trying to help learn somthing.
In response to Dark Krow
Ah!