ID:2147217
 
(See the best response by Kaiochao.)
Code:
turf/hiddenwalls
leafwall
Enter(mob/M)
if(M.village != "Leaf")
var/entry = 0
for(var/obj/inventory/leafpass in M.contents)
entry = 1
if(entry == 1)
return 1
else
M << "You can't go in the leaf village without a passport!"
return 0
else
return 1


Problem description:Anyone can go through the wall, even people without a passport.

Are you getting the message saying you can't pass? Also, there's no guarantee in that code that M will be a mob, you'll want an ismob() check and probably a client check if you only want players being checked.

You can check for the pass in their inventory without a loop as well.
var/obj/inventory/leafpass/has_pass = locate() in M.contents
if(has_pass) // They have it.
// Do stuff


You should also be sure you're NOT in the Leaf village.
In response to Nadrew
Best response
The problem is that he's not actually looking for a leafpass; he's looking for any /obj/inventory in M.
Good catch.