;'Silent Death' item poison

ItemID = 142

;'Arena of the Kings'
If #MAPID = 997
	SendMessageToUser(#USERID,"The Arena of the Kings supresses use of this item here.",#MSG_SERVER)
	GoTo END
ElseIf #MAPID = 998
	SendMessageToUser(#USERID,"The Arena of the Kings supresses use of this item here.",#MSG_SERVER)
	GoTo END
EndIf

PlusX = 0
PlusY = 0

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

UserID = GetUserAtXY(#MAPID,#XPOS+PlusX,#YPOS+PlusY)

If UserID = #USERID
	SendMessageToUser(#USERID,"Using Silent Death upon yourself might not be a good idea...",#MSG_EMOTE)
	GoTo END
EndIf

If GetMapType(#MAPID) = #MAPTYPE_FRIENDLY 
	SendMessageToUser(#USERID,"You can't use this item here.",#MSG_EMOTE)
	GoTo END
ElseIf GetMapType(#MAPID) = #MAPTYPE_NEUTRAL
	If GetUserGuild(#USERID) = 0
		SendMessageToUser(#USERID,"You can't use this item here.",#MSG_EMOTE)
		GoTo END
	ElseIf GetUserGuild(UserID) = 0
		SendMessageToUser(#USERID,"You can't use this item here.",#MSG_EMOTE)
		GoTo END
	ElseIf GetUserGuild(#USERID) = GetUserGuild(UserID)
		SendMessageToUser(#USERID,"No player within reach...",#MSG_EMOTE)
		GoTo END
	EndIf
EndIf

If UserID = 0
	SendMessageToUser(#USERID,"No player within reach...",#MSG_EMOTE)
	GoTo END
EndIf

If GetUserAccess(UserID) > 5
	SendMessageToUser(#USERID,"You can't poison this player, he's a GM.", #MSG_CRITICAL)
	GoTo END
EndIf

TakeItem(#USERID,ItemID)

SendMessageToUser(#USERID,"You give Silent Death to "+GetUserName(UserID)+".",#MSG_CRITICAL)

Loops = 50

i = 0
While i < Loops
	i=i+1
	If Mod(i,3) = 1
		Timer(226,3000*i,UserID,8,"0")
	EndIf
Wend

Label END

Continue = 1