;'[Frostbite Door]' NPC script

KEY = 328
KEY_NAME="Frostbite"

PlusX = 0
PlusY = 0

DIR = GetUserDirection(#USERID)
If DIR = #DIR_UP
	PlusY = -2
ElseIf DIR = #DIR_DOWN
	PlusY = 2
ElseIf DIR = #DIR_LEFT
	PlusX = -2
ElseIf DIR = #DIR_RIGHT
	PlusX = 2
EndIf

If HasItem(#USERID,KEY) = 1
	SendMessageToUser(#USERID,"You used the "+KEY_NAME+" key to unlock the door.",#MSG_SAY)
	WarpUser(#USERID,#MAPID,#XPOS+PlusX,#YPOS+PlusY)
ElseIf GetUserAccess(#USERID) > 4
	SendMessageToUser(#USERID,"The door opens for you, as a moderater.",#MSG_SERVER)
	WarpUser(#USERID,#MAPID,#XPOS+PlusX,#YPOS+PlusY)
Else
	SendMessageToUser(#USERID,"This door requires the "+KEY_NAME+" key to open.",#MSG_SAY)
EndIf

Continue = 1