area/GM
Entered(mob/M)
if(M.AdminXX2 == 0)
alert("Only GMs are aloweed to enter")
return 1
Problem description:Normal players can enter =/.
ID:263055
![]() Apr 20 2006, 11:07 am
|
|
Code:
area/GM Problem description:Normal players can enter =/. |
And inefficient.
turf/Enter(mob/m) |
Hell Ramen wrote:
And inefficient. > turf/Enter(mob/m) if(!(m.ckey in admins)) =P |
The problem, which apparently hasn't been explicitly pointed out, is that you used Entered() instead of Enter(). When a mob moves, here's the progression:
So, as you can see, you were checking to see whether they were a GM after the mob had already moved into the area. In the help given, Enter() was correctly used instead of Entered(). Hopefully, you won't have to make the mistake again. Just remember to apply the tense: you have Entered after you Enter. |
return ..() returns to the parent procedure(in this case, Enter) and calls it. Without that, You wouldn't move at all.
return 0, in short, does a stop-halt on the procedure where it's at. |
This is actually really simple stop being show-offs -_-
turf/GM |
Who was showing off? =P He asked a question and I answered it.
By the way, Hell Ramen's way was already stated and is much more efficient. |
I suppose just because its smaller >.> But both would do the same thing, I didn't really think while making that.
|
There's no place for usr in Enter(), that else return statement is unnecessary, you didn't return 0 if access is denied, and you didn't return ..() if access is granted.
|
Actually, I avoid returning to the parent because if the turf's density is one, you're still screwed. Though, you/we/whoever may know this, and fix it, but some people'll look over that and re-ask the question.
|
Chrisman767 wrote:
This is actually really simple stop being show-offs -_- > turf/GM Yuck! |
XzDoG wrote:
Yuck! It's not yuck! It's very nice, and it would be just about perfect with a few minor tweaks. area/GM_only/Enter(mob/m) Edit: I screwed that up. It ought to be better now... just incase anybody was looking at it. |
That makes no sense. Returning 1/TRUE would signify that regardless of the turf's density you could enter it if gm is true, however checking to see if gm is true then, if so, returning the parent would mean that it checks if the turf is enterable.
|
PirateHead wrote:
The problem, which apparently hasn't been explicitly pointed out, is that you used Entered() instead of Enter(). When a mob moves, here's the progression:
Not to nitpick, but I believe turf/Exit() and Exited() come before Enter() and Entered() of the next turf. I'm unsure where they are in respect to Move(), however. |
This is Untested.