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 =/. |
In response to Y2kEric
|
|
And inefficient.
turf/Enter(mob/m) |
In response to Hell Ramen
|
|
=O thanks...
return 0 then return..()?thanks again =D |
In response to Hell Ramen
|
|
Hell Ramen wrote:
And inefficient. > turf/Enter(mob/m) if(!(m.ckey in admins)) =P |
In response to Justin B
|
|
Heey, you try programming on a minicomputer!
Tough work, I tell you. Just typing is hard. =( |
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. |
In response to Pharaoh Atem
|
|
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. |
In response to SSJ2GohanDBGT
|
|
This is actually really simple stop being show-offs -_-
turf/GM |
In response to Chrisman767
|
|
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. |
In response to SSJ2GohanDBGT
|
|
I suppose just because its smaller >.> But both would do the same thing, I didn't really think while making that.
|
In response to Chrisman767
|
|
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.
|
In response to Artemio
|
|
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.
|
In response to Chrisman767
|
|
Chrisman767 wrote:
This is actually really simple stop being show-offs -_- > turf/GM Yuck! |
In response to XzDoG
|
|
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. |
In response to Mysame
|
|
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.
|
In response to PirateHead
|
|
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. |
In response to PirateHead
|
|
PirateHead's got a point.
PH. Dude. You know a LOT about coding. You know how to fix every single coding problem existed in BYOND. How do you know so much coding things? It's... just amazing. your posts are the perfect answers for everyody. |
This is Untested.