;'Event Win' timed script

UserID = #PARAM1

SetUserFlag(UserID,40,GetUserFlag(UserID,40) + 1)

CurrentHighest = GetUserFlag(0,40)

If GetUserFlag(UserID,40) > GetUserFlag(CurrentHighest,40)
	If CurrentHighest <> UserID
		SetUserFlag(0,40,UserID)
		If GetUserFlag(UserID,40) > 50
			SendMessageToUser(UserID,"You have won the most events of any player! This feat is recorded on one of the statues in the event center.",#MSG_SERVER)
			SendMessageToUser(UserCurrentHighest,GetUserName(UserID)+" has stolen your rank of most events won.",#MSG_SERVER)
		EndIf
	EndIf
	If Mod(GetUserFlag(UserID,40),50) > 0
		If GetUserFlag(UserID,40) = 0
			SendMessageToAll(GetUserName(UserID)+" has won "+GetUserFlag(UserID,40)+" events!",#MSG_SERVER)
		EndIf
	EndIf
EndIf

Continue = 1